[Python] Set default compiler for linking C code in Python package

Discussão em 'Python' iniciado por Stack, Dezembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    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?

    Continue reading...

Compartilhe esta Página