Failed to build PIL on Mac OS X 10.7 Lion - python

I am tying to build PIL 1.1.7 on Mac OS X 10.7, I am getting this error:
running build
running build_py
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/opt/local/include -I/Library/Frameworks/Python.framework/Versions/2.6/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.3-fat-2.6/_imaging.o
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
I have the latest Xcode installed. gcc-4.0 does not exist but gcc-4.2 does. I don't know why it's trying to use gcc-4.0.

You appear to be using a 32-bit-only Python possibly one downloaded from python.org. They are built with gcc-4.0 and for the i386 and ppc archs for compatibility with multiple OS X versions. When building a C extension module, Python's Distutils will attempt to use the same compiler version and options that Python itself was build with. Because gcc-4.0 and support for the ppc architecture are no longer included with Xcode 4 and OS X 10.7, you should not use the 32-bit-only builds on 10.7 if you need to build extension modules. Either install a 64-bit/32-bit version of Python (2.7.2 and 3.2.2 are current from python.org) or use the Apple-supplied system Pythons in 10.7 (/usr/bin/python which defaults to 2.7.1).

Related

Can't install lxml on OS X 10.8.5

I'm trying to do a malware analysis by using cuckoo sandbox and a VM Machine (WinXP) running on VirtualBox. But however, I can't get cuckoo to run because I haven't installed cybox and maec correctly.
Thus leads me to this problem where I can't get myself to install lxml.
It just won't let me install either by using pip or manual installation with the setup.py file.
Here is what I got:
Building lxml version 3.4.1.
Building without Cython.
Using build configuration of libxslt 1.1.26
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
running install
running bdist_egg
running egg_info
writing requirements to src/lxml.egg-info/requires.txt
writing src/lxml.egg-info/PKG-INFO
writing top-level names to src/lxml.egg-info/top_level.txt
writing dependency_links to src/lxml.egg-info/dependency_links.txt
reading manifest file 'src/lxml.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'src/lxml.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.8-intel/egg
running install_lib
running build_py
copying src/lxml/includes/lxml-version.h -> build/lib.macosx-10.8-intel-2.7/lxml/includes
running build_ext
building 'lxml.etree' extension
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/usr/include/libxml2 -I/Users/ajprameswari/Downloads/lxml-3.4.1/src/lxml/includes -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.8-intel-2.7/src/lxml/lxml.etree.o -w -flat_namespace
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'clang' failed with exit status 1
I tried both lxml-3.4.0 and lxml-3.4.1 version but they gave the same result.
I'm using Python 2.7 and OS X 10.8.5. Is there anything that could be pointed to help me solve this issue? I'm a newbie in using OS X, I used to work on my Ubuntu, but due to lack spec of my Ubuntu machine I need to work here.
The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building Python native extensions, where some invalid compiler options are specified.
It seems that the newer version of the llvm compiler shipping is a little more restrictive when it comes to warnings.
Fix:
There is a temporary solution to tell the compiler not to raise this error by setting the following environment variables :
sudo -E export CFLAGS=-Qunused-arguments
sudo -E export CPPFLAGS=-Qunused-arguments

Error installing basemap on mac

I followed these steps to install the GEOS libraries (source ). I successfully installed the GEOS library. My problem is in the following step:
cd back to the top level basemap directory (basemap-X.Y.Z) and
run the usual 'python setup.py install'. Check your installation
by running "from mpl_toolkits.basemap import Basemap" at the python
prompt.
When I run the setup.py file I get the following error:
distutils.errors.CompileError: Command "gcc-4.2 -fno-strict-aliasing -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Isrc -c nad2bin.c -o nad2bin.o" failed with exit status 127
Im working with a Mac with OS version 10.9.2.
I have installed the gcc compiler through the command line tools package in Xcode.
My gcc compiler info:
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

How to make Python and distutils use the right SDK on Mac OS X?

