Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat's the correct way to configure XCode 4 workspaces to build dependencies when needed?
    primarykey
    data
    text
    <p>My case is simple, a workspace with two sibling projects: one main (iOS) app and a project that builds several static library targets used by the app.</p> <p>Here's how I have configured the build:</p> <ul> <li>pointed a 'user header search path' in the main app's build settings to the library project location (via a source tree)</li> <li>in my app's main target's editor -> build phases -> "Link Binary With Libraries" section, added the library products I want to use.</li> <li>in the scheme, ticked 'Find Implicit Dependencies'</li> </ul> <p>After a clean (and deletion of the derived data), a build nets me this error during the build of the main project:</p> <pre><code>ld: library not found for -lChipmunk clang: error: linker command failed with exit code 1 (use -v to see invocation) Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1 </code></pre> <p>Sure enough, if I look in the newly-created derived data, the only object files to be found are for the main app, not the libraries. A widespread 'find' for *.o files doesn't reveal anything relevant, so the libraries aren't getting lost, they're definitely not being built.</p> <p>Some supplementary points: </p> <ul> <li>when I've asked about this on the Apple dev forums, it's been suggested that I should add explicit deps in the main target's Build Phases->Target Dependencies editor. But you can only add deps here to targets in the <em>same</em> project or subprojects; in my case I have the app and library projects as workplace siblings.</li> <li>if I build each library manually before the main build, all is fine.</li> </ul> <h3>Update:</h3> <p>I've just figured out a workaround, which is to add all the deps' targets into the 'build' part of the main app's scheme. I had tried this before without success, but hadn't realised that I could drag the targets around in the list to get the right build order. Builds now happen in the correct order, both after a clean, and after changes in either library or main app source.</p> <p>I'm leaving the question here, because manually sorting out a build order surely shouldn't be necessary. There has to be something wrong with how I have things set up.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload