clang: error: linker command failed with exit code 1 (use -v to see invocation) - iphone

I have developed an iOS Application with Xcode 5, release 6.
I have successfully run the application on the iOS simulator and on my iPhone 5 (iOS7 beta6)
I'm following Apple's tutorial on how to release the app onto the app store (bit complicated).
I've gotten to the point where they want me to "Archive" my project. Everytime I attempt to archive it, it gives me this error:
ld: file not found:
/Users/name/Library/Developer/Xcode/DerivedData/Mobile-cwvgezbobyhhzzccadgoqizqcmfd/Build/Intermediates/ArchiveIntermediates/trial/InstallationBuildProductsLocation/Applications/libCordova.a
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

Well, since you are using Xcode 5, Apple says on the member center:
"Xcode 5 Developer Preview cannot be used to submit apps to the iOS or
Mac App Store. Continue to use the publicly released version of Xcode
to compile and submit apps to the App Stores."
But I will show some suggestions anyway:
With Xcode, click on your project's icon on the left, select the tab Build Phases > Compile Sources and click on the "+" to check if there is some file .m to be imported.
Check if you imported all the frameworks you are using to your project.
Go to Build Settings and look for Architectures and set armv7 instead of armv6 and armv7s.
I hope this helps.

Related

Xcode 14 Xcode 13 incompatibility

When I manually add the SDK that I exported in Xcode 13 to xcode 13 and xcode 14, it works for all devices without any problems. But when I export in xcode 14, it only works for simulators in xcode 13, I can't build on real devices, (in xcode 14 it works on all devices without any problems). For the SDK I exported in Xcode 14, the errors I get when I run it on real device in xcode 13 are as follows:
directory not found for option '-F/(framework path)'
Undefined symbols for architecture arm64:_objc_msgSend$subfiles
Undefined symbols for architecture arm64:_objc_msgSend$subfiles
...
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I deleted the framework search path for the directory not found error and I found a solution to it, but I couldn't find a solution for the errors I got for all the sub-files of the SDK below:
Undefined symbols for architecture arm64:_objc_msgSend$subfiles
And
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thank you very much in advance for your comments.
After long research, I discovered the solution. Clang emits objc_msgSend in Xcode 14; previous versions of Xcode don't understand it. This needs to be disabled. Here is the link I used for the solution. Commited changes are available at this link. Big thanks to these guys.
By the way, selecting the compatible version for Xcode 14 of Command Line Tools from XCode > Preferences > Locations section, and also updating the Clang version (you can type clang -v in the terminal) to be compatible with this version.
You can add -fno-objc-msgsend-selector-stubs settings to C Flags under Apple Clang - Custom Compiler Flags from Targets > Build Setting directly from Xcode

Xcode error: building for iOS Simulator, but linking in object file built for iOS

Never had a lot of problems until the time to buy Macbook Air M1. Just yesterday my app was build without any error in Xcode 12.4. I did not make any special changes and today build failed:
/Users/userName/Projects/MyApp/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a(cryptlib.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/userName/Projects/MyApp/ios/Pods/OpenSSL-Universal/ios/lib/libcrypto.a' for architecture arm64clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please can you help me, how to solve it?
Looks like a missing Arm64 simulator slice in the OpenSSL-Universal CocoaPods distribution.
Make sure that you're using the latest version with pod update and contact the OpenSSL-Universal if there's still an issue.

xcode7: hit linker command failed with exit code 1 under

I hit below error when build app on real device(ios9.0) use xcode7 beta:
ld: library not found for -lPods...... clang: error: linker command
failed with exit code 1 (use -v to see invocation)
I tried to
change the config "Enable Bitcode" to "NO".
hardcode Framework path under build setting tab
but it didn't help.
check this framework if existed in your project folder,you can right
click on this framework in Xcode.
if existed, delete this framework under Frameworks in Xcode and then copy this framework into Xcode again for re-reference.

Social.framework not found

I'm trying to link Facebook SDK 3.1 with my existing iOS application. Base SDK is 6.1, iOS Deployment Target is set to 5.1.
I added Social, Accounts and AdSupport framework to the project and set them to Optional in the Build Phases > Link Binary with Libraries. I also tried to manually link them with -weak_framework in "Other Linker Flags".
However, I always end up with:
ld: framework not found AdSupport
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What am I doing wrong?
Thanks in advance!
EDIT: Using XCode version 4.6 by the way!
the social framework is new in iOS6, if you are supporting iOS5 you has to go to your Target Properties/Build Phases/Link Binary with Libraries and mark the Social framework as Optional as shown in the image

facebook ios sdk build fails on device, works on simulator

I am trying to build an app (with ARC) that uses the facebook_ios_sdk (the latest version on github).
As recommended by Facebook, I used the build script to create a static library and then added it to the project.
Now when I build the project for an iPhone 5.1 Simulator, it works fine. However, on running it for an actual device (which is running 5.1), it gives the following build error -
ld: in ../facebook-ios-sdk/libfacebook_ios_sdk.a, file is universal but does not contain a(n) armv7 slice for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any suggestions on how to resolve this?
You could modify the build script for static library (which was too complicated for me), or just skip the library approach:
add the Facebook sources from SDK to your project
if using ARC, go to "target->build phases->compile sources" and mark all the Facbook source files with the--fno-objc-arc flag
That's it, works for me.
One work around that worked was to change the Valid Architectures from"armv6 armv7" to just armv6