Trouble compiling python bindings on OS X

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble compiling python bindings on OS X

Michael Lerner
Hi,


I downloaded the source for openbabel-2.2.3. From the main directory, I did the ./configure; make; sudo make install dance. It looks like it worked (I just tried converting a few PDB files to SDF). When I go into the scripts/python directory, here's what happens:

[lerner@mglerner ~/src/openbabel/openbabel-2.2.3/scripts/python]$ python setup.py build
WARNING: Environment variable OPENBABEL_INSTALL is not set
INFO: Looking for library and include files in ../../src and ../../include
running build
running build_py
copying pybel.py -> build/lib.macosx-10.5-i386-2.6
running build_ext
building '_openbabel' extension
gcc -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -I/Library/Frameworks/Python.framework/Versions/6.2/include -I/usr/local/include -I../../include -I/Library/Frameworks/Python.framework/Versions/6.2/include/python2.6 -c openbabel_python.cpp -o build/temp.macosx-10.5-i386-2.6/openbabel_python.o
cc1plus: error: unrecognized command line option "-arch"
error: command 'gcc' failed with exit status 1

In case they're relevant:

[lerner@mglerner ~/src/openbabel/openbabel-2.2.3/scripts/python]$ which gcc
/usr/local/bin/gcc
[lerner@mglerner ~/src/openbabel/openbabel-2.2.3/scripts/python]$ gcc --version
gcc (GCC) 4.4.1 20090623 (prerelease)
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


I searched the mailing list, and I don't think this has come up before. My apologies if it's a repeat. Can someone point me in the right direction?

Thanks,

-Michael

--
Michael Lerner, Ph.D.
IRTA Postdoctoral Fellow
Laboratory of Computational Biology NIH/NHLBI
5635 Fishers Lane, Room T909, MSC 9314
Rockville, MD 20852 (UPS/FedEx/Reality)
Bethesda MD 20892-9314 (USPS)

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Trouble compiling python bindings on OS X

Geoffrey Hutchison

On Sep 9, 2010, at 1:53 PM, Michael Lerner wrote:

> gcc -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -I/Library/Frameworks/Python.framework/Versions/6.2/include -I/usr/local/include -I../../include -I/Library/Frameworks/Python.framework/Versions/6.2/include/python2.6 -c openbabel_python.cpp -o build/temp.macosx-10.5-i386-2.6/openbabel_python.o
> cc1plus: error: unrecognized command line option "-arch"
> error: command 'gcc' failed with exit status 1

You're not using Apple's compiler. It seems like you installed a new version of GCC, which is fine. But Python on Mac is compiled by Apple to be a Universal binary (i.e., i368, ppc, x86_64 all rolled into one). The standard GNU GCC doesn't know how to do this.

So you want to be sure you're finding /usr/bin/gcc and /usr/bin/g++ instead of /usr/local/bin/gcc / g++.

Hope that helps,
-Geoff
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss