I had to add pycurl to our Solaris 10 image. I hear (in the ether?) that packaging is a bit weird in Python, (pip / easy_install , whatever). Running easy_install pycurl returned
Searching for pycurl
Best match: pycurl 126.96.36.199
Downloading https://pypi.python.org/packages/source/p/pycurl/pycurl-188.8.131.52.tar .gz#md5=f44cd54256d7a643ab7b16e3f409b26b
Running pycurl-184.108.40.206/setup.py -q bdist_egg --dist-dir /tmp/easy_install-PtCVY 7/pycurl-220.127.116.11/egg-dist-tmp-fN961C
Using curl-config (libcurl 7.23.1)
In file included from src/docstrings.c:4:
src/pycurl.h:145:31: openssl/crypto.h: No such file or directory
error: Setup script exited with error: command 'gcc' failed with exit status 1
So I needed to tell it that OpenSSL lives in /usr/local/ssl on my system, but couldn’t find out how to pass build-ext options to easy_install. It seemed to completely ignore the setup.cfg file I had written for it. So I bailed on easy_install and got the tarball.
Curl-config seems clever – it will just return the right values in case you want to build against it, so I didn’t need to pass it anything about which SSL libraries to use – it just knows and passes it on.
All normal stuff, right. This is the blog worthy part:
python setup.py build_ext --curl-config=/usr/local/bin/curl-config
Using /usr/local/bin/curl-config (libcurl 7.23.1)
building 'pycurl' extension
gcc -shared build/temp.solaris-2.10-i86pc-2.6/src/docstrings.o build/temp.solaris-2.10-i86pc-2.6/src/easy.o build/temp.solaris-2.10-i86pc-2.6/src/module.o build/temp.solaris-2.10-i86pc-2.6/src/multi.o build/temp.solaris-2.10-i86pc-2.6/src/oscompat.o build/temp.solaris-2.10-i86pc-2.6/src/pythoncompat.o build/temp.solaris-2.10-i86pc-2.6/src/share.o build/temp.solaris-2.10-i86pc-2.6/src/stringcompat.o build/temp.solaris-2.10-i86pc-2.6/src/threadsupport.o -L/usr/local/lib -L/usr/local/lib -L/usr/lib -L/usr/openwin/lib -L/usr/local/ssl/lib -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.7/lib -L/usr/local/mysql/lib -L/usr/local/ssl/lib -L/usr/local/lib -L/usr/openwin/lib -L/usr/local/ssl/lib -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.7/lib -L/usr/local/mysql/lib -lcurl -lidn -lssh2 -lssl -lcrypto -lrt -lsocket -lnsl -lssl -lcrypto -lsocket -lnsl -ldl -lz -lssh2 -lsocket -lnsl -lcrypto -o build/lib.solaris-2.10-i86pc-2.6/pycurl.so -R/usr/local/lib -R/usr/lib -R/usr/openwin/lib -R/usr/local/ssl/lib -R/usr/X11R6/lib -R/usr/local/BerkeleyDB.4.7/lib -R/usr/local/mysql/lib
collect2: ld terminated with signal 8 [Arithmetic Exception], core dumped
error: command 'gcc' failed with exit status 1
So how do I change the linker that gcc is using? Apparently you can’t.
This post really helped clarify it, particularly the command below:
gcc -print-prog-name=ld returns:
And the ccs directory contains the Solaris versions of the standard Unix build tools!
So there is a mismatch between the Gnu Compiler and the Solaris linker (maybe?) .
Rerunning with a different $PATH order does nothing here, so don’t bother. This is way nastier. ;o)
mv /usr/ccs/bin/ld /usr/ccs/bin/ld-old
ln -s /usr/sfw/bin/gld /usr/ccs/bin/ld
Note the 'g' in the ld executable, which I assume is for 'Gnu'.
After that it built fine.