Command "/usr/bin/clang++ -bundle -undefined..." failed with exit status 1 - python

I'm trying to build a library "cmappertools" referencing to c++ "boost" in os x maverick, and hit the error below. I'm very new to both python and c++ boost, and can't even tell where to start looking: the "Missing compiler_cxx fix for UnixCCompiler" error didn't seem pointing me to anywhere. Any idea, please?
checking for exit in -lboost_thread-mt... yes
checking whether the Boost::Chrono library is available... yes
checking for exit in -lboost_chrono-mt... yes
checking whether C++ compiler accepts -fvisibility=hidden... yes
checking whether C++ compiler accepts -fno-common... yes
checking whether C++ compiler accepts -fvisibility-inlines-hidden... yes
...
building extension "cmappertools" sources
build_src: building npy-pkg config files
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize UnixCCompiler
**#### ['/usr/bin/clang', '-fno-strict-aliasing', '-fno-common', '-dynamic', '-arch', 'i386', '-arch', 'x86_64', '-g', '-DNDEBUG', '-g', '-fwrapv', '-O3', '-Wall', '-Wstrict-prototypes'] #######
Missing compiler_cxx fix for UnixCCompiler**
customize UnixCCompiler using build_ext
building 'cmappertools' extension
compiling C++ sources
C compiler: /usr/bin/clang++ -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g - DNDEBUG -g -fwrapv -O3 -Wall
compile options: '-I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site- packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c'
extra options: '-pthread -I/usr/local/include -fvisibility=hidden -fno-common -fvisibility-inlines- hidden -ffunction-sections -fdata-sections'
clang++: cmappertools.cpp
/usr/bin/clang++ -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-2.7/cmappertools.o -o build/lib.macosx-10.6-intel-2.7/cmappertools.so -L/usr/local/lib - lboost_thread-mt -lboost_chrono-mt -Wl,-s
ld: warning: option -s is obsolete and being ignored
ld: warning: ignoring file /usr/local/lib/libboost_thread-mt.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libboost_thread-mt.dylib
ld: warning: ignoring file /usr/local/lib/libboost_chrono-mt.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libboost_chrono-mt.dylib
ld: internal error: atom not found in symbolIndex(__ZN5boost16exception_detail20copy_boost_exceptionEPNS_9exceptionEPKS1_) for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: warning: option -s is obsolete and being ignored
ld: warning: ignoring file /usr/local/lib/libboost_thread-mt.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libboost_thread-mt.dylib
ld: warning: ignoring file /usr/local/lib/libboost_chrono-mt.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libboost_chrono-mt.dylib
ld: internal error: atom not found in symbolIndex(__ZN5boost16exception_detail20copy_boost_exceptionEPNS_9exceptionEPKS1_) for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: Command "/usr/bin/clang++ -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-2.7/cmappertools.o -o build/lib.macosx-10.6-intel-2.7/cmappertools.so -L/usr/local/lib -lboost_thread-mt -lboost_chrono-mt -Wl,-s" failed with exit status 1

You need to compile boost in combined 32/64 bit - it's only compiled for 64bit mode.
If you installed boost via brew, you should have added the --universal option to the install command.
If you were manually building boost, you should have added the options:
address-model=32_64 architecture=x86
to the b2 compile line. This will cause it to be built in 32 & 64 bit, which should support your python build.

Related

Rectangle Example, cython [duplicate]

