Context
I have to submit a MacOSX application to the AppStore. App was generated by Qt.
I'm using OSX 10.11 and Xcode 7.0 beta (7A121l)
What I have tried
I have created a MacOSX app with Qt that I have to submit to the AppStore
When I generate the .appfile with Qt, it runs pretty well. I don't know how to create a binary to upload with Application Loader for Mac so I have exported that Qt project to a Xcode project using the following command
qmake -spec macx-xcode Myproject.pro
And it creates a Xcode project for me.
Problem
When I compile that app inside Xcode, some frameworks are not found.
Ld Debug/track.app/Contents/MacOS/track normal x86_64
cd /Users/User/development/projects/track/track_desktop
export MACOSX_DEPLOYMENT_TARGET=10.7
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -L/Users/User/development/projects/track/track_desktop/Debug -L/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks -L/Users/User/Qt/5.5/clang_64/lib -F/Users/User/development/projects/track/track_desktop/Debug -F/Users/User/Qt/5.5/clang_64/lib -F/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks -filelist /Users/User/development/projects/track/track_desktop/track.build/Debug/track.build/Objects-normal/x86_64/track.LinkFileList -mmacosx-version-min=10.7 -F/System/Library/Frameworks -headerpad_max_install_names -Wl,-rpath,/Users/User/Qt/5.5/clang_64/lib -F/Users/User/Qt/5.5/clang_64/lib -framework Carbon -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework QtNetwork -framework OpenGL -framework AGL -Xlinker -dependency_info -Xlinker /Users/User/development/projects/track/track_desktop/track.build/Debug/track.build/Objects-normal/x86_64/track_dependency_info.dat -o /Users/User/development/projects/track/track_desktop/Debug/track.app/Contents/MacOS/track
ld: framework not found Carbon
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And also: DiskArbitration, IOKit, OpenGL and AGL
Conclusion
I think that qmake hadn't created the linker paths correctly.
Question
How can I link that libraries to my Xcode project in order to compile and to generate my binary?
These answers and questions don't help me:
Qt Mac Deployment > I have done that
Qt Mac OS Deployment - You must supply an Apple ID -> He didn't explain how to do it
Qt Deployment for Mac, configuring executable inside bundle
To start, i looked at all the other search topics and none applied or didn't work. For example, i have a hard time that apple didn't make xctest compatible with all architectures.
On a Xcode project for work i randomly started getting the following build error on linking:
Ld /Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Intermediates/InVenueExperience.build/Debug-iphoneos/InVenueExperience.build/Objects-normal/armv7/InVenueExperience normal armv7
cd /Users/eallen/tmdev/ios/mive
setenv IPHONEOS_DEPLOYMENT_TARGET 7.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Products/Debug-iphoneos -L/Users/eallen/tmdev/ios/mive -L/Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Intermediates -F/Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Products/Debug-iphoneos -FFrameworks -FPods/Pixate/Framework/iOS -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/Developer/Library/Frameworks -filelist /Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Intermediates/InVenueExperience.build/Debug-iphoneos/InVenueExperience.build/Objects-normal/armv7/InVenueExperience.LinkFileList -dead_strip -ObjC -lObjC -lxml2 -framework CoreGraphics -framework CoreText -framework MobileCoreServices -framework Pixate -framework QuartzCore -framework Security -framework SystemConfiguration -framework UIKit -fobjc-arc -fobjc-link-runtime -fprofile-arcs -ftest-coverage -miphoneos-version-min=7.0 -lPods -framework QuartzCore -framework CoreText -framework CoreGraphics -framework CoreData -framework UIKit -framework Foundation -framework Crashlytics -Xlinker -dependency_info -Xlinker /Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Intermediates/InVenueExperience.build/Debug-iphoneos/InVenueExperience.build/Objects-normal/armv7/InVenueExperience_dependency_info.dat -o /Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Intermediates/InVenueExperience.build/Debug-iphoneos/InVenueExperience.build/Objects-normal/armv7/InVenueExperience
ld: in '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest', missing required architecture armv7 in file /Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest (2 slices) for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
All this while trying to build my application target and NOT my test target. Some further notes:
I am NOT linking against XCTest in my build settings for the application target
I am building, not testing this specific target
I do have in both my build settings -> Architectures|Valid Architectures "Standard Architectures (armv7, armv7s).
This only happens when i build for a iOS device and not a simulator...i think this is because building for a simulator only tries the i386 architecture?
To be honest, i have no idea why the linker is even trying to link against XCTest in this case...i even modified the scheme to remove all tests though i wasn't trying to test against the target.
Please feel free to ask me any other questions.
You may have the same simple but frustrating problem as I had. It's a scheme setting:
Click on your project scheme in the toolbar (right of the play/stop buttons), and select 'Edit' from the popup. Under the 'Build' item on the left, make sure your test targets only have 'Test' checked.
Please make sure the Build Setting of "build Active Architecture only" is set to NO, maybe it's the cause of this problem.
Turns out that buried deep in the compile sources for the application target i had a file that included imports for XCTest stuff...removing this immediately made this go away.
So answer being verify that you do not have anything in your compile sources list that may reference a library you didn't intend
I just had the same issue after including a third-party project. When selecting the target I chose the main project target (not the test target), but the included project had a sub-target which were unit tests. Xcode helpfully added those to my main application target. After changing the target setting for the relevant file it worked alright.
It happens that after adding $(PLATFORM_DIR)/Developer/Library/Frameworks as a first item in <Target>/<Build Settings>/<Search Paths>/<Framework Search Paths> I got rid of nasty "ld: framework not found XCTest for architecture arm64" link error by using XCode 6.3.1.
I have a problem to link the j2objc library as a subproject. It always ends up with "missing libjre_emul.a" error.
Steps I have done:
1) Create empty iOS project
2) Include j2objc library by following the simple steps in the part "Including JreEmulation project into your project.
I checked that I am building for the iPhone simulator and the build process is running. It seems that libjre_emul.a is generated at j2objc/jre_emul/build_result/ but it should be also available in the DerivedData, which is not. I have also tried setting a shared folder for DerivedData (File -> Project settings -> Derived Data -> Advanced), but this didn't help.
The reason why I would like to include it as a subproject is to be able to set breakpoints inside j2objc source.
Here is the error:
Ld /Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/SubProject4.app/SubProject4 normal i386
cd /Users/user/Documents/Project1/SubProject4
setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator -F/Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator -filelist /Users/user/Library/Developer/Xcode/DerivedData/Build/Intermediates/SubProject4.build/Debug-iphonesimulator/SubProject4.build/Objects-normal/i386/SubProject4.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -ObjC -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 /Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/libjre_emul.a -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/SubProject4.app/SubProject4
clang: error: no such file or directory: '/Users/user/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/libjre_emul.a'
Tom Ball responded on the j2obj google group:
The problem looks to be that the JreEmulation project's makefile is not copying the built library to where Xcode expects it to be. Xcode used to pass build environment variables like BUILT_PRODUCTS_DIR to external build system targets, but doesn't any more. Here's a workaround until I figure out how to fix embedding JreEmulation properly (if anyone has a solution, please reply):
Remove the red libjre_emul.a from your project's Link Binary with Libraries list.
In that list, click the + button, then Add Other...
Go to your j2objc directory, then dist/lib and add libjre_emul.a
Now when you look at the link list, libjre_emul.a should be red after cleaning your project (since it was deleted), and black after your project builds successfully.
So it was a bug, but I still can't debug/step into the j2objc source code. But at least this is working.
I am thinking of rebuilding the project from scratch which I would like to avoid, so I am asking for help.
When trying to build the project on release I get the following link error:
Ld
/Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos/MyStreamPlayer.app/MyStreamPlayer
normal armv7
cd /Users/MAS/iphoneApps/AlfsreamPlayer/MyStreamPlayer
setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk
-L/Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos
-L/Users/MAS/iphoneApps/AlfsreamPlayer/MyStreamPlayer -L/Users/MAS/iphoneApps/AlfsreamPlayer/MyStreamPlayer/../build -F/Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos
-filelist /Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Intermediates/MyStreamPlayer.build/Release-iphoneos/MyStreamPlayer.build/Objects-normal/armv7/MyStreamPlayer.LinkFileList
-Xlinker -map -Xlinker /Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Intermediates/MyStreamPlayer.build/Release-iphoneos/MyStreamPlayer.build/MyStreamPlayer-LinkMap-normal-armv7.txt -dead_strip -finalize -prefinalized-library libViewRightWebiOS.a -finalized-product /Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos/MyStreamPlayer.app/MyStreamPlayer
-libVideoWebiOS -fobjc-link-runtime -miphoneos-version-min=6.0 -framework Foundation -framework UIKit -framework CoreGraphics -framework MediaPlayer -framework CFNetwork -libVideoWebiOS_debug -libVideoWebiOS -o /Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos/MyStreamPlayer.app/MyStreamPlayer
clang: error: no such file or directory:
'/Users/MAS/Library/Developer/Xcode/DerivedData/MyStreamPlayer-auylvnjdlrkfpvaxnulcaadbfhwl/Build/Products/Release-iphoneos/MyStreamPlayer.app/MyStreamPlayer'
No problem with debug mode. The project runs fine on another computer on xcode 4.5.1. I thought the xcode version could be the problem but when I tried it on another computer with xcode 4.5.1 I got the same problem.
The project uses a library libVideoWebiOS. I have it on the Build Phases -> Link Binary With Libraries. Any idea what produce could this issue? Here is the screenshot of build settings -> architectures.
There are lot of suggestions to Change "Build Active Architecure Only" to Yes but unfortunately that didn't work for me.
From your comment, it seems you are having multiple targets in your project. If you are using any third party libraries or wrapper classes, don't import the project. Add only the required files and folders you want. I don't know how to make the project in release mode which having multiple targets. But making your project with one target might solve your problem. Remove the references of your third party project.xcodeproj and add the source files what are all you needed in that project. Hope it helps.
Ron is correct, you must use the Finalizer before you can create a release build. Be sure you have Xcode closed for the finalizer to work.
I have a project in Xcode 4 (the latest non-beta version) that builds fine when built in Xcode itself. Specifically, the Ld command correctly uses the derived data directory (where build products, including a dependent static library, are placed).
However, when I build the same project from the command line, the Ld command fails, as it is trying to use the /build folder within the project, which is not being populated.
I've tried adjusting every build setting I know about, both in the parent and the dependent project.
Any ideas on where to start debugging this? I can provide more info as needed.
Edit 1: Full Xcode build command:
xcodebuild -project AppName.xcodeproj -target AppName -configuration "Config Name"
Where AppName and Config Name are both the correct values for the build.
Edit 2: Link (Ld) commands.
When built in Xcode (this works):
Ld /Users/james/Library/Developer/Xcode/DerivedData/AppName-apkmkuhwuccsbpblulxcsafyxkwa/Build/Products/Debug-iphonesimulator/AppName.app/AppName normal i386
cd /Users/james/Code/ClientName-Depot/NameOfProject/trunk/AppName
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/james/Library/Developer/Xcode/DerivedData/AppName-apkmkuhwuccsbpblulxcsafyxkwa/Build/Products/Debug-iphonesimulator -L/Users/james/Code/ClientName-Depot/NameOfProject/trunk/AppName -F/Users/james/Library/Developer/Xcode/DerivedData/AppName-apkmkuhwuccsbpblulxcsafyxkwa/Build/Products/Debug-iphonesimulator -filelist /Users/james/Library/Developer/Xcode/DerivedData/AppName-apkmkuhwuccsbpblulxcsafyxkwa/Build/Intermediates/AppName.build/Debug-iphonesimulator/AppName.build/Objects-normal/i386/AppName.LinkFileList -mmacosx-version-min=10.6 -lxml2 -all_load -ObjC -licucore -Xlinker -objc_abi_version -Xlinker 2 -lMyClientLibrary -lxml2 -lsqlite3.0 -framework Security -framework MessageUI -framework QuartzCore -framework MediaPlayer -framework MapKit -framework CoreLocation -framework AudioToolbox -lz.1.2.3 -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/james/Library/Developer/Xcode/DerivedData/AppName-apkmkuhwuccsbpblulxcsafyxkwa/Build/Products/Debug-iphonesimulator/AppName.app/AppName
When built from command line using build command above (this fails):
Ld "build/AppName.build/Prod Ad Hoc-iphoneos/AppName.build/Objects-normal/armv6/AppName" normal armv6
cd /Users/james/Code/ClientName-Depot/NameOfProject/trunk/AppName
setenv IPHONEOS_DEPLOYMENT_TARGET 4.0
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin:/opt/local/bin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk "-L/Users/james/Code/ClientName-Depot/NameOfProject/trunk/AppName/build/Prod Ad Hoc-iphoneos" -L/Users/james/Code/ClientName-Depot/NameOfProject/trunk/AppName "-F/Users/james/Code/ClientName-Depot/NameOfProject/trunk/AppName/build/Prod Ad Hoc-iphoneos" -filelist "/Users/james/Code/ClientName-Depot/NameOfProject/trunk/AppName/build/AppName.build/Prod Ad Hoc-iphoneos/AppName.build/Objects-normal/armv6/AppName.LinkFileList" -dead_strip -lxml2 -all_load -ObjC -licucore -miphoneos-version-min=4.0 -lMyClientLibrary -lxml2 -lsqlite3.0 -framework Security -framework MessageUI -framework QuartzCore -framework MediaPlayer -framework MapKit -framework CoreLocation -framework AudioToolbox -lz.1.2.3 -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework UIKit -framework Foundation -framework CoreGraphics -o "/Users/james/Code/ClientName-Depot/NameOfProject/trunk/AppName/build/AppName.build/Prod Ad Hoc-iphoneos/AppName.build/Objects-normal/armv6/AppName"
Which returns:
ld: library not found for -lMyClientLibrary
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
Ok, so nearly 6 (billable) hours later, I've gotten the build to work correctly in Xcode and on the command line (and on the build server, the whole point of this exercise).
Along the way I would fix one problem just to cause another - I would apparently fix the linker/Ld problem, only to cause problems in compilation ("SomeClass undeclared (first use in this function)" or "SomeHeader.h: No such file or directory" errors were common).
It was one of those times that I adjusted nearly every setting I could find, so it's hard to say what exactly what wrong and what exactly fixed it.
Things I think might have helped are are as follows:
Converted build to use an Xcode workspace & scheme (instead of project & target)
Rearranged workspace to have the App project and static library as siblings (not as parent/child)
Changed Xcode and workspace settings to use build locations specified in targets
Change Build Products Path for App and Library to use ../build (both project files are contained in sibling subfolders of a master directory, so having them build into the same folder solved the original linker/Ld command problem, I think)
Edited the App scheme to explicitly build the Library target, and build it before the App target
In the Build Phases for the App target, explicitly add the Library under "Link Binary With Libraries"
Change the location type of the Library's .a file reference to "Relative to Build Products"
Added a "Copy Headers" build phase to the Library project, added the appropriate headers to the Public section
Changed the Public Headers Folder Path of the Library project to "/include"
Changed the Installation Directory of the Library to $(BUILT_PRODUCTS_DIR)
Changed the Library Search Paths and the User Header Search Paths of the App target to $(BUILT_PRODUCTS_DIR) (recursive)
Added a Clean command before the build on my Jenkins build server
Added explicit SDK and Arch arguments to the build command
Removed spaces from build configuration name
Final build command looks like this:
xcodebuild -workspace ClientName.xcworkspace -scheme AppName -configuration "ProdAdHoc" -sdk iphoneos -arch "armv6 armv7"
Some useful resources I used while debugging this issue:
http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/
https://devforums.apple.com/thread/91711?start=25&tstart=0
Anyway, I hope I've peppered enough keywords above that anybody who has any similar build issues in the future stumbles upon this and finds it useful. I have no clue how a workflow I did many times in Xcode 3.x got so messed up when I moved to Xcode 4, here's hoping Apple is able to clean this up in future releases.
This was a heck of a learning experience for me, and going through all of this did seem to clear up issues with autocomplete I was having beforehand. I will say things could have been much worse; I could still be developing for SharePoint.
I ran in to the same issue yesterday and was able to work it out. In an effort to narrow down what worked for James, I'll point to what I had to do. I had to add a workspace and switch to running xcodebuild with workspace/scheme instead of project/target.
Using workspace/scheme forced xcodebuild to use the DerivedData folder instead of the build output folder under the main project. This allowed the linker to find the associated static library.
This blog post was hugely helpful:
http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
I got this error when I was experimenting with my files I add the #implementation to the .h file and left the .m file empty. I don't believe this is your error but if anyone else gets it maybe check that you haven't done this.
Check if you didn't import the .m files in your header files! Changing .m to .h fixed this for me!
I don't know if this will work for you but in my case, I had more than one main.m file. All I had to do was detach one of the main.m from the target and it worked. Make sure you don't have more than one main.m in your project.
If you look at the log of the build, asking to see all messages, you should see a terse line that says "link ..." that has little in the way of details. However if you right click that line and select "expand all transcripts" you get a very detailed line telling you what command was issued from within XCode.
That should help you to debug the issue.
Dave
I had a similar exception encountered,
it turn out that i got some (null) reference in project.pbxproj
after I clean up those null reference in the project.pbxproj, the command line build was success just like the xcode previously does.
Take a look at Xcode 4 project: utility to clean up pbxproj file?
utility-to-clean-up-pbxproj-file
for more reference
All of a sudden I got the same problem after a Clean, at first I panicked wen I watched:
linker command failed with exit code 1 (use -v to see invocation)
... but it turned to be really easy to fix, no command line needed!
I clicked on my project's root (the one on the top with the blueprint icon with an "A") in the Navigator, then clicked the PROJECT section (you can click on the TARGET section as well) and then clicked the button in the bottom-middle called "Validate Settings".
XCode itself validated the project files and told me that the problem was a duplicated target definition, and offered to fix it... and voilá, the problem its gone!
Good luck!
I resolve the issue by going to "Library search path", and make sure all entries are correct.
Personally, I had this issue when I was developing a static library. I had the static library target with all the production code, and a test target that pulled in the MyStaticLib.a file as a framework.
Tests ran just fine in Xcode, but not in the terminal using xcodebuild. The problem ended up being that the static library target was compiling for Standard architectures, while the test target wanted to compile for Standard architectures (including 64-bit). Switching the test target to Standard architectures fixed everything.