Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCC-4.2 error on Mac OSX Mountain Lion, unable to install mysql-python

I'm having trouble building MySQLdb on Mac OSX Mountain Lion. After upgrading to OSX Mountain Lion from OSX Lion, I have downloaded and installed Xcode 4.4 also. Then, I went to Preference > Downloads of the Xcode and installed Command Line Tools.

I've downloaded MySQL-python ver. 1.2.3 from http://sourceforge.net/projects/mysql-python/

When I run

python setup.py build

I get below message:

running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.6-intel-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.6-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64
unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1

However, the gcc exists. When I run

gcc

I get

i686-apple-darwin11-llvm-gcc-4.2: no input files

Below is a similar question that I have found but its solution, which is exactly what I have done already, doesn't work for me.

How to install MySQLdb on Mountain Lion

like image 387
taelimoh Avatar asked Aug 06 '12 18:08

taelimoh


1 Answers

I've had a similar problem while working with Ruby On Rails 3.2.7. I too had upgraded the system to Mountain Lion, installed Xcode 4.4.1 and downloaded the Command Line Tools.

On the command line I got an error message saying it was impossible to find the file: /usr/bin/gcc-4.2 (I can't paste the precise output right now, I'm sorry).

I did have a /usr/bin/gcc and its version was i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1

I solved the problem by symlinking the file in the same directory and giving it the name the Ruby script was looking for:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

After that, everything worked fine.

like image 179
tompave Avatar answered Sep 18 '22 05:09

tompave