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.
Related
I'm trying to setup cocoapods with a project in order to use the STPrivilegedTask class and have been running into the following error:
Ld ProductBuilder.app/Contents/MacOS/ProductBuilder normal x86_64
cd /Users/zach/Dev/Code/ProductBuilder
export MACOSX_DEPLOYMENT_TARGET=10.7
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -L/Users/zach/Dev/Code/ProductBuilder -F/Users/zach/Dev/Code/ProductBuilder -filelist /Users/zach/Dev/Code/ProductBuilder/Build/Intermediates/ProductBuilder.build/Debug/ProductBuilder.build/Objects-normal/x86_64/ProductBuilder.LinkFileList -mmacosx-version-min=10.7 -ObjC -lSTPrivilegedTask -framework Security -fobjc-arc -fobjc-link-runtime -framework QuartzCore -framework OpenGL -framework Cocoa -lPods -Xlinker -dependency_info -Xlinker /Users/zach/Dev/Code/ProductBuilder/Build/Intermediates/ProductBuilder.build/Debug/ProductBuilder.build/Objects-normal/x86_64/ProductBuilder_dependency_info.dat -o /Users/zach/Dev/Code/ProductBuilder/ProductBuilder.app/Contents/MacOS/ProductBuilder
ld: library not found for -lSTPrivilegedTask
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am able to use the STPrivilegedTask class in my code without any issues, it's just that I do not build - even without adding any STPrivilegedTask code, the app does not build.
Some other notes:
I am opening the project using the xcworkspace file.
STPrivilegedTask does show up in the Pods section in Xcode, and has it's source code there, so that seems OK. As I said, I can also reference this class in code, so I think it's grabbing the class correctly.
The app I am adding cocoapods to is relatively old, but has not used cocoapods before, so this is a fresh install.
I am using cocoapods version 0.39.0
Please let me know if you have any ideas!
Thank you,
Zach
This was fixed by changing my Per-configuration Build Products Path setting to:
$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME).
I tested the STPrivilegedTask pod in a new project without any issues, so I figured it must be something with my project setup. The project is somewhat of a legacy app, and has gone through some odd phases/cycles, so I can't explain why the Build Products Path was set to anything but that (the expected/normal value I think...)
Anyways, it builds OK now - hopefully this helps someone else!
I've got the following error when building the project in Xcode:
ld: file not found
/Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos/Social_Events.app/Social_Events
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm stuck with this error for the past hour.. Any solutions?
Code worked fine in iOS 7 and xCode 5.0. Now for iOS8 it gives me this error.
Using frameworks:
CoreTelephony
Mapkit
Facebook.SDK v3.20
Foundation
CoreGraphics
UIKit Framework
FULL ERROR:
<pre>
Ld /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Intermediates/Social_Events.build/Debug-iphoneos/Social_EventsTests.build/Objects-normal/arm64/Social_EventsTests normal arm64
cd /Users/MacBookPro/Desktop/Social_Events/Social_Events/Social_Events
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export 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"
</pre>
>/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -L/Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos -F/Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/Developer/Library/Frameworks -filelist /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Intermediates/Social_Events.build/Debug-iphoneos/Social_EventsTests.build/Objects-normal/arm64/Social_EventsTests.LinkFileList -dead_strip -bundle_loader /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos/Social_Events.app/Social_Events -framework XCTest -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.1 -framework XCTest -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Intermediates/Social_Events.build/Debug-iphoneos/Social_EventsTests.build/Objects-normal/arm64/Social_EventsTests_dependency_info.dat -o /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Intermediates/Social_Events.build/Debug-iphoneos/Social_EventsTests.build/Objects-normal/arm64/Social_EventsTests
>ld: file not found: /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos/Social_Events.app/Social_Events
clang: error: linker command failed with exit code 1 (use -v to see invocation)
>(null): File not found: /Users/MacBookPro/Library/Developer/Xcode/DerivedData/Social_Events-cfnteabiivwfdzcoulzznhmgobhy/Build/Products/Debug-iphoneos/Social_Events.app/Social_Events
You might be getting this error because you renamed your project and Tests cannot be found anymore. This is easy to fix:
Solve it in Xcode like this:
Select your project from the project navigator.
Select [Your project's Tests] under targets
Under General tab change the Host Application from the drop down
Build and run.
This problem happened to me because I renamed my project and the tests could't find it anymore.
The problem is that after renaming the product its Tests target is still looking for the previous app name.
Select your Tests target and then in Build Settings modify the TestHost values to correspond your new product name in the following way:
$(BUILT_PRODUCTS_DIR)/YourNewProductName.app/YourNewProductName
I had a similar problem -- it's because I was using Cocoapods and had opened the .xcodeproj file instead of the .xcworkspace file... doh!
I have solved it by renaming the product.
In the Application's target choose Build Settings.
Under the Packaging options, you have to rename your product to the name thats shown in the error.
It solved my problem and the code started compiling. My test cases are also executing.
Did you try cleaning up your derived data?
Xcode5->Organizer->Projects->Select your project->Delete the derived data.
Try to remove "Social_EventsTests" target.
Goto Build settings of your tests named PuzzleGameTests.
Go to Testing settings, write $(BUILT_PRODUCTS_DIR)/PuzzleGame.app/PuzzleGame
Clean and build
Note: PuzzleGame is new name of my project(product name).
RandomNumber is old name of my project(product name).
I had issue with "framework not found". It was after renaming my project.
Go to Project settings, select the target (not the project). In the General tab, find "Linked frameworks and libraries", and delete the old name.
I encountered similar problem while adding FBSDKCoreKit.framework and solution was :
If frameworks already added then remove it with option remove all references.
Drag & drop frameworks straight in the group you want it to put in project.
do not re-drag or change its location afterwords
Note: When we drag & drop frameworks in xcode it automatically set framework search path under <yourproject> -> Targets -> <yourproject> -> Search Paths -> Framework Search Paths .
once we relocate the frameworks, the Framework Search Paths becomes empty and it results in linker error , framework not found.
Had similar kind of problem when I added unit test target to my existing project. Got all sorts of error. Had to run through some loops to get it finally running. Listing them below
Make sure your entry under Header search path for test target matches that for Header Search Path in your main project folder
If you are using pods you might run in some error such 'No Module found Firebase'. For this simply add the following lines of code to your pod file and run pod install
target 'YourProjectNameTests' do
inherit! :search_paths
# Pods for testing
end
If you also get Bridging header file not found error like I did make sure you add the same for your test target in Build settings under Swift compile code general
Also you will have to follow the steps mentioned by #Jose Llausas
I had similar kind of problem when I added a framework to my project.
I have resolved the issue by removing the framework and again adding the framework to the project by dragging and dropping the framework file to the projects frameworks folder and selecting the Copy items if needed option.
I've been creating some app for some months, and suddently Xcode 5 doesn't want to build it. It just complains with the following error.
Ld build/Debug-iphonesimulator/appname.app/appname normal i386
cd /Users/myname/proyectos/appname/dev/iOS/appname
setenv IPHONEOS_DEPLOYMENT_TARGET 5.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/iPhoneSimulator7.0.sdk -L/Users/myname/proyectos/appname/dev/iOS/appname/build/Debug-iphonesimulator -L\"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/FlurryAnalytics\" -L\"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/SmartADServer\" -L\"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/TestFlight\" -F/Users/myname/proyectos/appname/dev/iOS/appname/build/Debug-iphonesimulator -F/Users/myname/proyectos/appname/dev/iOS/appname/appname/External -filelist /Users/myname/proyectos/appname/dev/iOS/appname/build/appname.build/Debug-iphonesimulator/Appname.build/Objects-normal/i386/appname.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5.1 -weak_framework AdSupport -framework Security -framework MessageUI -framework Twitter -framework CoreLocation -weak_framework CoreMotion -framework AudioToolbox -framework AVFoundation -framework MediaPlayer -framework SystemConfiguration -framework MobileCoreServices -lz -framework CFNetwork -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -lTestFlight -framework comScore -lFlurry -Xlinker -dependency_info -Xlinker /Users/myname/proyectos/appname/dev/iOS/appname/build/appname.build/Debug-iphonesimulator/Appname.build/Objects-normal/i386/appname_dependency_info.dat -o /Users/myname/proyectos/appname/dev/iOS/appname/build/Debug-iphonesimulator/appname.app/appname
ld: warning: directory not found for option '-L"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/FlurryAnalytics"'
ld: warning: directory not found for option '-L"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/SmartADServer"'
ld: warning: directory not found for option '-L"/Users/myname/proyectos/appname/dev/iOS/appname/appname/External/TestFlight"'
ld: library not found for -lTestFlight
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I understand it ok, it complains about testflight, but I haven't changed anything about it in weeks. It compiled it perfectly.
I have to say I've tried adding Adobe ADMS tracking library onto the project (but then undoing its addition). And then after that, linker errors appear.
Any hint? I'm COMPLETELY at lost and frustrated. Are my project files corrupt maybe? (Let's hope not!!) Any hope to recover them in such case?
Greetings
"Problem solved".
Apparently it seemed (as ahwulf said, and I suspected) that my Project paths/libraries/headers where somehow corrupt inside Xcode 5.
What was my solution? After more additional tests, I just physically removed some of my apparently conflicting libraries (testflight, flurry, etc...) from the project (and ALSO from disk) and started compiling, waiting for the obvious compilation errors that would appear.
When they appeared, I just re-added the files XCode asked me to add (one file/library at a time), and then one by one, all these errors started to slowly disappear.
My original linking error ALSO disappeared, so my project builds again.
I have the feeling I don't really know what I did, but "it worked".
Something that worked for me in this situation was to remove 'libTestFlight.a' from my Link Binary With Libraries section in the Build Phases and clean my project then redrag it into this section from my File tree. (Of course if you want to use Testflight in your app make sure that you also have libz.dylib as a framework and the associated TestFlight files are also included in your project such as TestFlight.h, TeshFlight+AsyncLogging.h and TestFlight+ManualSession.h - if libz.dylib gets deleted and then readded it can cause this error). Good luck code warriors!
XCode 5 appears to have a bug where it spontaneously adds an extra absolute path in build settings. Bitten me a couple of times already.
I had the identical error for a very different reason.
Having upgraded from TestFlight 1.2.4 to TestFlight 2.0.2, the build worked on my own machine, but a nightly build on a different machine failed.
The simple reason that the library wasn't found was that it hadn't been committed. Our .gitignore is set to ignore .a files, so libTestFlight.a had not been included. Opening the project in Xcode made this more obvious than the command line build log.
git add -f sorted this out.
I've faced the exact same problem with adding TestFlight 2.0.2. And it was also conflicting with Flurry (and some others). Removing (reference!) and re-adding all conflicting libraries with TestFlight being last helped me. But firstly don't forget to delete Library Search Paths.
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.