tags:

views:

75

answers:

0

Hello,

I'm trying to compile a project on Mac OS X that links to Python. I have Python 2.7 framework in /Library/Frameworks. I compile for Mac OS X 4, so I also have Python 2.3 in /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks. If I invoke gcc with -F/Library/Frameworks and peek at what it does with -v, I see the following:

ignoring duplicate directory "/Library/Frameworks"
  as it is a non-system directory that duplicates a system directory
<skipped>
#include "..." search starts here:
#include <...> search starts here:
 <skipped>
 /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks (framework directory)
 /Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks (framework directory)

I.e. it ignores my /Library/Frameworks because it's a duplicate (of the last path, which is a symlink to /Library/Frameworks) and then finds its own Python 2.3 framework before my 2.7.

I understand how to work around this (e.g. use -I with a full path to the include directory), but I'm somewhat puzzled by the search order. E.g. the linker (ld) seems to search System/Library and Library in different order. I've tried to check manuals and Google, but, apparently, my skills are too low :)

I guess my questions are:

  • Is this a normal behavior and why gcc searches in this order, while ld searches differently?
  • Are there any framework-savvy methods to solve this, or I have to use the plain old -I flag?