I use Python on Mac OS X version 10.6. I recently installed the newest Mac OS X developer tools SDK, which has GCC in it. The SDKs I have are:
$ ls /Developer/SDKs/
MacOSX10.4u.sdk MacOSX10.5.sdk MacOSX10.6.sdk
I'd like to use Mac OS X 10.6 with Python/distutils, whenever I install a python package with "setup.py install" that requires compilation.
I notice that Python passes the -isysroot flags and paths to Mac OS X 10.5 (not 10.6), i.e.:
$ python-config --cflags --ldflags
-I/Library/Frameworks/EPD64.framework/Versions/7.0/include/python2.7 -I/Library/Frameworks/EPD64.framework/Versions/7.0/include/python2.7 -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -DNDEBUG -g -O3 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -I/Library/Frameworks/EPD64.framework/Versions/7.0/include
-L/Library/Frameworks/EPD64.framework/Versions/7.0/lib/python2.7/config -ldl -framework CoreFoundation -lpython2.7 EPD64.framework/Versions/7.0/Python
How can I correct this? I'd like it to use the 10.6 SDK instead.
Right now when I run "python setup.py install" on a package that requires C compilation, it yields calls to GCC that look like this:
gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -DNDEBUG -g -O3 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -I/Library/Frameworks/EPD64.framework/Versions/7.0/include -DHAVE_RINTF=1 -DHAVE_FINITE=1 -DHAVE_EXPM1=1 -DHAVE_RINT=1 -DHAVE_LOG2=1 -DHAVE_LOGBL=1 -DHAVE_SNPRINTF=1 -DHAVE_LOG1P=1 -DHAVE_ROUND=1 -DHAVE_FMIN=1 -Iinclude -Isrc/lapack -Isrc/f2c -I/Library/Frameworks/EPD64.framework/Versions/7.0/include/python2.7 -c src/f2c/signal_.c -o build/temp.macosx-10.5-x86_64-2.7/src/f2c/signal_.o
which calls 10.5 SDKs in its path.
I use the Enthought Python Distribution installation of Python in case that makes a difference.
Thanks very much.
It's a feature and should not cause you any worries. Distutils does this deliberately to ensure that C extension modules that you build are built the same way that the Python interpreter in use was built. Extensions built this way are upwards compatible: they will work on 10.6 as well. If you absolutely want to use 10.6 ABI features, you should use a Python that was built using the 10.6 SDK, for instance, from a recent python.org 64-bit installer or from MacPorts or Homebrew.
I completely disagree with #Ned Deily
The poster obviously uses Enthought Python Distribution (EPD), and installing the whole new Python would require an installation of the whole new infrastracture.
I have the same situation. On MacBook with Mac Os X 10.6 the project (MeshPy) builds correctly, but on the Imac with Mac Os X 10.7 it does not (no 10.5 SDK is provided, and with this SDK EPD was built). You can try to install this old SDK, however, a much simpler hack (hopefully it works) is to make a symlink:
sudo ln -sf MacOSX10.6.sdk MacOSX10.5.sdk
It worked for me.

PyODBC on Snow Leopard - Install Error

Has anyone succesffuly installed PyODBC on snow leopard?
I'm getting the error below. (I also submitted a bug here too) Any ideas how to fix this and get it installed?
Here is the output I'm getting:
$ python setup.py install
running install
running bdist_egg
running egg_info
writing pyodbc.egg-info/PKG-INFO
writing top-level names to pyodbc.egg-info/top_level.txt
writing dependency_links to pyodbc.egg-info/dependency_links.txt
reading manifest file 'pyodbc.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pyodbc.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-universal/egg
running install_lib
running build_ext
building 'pyodbc' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DPYODBC_VERSION=2.1.8 -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c /Users/pinerog/Downloads/pyodbc-2.1.8/src/buffer.cpp -o build/temp.macosx-10.6-universal-2.6/Users/pinerog/Downloads/pyodbc-2.1.8/src/buffer.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/datetime.h:186: warning: ‘PyDateTimeAPI’ defined but not used
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/datetime.h:186: warning: ‘PyDateTimeAPI’ defined but not used
/Users/pinerog/Downloads/pyodbc-2.1.8/src/buffer.cpp:58: fatal error: error writing to -: Broken pipe
compilation terminated.
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/datetime.h:186: warning: ‘PyDateTimeAPI’ defined but not used
lipo: can't open input file: /var/folders/z3/z3Y30fNyGvennzCS3hWhkLlN-Ec/-Tmp-//ccZURNsn.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
Versions: PyODBC 2.1.8, Mac 10.6.7, and Python 2.6.1
Your problem is likely the combination of xcode 4 and setuptools. See this error:
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/datetime.h:186: warning: ‘PyDateTimeAPI’ defined but not used
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
setuptools tries to compile for ppc but xcode 4 no longer supports it.
Try compiling like this:
ARCHFLAGS="-arch i386 -arch x86_64" python setup.py install
I use macports to install pyodbc
sudo port install py26-odbc
py26-odbc is for python 2.6. If you use Python 2.7, the name would be py27-odbc

