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

回眸只為那壹抹淺笑 提交于 2019-11-30 00:51:32

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.

Use the following command to make make (or similiar) use the correct gcc:

export CC=/usr/bin/gcc

I ran into this. For me it was because I installed python from a DMG installer at http://python.org . Those are built against the wrong gcc. I fixed it by compiling python from source using Homebrew: http://mxcl.github.com/homebrew/

brew install python

That links against the correct gcc

(In my specific case I was using an older Python which is why I had used a DMG installer. I discovered that homebrew also has formulas for older versions)

I detoured this problem by using ActivePython.

There's specific installation instruction for MySQLdb here.

Since this is the first time I've used ActivePython I'm not sure if this' a robust solution for this problem. Therefore, I will leave this question open until I make sure this works.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!