ios - Xcode 4 build succeeds, command line build fails? -
ios - Xcode 4 build succeeds, command line build fails? -
i have project in xcode 4 (the latest non-beta version) builds fine when built in xcode itself. specifically, ld command correctly uses derived info directory (where build products, including dependent static library, placed).
however, when build same project command line, ld command fails, trying utilize /build folder within project, not beingness populated.
i've tried adjusting every build setting know about, both in parent , dependent project.
any ideas on start debugging this? can provide more info needed.
edit 1: total xcode build command:
xcodebuild -project appname.xcodeproj -target appname -configuration "config name"
where appname
, config name
both right values 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 command line using build command above (this fails):
ld "build/appname.build/prod advertisement 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 advertisement hoc-iphoneos" -l/users/james/code/clientname-depot/nameofproject/trunk/appname "-f/users/james/code/clientname-depot/nameofproject/trunk/appname/build/prod advertisement hoc-iphoneos" -filelist "/users/james/code/clientname-depot/nameofproject/trunk/appname/build/appname.build/prod advertisement 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 advertisement hoc-iphoneos/appname.build/objects-normal/armv6/appname"
which returns:
ld: library not found -lmyclientlibrary collect2: ld returned 1 exit status command /developer/platforms/iphoneos.platform/developer/usr/bin/gcc-4.2 failed exit code 1
ok, 6 (billable) hours later, i've gotten build work correctly in xcode , on command line (and on build server, whole point of exercise).
along way prepare 1 problem cause - apparently prepare linker/ld problem, cause problems in compilation ("someclass undeclared (first utilize in function)" or "someheader.h: no such file or directory" errors common).
it 1 of times adjusted every setting find, it's hard wrong , fixed it.
things think might have helped are follows:
converted build utilize xcode workspace & scheme (instead of project & target) rearranged workspace have app project , static library siblings (not parent/child) changed xcode , workspace settings utilize build locations specified in targets change build products path app , library utilize ../build (both project files contained in sibling subfolders of master directory, having them build same folder solved original linker/ld command problem, think) edited app scheme explicitly build library target, , build before app target in build phases app target, explicitly add together library under "link binary libraries" change location type of library's .a file reference "relative build products" added "copy headers" build phase library project, added appropriate headers public section changed public headers folder path of library project "/include" changed installation directory of library$(built_products_dir)
changed library search paths , user header search paths of app target $(built_products_dir)
(recursive) added clean command before build on jenkins build server added explicit sdk , arch arguments build command removed spaces build configuration name final build command looks this:
xcodebuild -workspace clientname.xcworkspace -scheme appname -configuration "prodadhoc" -sdk iphoneos -arch "armv6 armv7"
some useful resources used while debugging 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=0anyway, hope i've peppered plenty keywords above has similar build issues in future stumbles upon , finds useful. have no clue how workflow did many times in xcode 3.x got messed when moved xcode 4, here's hoping apple able clean in future releases.
this heck of learning experience me, , going through of did seem clear issues autocomplete having beforehand. things have been much worse; still developing sharepoint.
ios xcode xcode4 xcodebuild
Comments
Post a Comment