• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Linker woes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linker woes


  • Subject: Re: Linker woes
  • From: Preston Jackson <email@hidden>
  • Date: Wed, 13 May 2009 06:15:26 -0600

Tim,

A few things to check:

1. Make sure you are using a shared build directory when you have multiple project files. It sounds like you might be, but make sure that that the build products from both projects are sitting in the same directory.

2. Make sure that the configuration names are the same in both projects. If you are building the Debug configuration in "main" Xcode will build the Debug configuration in "common"

3. Do not use the "Add Existing Frameworks..." to add any of the libraries you create to your project. That command is for third party (i.e. don't change often) libraries, exclusively. Use the references in the "Products" group to drag to your "Link Binary with Libraries" build phase. If you are including libraries from the "common" project use the libraries that are revealed under the "common" xcode project. If you use these two locations, Xcode will link against the appropriate configuration for you. If you use the "Add Existing Frameworks..." it will use the absolute path you browsed to when completing that command.

4. I wouldn't mess around with the CONFIGURATION_BUILD_DIR.

Hope that helps,
Preston Jackson
http://sidelightblog.blogspot.com



On May 12, 2009, at 2:41 PM, Tim Murison wrote:

Hi,

I'm trying to resolve a problem I'm having with XCode during the link phase
of one of my libs. The circumstances are rather complicated, so I'll try to
explain as best as I can.


My project outputs all dylibs to a folder "build/Debug/Libraries". I have 2
xcode projects, main and common.


common creates a bunch of dylibs used in main.
main also creates a bunch of dylibs.

Here's the problem. Within main I have a dylib, "mylib", and some unit tests
for it, "myLibTests". "myLibTests" must link against "mylib". Furthermore,
"myLibTests" is output in "build/Debug/Tests". When compiling "myLibTests",
XCode generates a gcc command that uses the absolute path to "mylib.dylib".
The problem is the absolute path is wrong.


"mylib.dylib" exists in "build/Debug/Libraries" whereas "myLibTests" exists
in "build/Debug/Tests". The path XCode generates to "mylib.dylib" is
"build/Debug/Tests/mylib.dylib" instead of
"build/Debug/Libraries/mylib.dylib". To make matters worse, "myLibTests"
also links against libraries from the common project, these all have the
correct path.


I'm using a common xcconfig across both projects, so I know all the build
settings are the same for the libraries in main as the ones in common. I
have set CONFIGURATION_BUILD_DIR to "build/Debug/Libraries" in the xcconfig,
and it shows up correctly when inspecting the target properties for all my
dylibs.


Does anyone know what I'm doing wrong, or how to tell XCode to use relative
paths in the linker command so I can configure the correct behaviour myself?


Cheers,

-Tim

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Linker woes
      • From: Tim Murison <email@hidden>
References: 
 >Linker woes (From: Tim Murison <email@hidden>)

  • Prev by Date: Xcode, Dashcode and Javascript frameworks
  • Next by Date: Re: Linker woes
  • Previous by thread: Linker woes
  • Next by thread: Re: Linker woes
  • Index(es):
    • Date
    • Thread