Search code examples
cxcode4osx-lionpython-2.6

checking whether the C compiler works... no when installing python 2.6 (mac os x lion)


I'm trying to install python 2.6 using pyenv but when doing pyenv install 2.6.9I get the following:

checking MACHDEP... darwin
checking EXTRAPLATDIR... $(PLATMACDIRS)
checking machine type as reported by uname -m... x86_64
checking for --without-gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/var/folders/r9/771hsm9931sd81ppz31384p80000gn/T/python-build.20150213191018.2121/Python-2.6.9':
configure: error: C compiler cannot create executables

I've installed Xcode 4.6.3 and installed Command Line Tools as info.

Cheers,

Ch


Solution

  • Actually I found the problem. The problem was with the ld: library not found for -lgcc_ext.10.5 The gcc version given by Xcode 4.6.3 on Mac OS X Lion is 4.6.

    1. I installed the new gcc via homebrew, brew install gcc.
    2. I symlink my gcc to gcc-4.9 by doing ln -s /usr/local/bin/gcc /usr/local/bin/gcc-4.9.
    3. make sure the that in your PATH /usr/local/bin is before /usr/bin ).
    4. To a ls -l 'which gcc' to check that gcc is associated to the 4.9 version. Once this is done, the library is found and python 2.6 can be installed using pyenv.