I want to wrap a test project containing C++ and OpenMP code with Cython, and build it with distutils via a setup.py file. The content of my file looks like this:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext
modules = [Extension("Interface",
["Interface.pyx", "Parallel.cpp"],
language = "c++",
extra_compile_args=["-fopenmp"],
extra_link_args=["-fopenmp"])]
for e in modules:
e.cython_directives = {"embedsignature" : True}
setup(name="Interface",
cmdclass={"build_ext": build_ext},
ext_modules=modules)
The -fopenmp flag is used with gcc to compile and link against OpenMP. However, if I just invoke
cls ~/workspace/CythonOpenMP/src $ python3 setup.py build
this flag is not recognized, because the compiler is clang:
running build
running build_ext
skipping 'Interface.cpp' Cython extension (up-to-date)
building 'Interface' extension
cc -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/include/python3.3m -c Interface.cpp -o build/temp.macosx-10.8-x86_64-3.3/Interface.o -fopenmp
clang: warning: argument unused during compilation: '-fopenmp'
cc -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python3/3.3.0/Frameworks/Python.framework/Versions/3.3/include/python3.3m -c Parallel.cpp -o build/temp.macosx-10.8-x86_64-3.3/Parallel.o -fopenmp
clang: warning: argument unused during compilation: '-fopenmp'
Parallel.cpp:24:10: warning: unknown pragma ignored [-Wunknown-pragmas]
#pragma omp parallel for
^
1 warning generated.
c++ -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/local/opt/sqlite/lib build/temp.macosx-10.8-x86_64-3.3/Interface.o build/temp.macosx-10.8-x86_64-3.3/Parallel.o -o build/lib.macosx-10.8-x86_64-3.3/Interface.so -fopenmp
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'c++' failed with exit status 1
I've unsucessfully tried to specify gcc:
cls ~/workspace/CythonOpenMP/src $ python3 setup.py build --compiler=g++-4.7
running build
running build_ext
error: don't know how to compile C/C++ code on platform 'posix' with 'g++-4.7' compiler
How can I tell distutils to use gcc?
Try setting the "CC" environment variable from inside the setup.py with os.environ.
I just took a look at the distutils source, and the --compiler option expects "unix", "msvc", "cygwin", "mingw32", "bcpp", or "emx". It checks the compiler name you want by checking the CC environment variable. Try calling build like this:
CC=gcc python setup.py build
You don't need to set CXX, it doesn't check for that.
Just in case some others are facing the same problem under Windows (where CC environment variable wouldn't have any effect) :
Create file "C:\Python27\Lib\distutils\distutils.cfg" and write this inside :
Code :
[build]
compiler = mingw32
Remove all instances of "-mno-cygwin" gcc option from file "C:\Python27\Lib\distutils\cygwinccompiler.py" :
This :
self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
compiler_so='gcc -mno-cygwin -mdll -O -Wall',
compiler_cxx='g++ -mno-cygwin -O -Wall',
linker_exe='gcc -mno-cygwin',
linker_so='%s -mno-cygwin %s %s'
% (self.linker_dll, shared_option,
entry_point))
Becomes this :
self.set_executables(compiler='gcc -O -Wall',
compiler_so='gcc -mdll -O -Wall',
compiler_cxx='g++ -O -Wall',
linker_exe='gcc',
linker_so='%s %s %s'
% (self.linker_dll, shared_option,
entry_point))
The second point can be necessary in case you are using a recent version of gcc, where the deprecated option -mno-cygwin has been removed.
Hope this will help even if it is not directly related to the OP real needs (but still related to the question's title...)
According to this wiki, Python versions after 3.4 do not support MinGW anymore.
CPython 3.7 for Windows is compiled with MSC v.1916. When I try to use above-mentioned method with distutils.cfg, I then get an error from distutils: Unknown MS Compiler Version 1916. Looks like it has a hardcoded table of msvcr libraries in its cygwincompiler.py file (which is also responsible for MinGW), and last version known to that file is 1600 from VS2010 / MSVC 10.0.
Try this:
http://mail.python.org/pipermail/distutils-sig/2002-August/002944.html
In short, it appears that you should try: python setup.py build --compiler=g++ first.
On linux while using distutils.ccompiler do
os.environ('CC')='gcc' and then call distutils.sysconfig.customize_compiler(compiler)
It will do the job.

pip install PIL fails on OSX

I'm trying to install PIL on OSX 10.6.8 using pip in virtualenv, but it fails with gcc returning 1 exit status.
here's what i get:
$ pip install PIL
Downloading/unpacking PIL
Running setup.py egg_info for package PIL
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
Installing collected packages: PIL
Running setup.py install for PIL
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
--- using frameworks at /System/Library/Frameworks
building '_imaging' 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 -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/opt/local/include/freetype2 -IlibImaging -I/opt/local/include -I/Users/DataGreed/workspaces/vitrualenv/project/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.6-universal-2.6/_imaging.o
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/as/ppc/as or /usr/bin/../local/libexec/as/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/as/x86_64/as for architecture x86_64
/usr/bin/../libexec/as/i386/as for architecture i386
/usr/bin/../libexec/as/arm/as for architecture arm
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
_imaging.c:3281: fatal error: error writing to -: Broken pipe
compilation terminated.
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
lipo: can't open input file: /var/folders/sO/sODPLYP7Goy5NCFskrL1dE+++TM/-Tmp-//ccds0vgZ.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
Complete output from command /Users/DataGreed/workspaces/vitrualenv/project/bin/python -c "import setuptools;__file__='/Users/DataGreed/workspaces/vitrualenv/project/build/PIL/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/sO/sODPLYP7Goy5NCFskrL1dE+++TM/-Tmp-/pip-BNAuaC-record/install-record.txt --single-version-externally-managed --install-headers /Users/DataGreed/workspaces/vitrualenv/project/bin/../include/site/python2.6:
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
running install
running build
running build_py
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' 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 -DHAVE_LIBJPEG -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -I/opt/local/include/freetype2 -IlibImaging -I/opt/local/include -I/Users/DataGreed/workspaces/vitrualenv/project/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.6-universal-2.6/_imaging.o
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/as/ppc/as or /usr/bin/../local/libexec/as/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/as/x86_64/as for architecture x86_64
/usr/bin/../libexec/as/i386/as for architecture i386
/usr/bin/../libexec/as/arm/as for architecture arm
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
_imaging.c:3281: fatal error: error writing to -: Broken pipe
compilation terminated.
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
lipo: can't open input file: /var/folders/sO/sODPLYP7Goy5NCFskrL1dE+++TM/-Tmp-//ccds0vgZ.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
UPD: on the other computer with the same osx version it installs flawlessly :-/
UPD2: there is a more strange thing actually. I have PIL already installed via pip outside virtualenv. But I cannot install it in virtualenv only.
UPD3: i dunno if it can help, but when I load virtualenv wrapper scripts, i got this:
/Library/Python/2.6/site-packages/stevedore/extension.py:4: UserWarning: Module
pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.6/site-packages is being added to sys.path
import pkg_resources
/Library/Python/2.6/site-packages/stevedore/extension.py:4: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.pyc, but /Library/Python/2.6/site-packages is being added to sys.path
import pkg_resources
When I use workon, i get the same warnings.
Have you tried Pillow? (pip install pillow):
http://pypi.python.org/pypi/Pillow/
It makes life with PIL much easier. I was able to install PIL via Pillow on OSX with virtualenv and virtualenvwrapper.
Mine installs fine into a virtualenv on 10.6.8 but...
mine is being built with gcc-4.0 , while yours is being built with 4.2 ; and 4.2 should be the default.
so i don't actually know why mine is being built with gcc-4.0 , but it does work fine.
$ which gcc
/usr/bin/gcc
$ ls -alh /usr/bin/gcc
lrwxr-xr-x 1 root wheel 7B Jan 3 2012 /usr/bin/gcc -> gcc-4.2

Set default compiler for linking C code in Python package

I'm trying to compile a Python package which has some Cython-generated C code, and I'm running into:
gcc: error: x86_64: No such file or directory
which indicates that the gcc compiler is too recent, so doesn't support -arch anymore. I tried setting CC=/usr/bin/gcc prior to python setup.py install, and this works for the main compile command, but not for the command to make the shared object library:
% setenv CC /usr/bin/gcc
% python setup.py install
running install
running build
running build_py
running build_ext
skipping 'hyperion/util/integrate_core.c' Cython extension (up-to-date)
building 'hyperion.util.integrate_core' extension
/usr/bin/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.2/lib/python2.7/site-packages/numpy/core/include -I/Library/Frameworks/EPD64.framework/Versions/7.2/include/python2.7 -c hyperion/util/integrate_core.c -o build/temp.macosx-10.5-x86_64-2.7/hyperion/util/integrate_core.o
gcc -bundle -undefined dynamic_lookup -g -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/hyperion/util/integrate_core.o -o build/lib.macosx-10.5-x86_64-2.7/hyperion/util/integrate_core.so
gcc: error: x86_64: No such file or directory
gcc: error: x86_64: No such file or directory
gcc: error: unrecognized option ‘-arch’
gcc: error: unrecognized option ‘-arch’
error: command 'gcc' failed with exit status 1
Is there a way to specify the absolute path of the compiler to use for linking?
Use LDSHARED variable: LDSHARED='/usr/bin/gcc -shared'.
It's buried in sysconfig module. Try this:
>>> from sysconfig import get_config_vars
>>> get_config_vars('CC', 'CXX', 'LDSHARED')
I've done it like so:
CXX="/Developer/usr/bin/g++-4.0" CC="/Developer/usr/bin/gcc-4.0" python setup.py build
but I'm not sure that's "right"; it's just part of a long command I need to use when installing scipy/numpy.
(full command I end up using is
LD_LIBRARY_PATH=/Developer/SDKs/MacOSX10.6.sdk/usr/lib/ FFLAGS="-m64" CFLAGS="-arch x86_64 -I/Developer/SDKs/MacOSX10.6.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/ -I/usr/local/include/freetype2 -I/usr/X11/include -L/usr/X11/lib" LDFLAGS="-Wall -undefined dynamic_lookup -bundle -lpng -arch x86_64" CXX="/Developer/usr/bin/g++-4.0" CC="/Developer/usr/bin/gcc-4.0" python setup.py build)

Trouble Setting Up MySQLdb Module

I'm pulling my hair out over here trying to set up MySQLdb on my Mac in order to connect to a remote MySQL server.
I have installed the latest C MySQL client libraries
I have installed XCode 4
I did naively try to install the module before installing XCode or the client libraries
I am attempting to set up the module by running the following commands in terminal:
$ sudo python setup.py build
$ sudo python setup.py install
Both of these commands fail with similar error messages. Here is the first stack trace:
running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.6-universal-2.6/MySQLdb
running build_ext
building '_mysql' 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 -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/temp.macosx-10.6-universal-2.6/_mysql.o -fno-omit-frame-pointer -pipe
In file included from _mysql.c:36:
/usr/include/mysql/my_config.h:1030:2: warning: #warning defining SIZEOF_CHARP = 4
/usr/include/mysql/my_config.h:1044:2: warning: #warning defining SIZEOF_LONG = 4
/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
In file included from _mysql.c:36:
/usr/include/mysql/my_config.h:1030:2: warning: #warning defining SIZEOF_CHARP = 4
/usr/include/mysql/my_config.h:1044:2: warning: #warning defining SIZEOF_LONG = 4
/usr/include/mysql/my_config.h:1151:1: warning: "WORDS_BIGENDIAN" redefined
In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8,
from pymemcompat.h:10,
from _mysql.c:29:
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:1014:1: warning: this is the location of the previous definition
_mysql.c:2888: fatal error: error writing to -: Broken pipe
compilation terminated.
In file included from _mysql.c:36:
/usr/include/mysql/my_config.h:1027:2: warning: #warning defining SIZEOF_CHARP = 8
/usr/include/mysql/my_config.h:1041:2: warning: #warning defining SIZEOF_LONG = 8
lipo: can't open input file: /var/tmp//ccU6bipK.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
And here is the stack trace for the second command:
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-universal/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.6-universal-2.6/MySQLdb
running build_ext
building '_mysql' 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 -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o build/temp.macosx-10.6-universal-2.6/_mysql.o -fno-omit-frame-pointer -pipe
In file included from _mysql.c:36:
/usr/include/mysql/my_config.h:1030:2: warning: #warning defining SIZEOF_CHARP = 4
/usr/include/mysql/my_config.h:1044:2: warning: #warning defining SIZEOF_LONG = 4
/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
In file included from _mysql.c:36:
/usr/include/mysql/my_config.h:1030:2: warning: #warning defining SIZEOF_CHARP = 4
/usr/include/mysql/my_config.h:1044:2: warning: #warning defining SIZEOF_LONG = 4
/usr/include/mysql/my_config.h:1151:1: warning: "WORDS_BIGENDIAN" redefined
In file included from /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8,
from pymemcompat.h:10,
from _mysql.c:29:
/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:1014:1: warning: this is the location of the previous definition
_mysql.c:2888: fatal error: error writing to -: Broken pipe
compilation terminated.
In file included from _mysql.c:36:
/usr/include/mysql/my_config.h:1027:2: warning: #warning defining SIZEOF_CHARP = 8
/usr/include/mysql/my_config.h:1041:2: warning: #warning defining SIZEOF_LONG = 8
lipo: can't open input file: /var/tmp//cchhckGP.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
I have been at this for a few days now and it's starting to drive me nuts. Any help would be greatly appreciated!
You've set yourself up for headaches by installing the new and forward-looking Xcode 4 rather than the latest version of Xcode 3 which is what Mac OS X 10.6 was released with. The immediate issue you are running into is that Python tries to build C extension modules with the same configuration that Python itself was built. For 10.6, that includes three architectures: i386, x86_64, and ppc (for compatibility with programs build on earlier systems). Apparently Xcode 4 has removed support for building ppc archs. You may be able to get around this issue easily by using the ARCHFLAGS environment variable which is used to override the arch settings used by Python's Distutils when building extension modules. Try doing something like this (untested as I don't have Xcode 4 handy):
sudo bash
export ARCHFLAGS='-arch i386 -arch x86_64'
rm -r build
python setup.py build
python setup.py install
A better solution, as recommended elsewhere, is to not try to install MySQLdb on 10.6 by using the system Python and the MySQL binary installers. Rather, use a complete solution by installing everything via a package manager like MacPorts.
There is another way that I just found to solve this.
I encountered the same problem as you did, and my python's version is 2.7.4, and Xcode 4. Maybe you have just got the python of 32 bits, as I did. So I changed it to 2.7.5x64bit, then there should be no problems.

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

Categories