gcc error in Mac OS X

Mathieu Prevot mathieu.prevot at ens.fr
Fri Jun 6 01:07:03 CEST 2008

2008/6/6 Mathieu Prevot <mathieu.prevot at ens.fr>:
> 2008/6/5 Zhaojie Boulder <gongchangzhaojie at gmail.com>:
>> Hello,
>> I am new to Mac and used python in linux before. What I am trying to do is
>> to install "Ipython" and "PyCogent" in Mac OS X.
>> For PyCogent, after entering the package path, I typed "python setup.py
>> install". The results are as follows:
>> Didn't find Pyrex - will compile from .c files
>> running install
>> running build
>> running build_py
>> running build_ext
>> building 'cogent.align._compare' extension
>> gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd
>> -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX
>> -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe
>> -I/Users/zhaojie/Downloads/PyCogent-1.0.1/include
>> -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5
>> -c cogent/align/_compare.c -o
>> build/temp.macosx-10.5-i386-2.5/cogent/align/_compare.o -w
>> unable to execute gcc: No such file or directory
>> error: command 'gcc' failed with exit status 1
>> After google, I installed Xcode,but it did not help. Also, the Xcode folder
>> is not within "applications" folder, but a separate one parallel with
>> "applications". Dragging Xcode folder into the applications folder did not
>> make a difference, either.
>> Hope someone familiar with Mac can help me out.
> Normally gcc is installed in /usr/bin. If you type "which gcc", it
> should return "/usr/bin/gcc". Xcode is an IDE that use gcc or another
> compiler eg. icc the Intel compiler, hence if you move Xcode in the
> application folfer it won't change anything. You install Xcode by
> double clicking on a .pkg file from your Leopard DVD.
> You also can download gcc from the site and bootstrap/compile it.

Note that you don't need to install Xcode in the "right place", it is
normally installed in /Developer, and installs gcc and other files in
/usr/bin /usr/share etc.

In general, try "locate prog" to try to find where is prog, and check
if the binary prog's path is in your PATH. eg. you can compile and
install a gnu tool by ./configure --prefix=$HOME && make && make
install, and the binaries will be installed in ~/bin/. If you don't
have ~/bin/ in your PATH, it won't execute. Adding 'export
PATH="$PATH:$HOME/bin:"' in your .bashrc will solve the problem (or
'setenv PATH "$PATH:$HOME/bin:' in your .tcshrc)

Using --prefix=$HOME allow you to run and install your binaries and
libraries. You can do this for a group of users without root access,
so you can share, or preserve your OS bin/lib/include/share easily, or
allow alternative use of several versions of libraries/binaries etc.

Other possibilities are the chroot and the sophisticated FreeBSD
jails. Google for them to know more.

Hope that helps,

More information about the Python-list mailing list