Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6125529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:15:31+00:00 2026-05-23T16:15:31+00:00

I have a project in Xcode 4 (the latest non-beta version) that builds fine

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:15:32+00:00Added an answer on May 23, 2026 at 4:15 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Xcode project that uses git for version control. I have a
I have a 3.1 xcode project that has been running my app just fine
I have a project that I would like to start beta testing soon, it
I have just discovered that after upgrading to the latest Xcode 3.2.2, I am
With the latest version of Xcode from Apple, I have the following problem. Upon
I have a project in xcode under svn source control. It happens that the
I have an Xcode project (for an iPhone application) that uses cocos2d. I have
I have a project in Xcode that I need to use the AWS SDK
I have an Xcode project with the following group structure: ProjectName/ Classes/ class1.h class1.m
I have an Xcode project with several static library dependancies set up in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.