gcc-4.2 failed with exit status 1
Asked Answered
R

8

22

I've been looking for an answer to this issue but I couldn't find it, so here it is.

I'm trying to install Uniconvertor with a setup.py file into a MacOS X Lion (Python 2.7.2) using:

python setup.py install

Then I get the following error code:

running install
running build
running build_py
running build_ext
building 'uniconvertor.app.modules.streamfilter' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -g -O2 -DNDEBUG -g -O3 -arch i386 -arch x86_64 -DMAJOR_VERSION=1 -DMINOR_VERSION=1 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/modules/filter/streamfilter.c -o build/temp.macosx-10.6-intel-2.7/src/modules/filter/streamfilter.o
unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1

I looked for the 'gcc-4.2' file in the Developer/usr/bin folder and it wasn't there, but there's a 'llvm-gcc.4.2' file that makes me think I should change the compiler from 'gcc-4.2' to the 'llvm-gcc.4.2' one.

I'm kind of new to Mac and I don't know how else to fix it.

Thanks.

Edit:

I tried using:

cd /Developer/usr/bin
ln -s llvm-gcc-4.2 gcc-4.2

And I get a little more progress, but then a new error:

running install_lib
creating /Library/Python/2.7/site-packages/uniconvertor
error: could not create '/Library/Python/2.7/site-packages/uniconvertor': Permission denied

What could be the cause of this 'Permission denied'?

I'm running it into an Admin account and it doesn't ask for a password or anything.

Thank you again.

Resistive answered 12/12, 2011 at 10:43 Comment(2)
As of Xcode 4.2, Xcode no longer includes gcc-4.2. Usually, llvm-gcc-4.2 or clang is a suitable substitute, but you might want to get in touch with the project's maintainers to ask why the build system explicitly requests gcc-4.2 instead of using the default system compiler.Porphyroid
See answer to this question: #10238958 Hope it helps!Pelvis
C
28

Try the following:

  1. Install the latest Xcode.
  2. From Xcode's Preferences menu, install the Command Line Tools (Downloads/Components tab).
Clarineclarinet answered 25/7, 2012 at 17:21 Comment(2)
This worked for me after upgrading to Lion and trying to install django-sentry. eventlet would not install dude to the error in the original question.Narial
xcode-select --install does the same, as mentioned in Brideau's answer aboveHusk
S
8

I was able to resolve this by downloading one of these: https://github.com/kennethreitz/osx-gcc-installer/releases

Spatola answered 8/1, 2012 at 19:3 Comment(1)
Note that in newer versions of OS X, this is no longer the correct solution. As mentioned on the GitHub page, you should now just open a terminal and type xcode-select --installNobelium
N
5

For newer versions of OS X (including macOS), you just need to open up a terminal and type:

xcode-select --install
Nobelium answered 19/1, 2017 at 20:23 Comment(0)
C
3

Try sudo python setup.py install.

Command line utilities will not ask you to escalate privileges and so must be run in sudo mode when the situation requires it (e.g., library installation into a global location).

Chandachandal answered 13/12, 2011 at 15:7 Comment(0)
A
2

I tried @plusjeff answer, but Xcode 4.6 does not create a /Developer folder in the main directory anymore.

Therefore I sorted it out with a symlink:

sudo ln -s /Applications/Xcode.app/Contents/Developer /Developer

and it worked!

I have OSX 10.7.5 installed

Hope this helps!

Andrew answered 14/3, 2013 at 21:6 Comment(0)
E
2

I ran across this issue when installing a python library with pip.

After running xcode-select --install, I was still getting the issue.

So I created a symlink from "gcc" to "gcc-4.2" and that worked for me.

ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/gcc /usr/local/bin/gcc-4.2

pip install --upgrade pip did not help fix the issue for me.

The answer by DanFreak didn't help me either, but it did give me the idea for what actually did work for me.

Epithet answered 1/6, 2017 at 0:19 Comment(0)
P
0

I got this error due to running an outdated version of pip. I ran pip install --upgrade pip and the error went away. Something to consider if you already have xcode command line tools installed and are still getting the error.

Perihelion answered 27/4, 2017 at 2:51 Comment(0)
F
0

You will need the Xcode installed.

Go to Xcode -> Preferences -> Locations and choose the Command Line Tools.

Fructify answered 25/4, 2018 at 3:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.