Python distutils not using correct version of gcc -


i trying compile package on mac osx 10.6.5. package's install script relies on distutils. problem computer's default gcc version 4.2 (i determined running gcc --version in terminal window) when run 'python setup.py build', see output distutils choosing gcc-4.0 instead of 4.2 big problem because code using require gcc >= 4.2. not have admin rights on machine, workaroud, created symlinks send gcc-4.0 gcc-4.2. result code compiles, generated .so files not work (when try import them in python, errors complaining missing init function in shared object).

i have tried compiling code on different mac (10.6.6) , works charm: distutils chooses 4.2 without being forced , can import generated shared object without problem. so, compile code on computer without having symlink trickery...i want distutils choose 4.2 automatically should. have tried taking .so files compile , transferring them computer, fails number of reasons (they linked against libraries not present on machine/are different version installed).

does have advice here?

thanks, josh

to force distutils use separate compiler, can redefine few variables via environment. first, find out distutils using defaults:

>>> distutils import sysconfig >>> sysconfig.get_config_var('ldshared') 'gcc-4.0 -wl,-f. -bundle -undefined dynamic_lookup' >>> sysconfig.get_config_var('cc') 'gcc-4.0' 

next need redefine those, substituting in version of gcc you'd use:

% ldshared="gcc-4.2 -wl,-f. -bundle -undefined dynamic_lookup" cc=gcc-4.2 \     /usr/bin/python setup.py build_ext 

keep in mind sysconfig defaults pulled makefile used compile python, fudging them may produce unintended results:

>>> path = sysconfig.get_python_lib(plat_specific=1, standard_lib=1) >>> os.path.join(path, 'config', 'makefile') '/system/library/frameworks/python.framework/versions/2.6/lib/python2.6/config/makefile' 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -