Search code examples
xcode4osx-lionpython-2.7pipreadline

pip install readline on Mac OS X (10.7.3) fails


When building the c extensions of readline when installing readline via pip install readline, I get an error message as follows:-

Beginning configuration for readline-6.2 for i386-apple-darwin11.3.0



checking whether make sets $(MAKE)... yes

checking for gcc... gcc

checking for C compiler default output file name...

configure: error: in `/Users/calvin/.virtualenvs/myproj/build/readline/rl/readline-lib':

configure: error: C compiler cannot create executables

See `config.log' for more details.





============ Building the readline library ============





============ Building the readline extension module ============



running install

running build

running build_ext

building 'readline' extension

Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.7.sdk

Searching for the location of MacOSX10.7.sdk on my system reveals:-

calvin$ sudo find / -name "MacOSX10.7.sdk"
Password:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory

Which is not where the readline compilation is expecting.

Is there a bug with how pip locates the MacOSX10.7.sdk?

How do I resolve this without resorting to copying MacOSX10.7 into the /Developer/SDKs directory?

CLARIFICATION

This is how I temporarily solve my problem.

calvin$ sudo mkdir -p /Developer/SDKs/
Password:

calvin$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk /Developer/SDKs/MacOSX10.7.sdk

calvin$ pip install readline

But I am not too sure this is the "appropriate" way to solve it as there might be some inherent problems either from how pip is supposed to locate my .sdk location or I am missing something in my system PATH. So any advice on how to resolve this the "appropriate" way would be much appreciated!


Solution

  • That's a good question. As a point of note, I do have a MacOSX10.7.sdk folder in /Developer/SDKs, so perhaps it's your filesystem's state that's wrong.

    The safest approach is probably to install XCode, but that's horribly expensive in terms of time. I would start by creating a soft link:

    sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk /Developer/SDKs/MacOSX10.7.sdk

    and see if that does the trick.