Xcode gcc exit status 1

First of all I am very new to all this.
I recently upgraded to Snow Leopard and installed the Xcode + iPhone dev package, 3.1.2.
I went on to install the Django framework + MYSQLDB handler. During the build stage, the terminal shows me the gcc exit status 1 error. But I have the Xcode already installed?
Where am I going wrong?
Also while trying to fix things up, I installed the Xcode that came with the Snow Leopard DVD. still the same error.
Now I think I should remove the Xcode completely and do a fresh install?
Is the ver.3.1.2 specific to 32-bit? Please help me out.
Here is the complete error:
Amit-Vermas-MacBook:mysql-python-1.2.2 amitverma$ gcc-4.0
i686-apple-darwin10-gcc-4.0.1: no input files
Amit-Vermas-MacBook:mysql-python-1.2.2 amitverma$ python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.3-i386-2.5/MySQLdb
running build_ext
building '_mysql' extension
gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -Dversion_info=(1,2,2,'final',0) -D__version__=1.2.2 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _mysql.c -o build/temp.macosx-10.3-i386-2.5/_mysql.o -g -Os -arch x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
cc1: error: unrecognized command line option "-Wno-long-double"
error: command 'gcc' failed with exit status 1
I am not sure if you solved your problem. I got the exact same issue after I upgraded from Mac OS 10.4 to 10.6.
Following some blog posts, on a hunch, I ran setup.py pointing to an older gcc version (gcc-4.0).
CC='/usr/bin/gcc-4.0' python setup.py build
The build encountered few warnings.
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.3-i386-2.5/MySQLdb
running build_ext
building '_mysql' extension
/usr/bin/gcc-4.0 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -Dversion_info=(1,2,3,'gamma',1) -D__version__=1.2.3c1 -I/usr/local/mysql/include -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _mysql.c -o build/temp.macosx-10.3-i386-2.5/_mysql.o -g -Os -arch i386 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
In file included from _mysql.c:36:
/usr/local/mysql/include/my_config.h:1050:1: warning: "HAVE_WCSCOLL" redefined
In file included from /Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/Python.h:8,
from pymemcompat.h:10,
from _mysql.c:29:
/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyconfig.h:724:1: warning: this is the location of the previous definition
gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-i386-2.5/_mysql.o -L/usr/local/mysql/lib -lmysqlclient_r -lz -lm -lmygcc -o build/lib.macosx-10.3-i386-2.5/_mysql.so
ld: warning: in build/temp.macosx-10.3-i386-2.5/_mysql.o, file is not of required architecture
ld: warning: in /usr/local/mysql/lib/libmysqlclient_r.dylib, file is not of required architecture
ld: warning: in /usr/local/mysql/lib/libmygcc.a, file is not of required architecture
Ran the same command again.
Everything works now magically. The install also went through. The module works as expected.
It normally also shows why a compilation fails. Could you give the text preceding "gcc exited with code 1" or something like that? And perhaps the source file also.
Also look for other threads on this subject, like this one. Good search terms on google or stack overflow are leopard and MySQLdb.
If it helps any, I solved this issue with sym links, and I think it will work for you. I wrote this with my version of gcc in mind, which is 4.2:
cd /usr/bin
rm cc gcc c++ g++
ln -s gcc-4.2 cc
ln -s gcc-4.2 gcc
ln -s c++-4.2 c++
ln -s g++-4.2 g++
ln -s gcc-4.2 gcc-4.0
There ya go!

Categories