Xcode incorrectly searches for libraries

Originator:robnapier
Number:rdar://10993287 Date Originated:3/6/2012
Status:Open Resolved:
Product:Xcode Product Version:4.3
Classification: Reproducible:
 
06-Mar-2012 11:35 AM Rob Napier:
Summary:

Adding an explicit file path to the "Link Binary With Libraries" step throws away the path given and uses the library search algorithm to find the library. This can lead to very surprising mis-links

Steps to Reproduce:

* In "Link Binary With Libraries," drag a library into the build phase (or use "Add Other"). For example projdir/lib/libfoo.a.
* Build
* Note link line:
   ... clang ... -L/full/path/to/projdir/lib ... -lfoo ...

Expected Results:

   ... clang ... relative/path/to/projdir/lib/foo.a ...

Actual Results:

Regression:

No

Notes:

Linking this way breaks several things:

* If you link a static library that matches the name of a dynamic library anywhere in the system, then you'll link against the dynamic library.

* If you link a library that matches the name of a library earlier in the search path, then you'll link against the wrong library.

* If you remove a link library, Xcode doesn't remove the -L parameter

* The paths are generally absolute, which makes it difficult to share or move the project.

In all cases, looking at the Xcode settings is extremely misleading because it does not match what is actually linked.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!