Why is this Python package trying to use a non-existent gcc

gccsoftware installation

I'm trying to install PyCrypto for Python 3 on Solaris. Whether I do it via "python3 setup.py install" or "pip3 install pycrypto", I run into the same problem: a call is made to a gcc which does not exist:

python3 setup.py install
[...]
/opt/csw/bin/gcc-4.8 -pipe -m32 -march=pentiumpro -Wno-unused-result -fwrapv -Wall -Wstrict-prototypes -pipe -m32 -march=pentiumpro -I/usr/include/gmp -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/opt/csw/include/python3.3m -c src/_fastmath.c -o build/temp.solaris-2.11-i86pc.32bit-3.3/src/_fastmath.o
unable to execute /opt/csw/bin/gcc-4.8: No such file or directory

Now, I know nothing about the history of the machine that I'm on. It's possible that /opt/csw/bin/gcc-4.8 existed at some point in the past. But it doesn't anymore. export CC=/usr/bin/gcc (or some other gcc) does NOT fix the problem — without fail /opt/csw/bin/gcc-4.8 is called.

I'm less interested in installing PyCrypto and more interested in understanding WHY this bogus call is made to begin with. Where is the value "/opt/csw/bin/gcc-4.8" saved? How/where does the system even get the information to think that it needs to call that compiler?

The only thing I can think of is that Python3 was originally compiled with /opt/csw/bin/gcc-4.8, and Python3 has it permanently burned in somewhere that /opt/csw/bin/gcc-4.8 is the compiler to use for compiling stuff. If this is the case, would I be best off removing and re-installing Python3 to get rid of this erroneous dependence?

Best Answer

/opt/csw/bin/gcc-4.8 path indicates for OpenCSW that comes pre-installed with Oracle distro (either 4.8 is deleted or there is another version).

Try setting the CC and CXX environment variables from inside setup.py with os.environ:

os.environ["CC"] = "g++-4.7" os.environ["CXX"] = "g++-4.7"

(4.7 is my version of g++, set it to what you have in your /bin).

Related Question