[Distutils] How to link to a c library ?

David Cournapeau cournape at gmail.com
Fri Feb 21 09:56:57 CET 2014


On Wed, Feb 19, 2014 at 8:30 AM, chaouche yacine
<yacinechaouche at yahoo.com>wrote:

>
>
> What I was trying to accomplish
> -------------------------------
>
> I tried to upgrade numpy
> # pip install --upgrade
> numpy.../chaouche/build/numpy/numpy/numarray/_capi.c:198:undefined
> reference to `log10' collect2: ld returned 1 exit status error: Command
> "gcc -pthread -shared -Wl,--as-needed -Wl,--no-undefined -Wl,-z,relro
> -Wl,-O1 -Wl,--build-id -Wl,--enable-new-dtags
> build/temp.linux-i686-2.7/numpy/numarray/_capi.o -L/usr/lib
> -Lbuild/temp.linux-i686-2.7 -lpython2.7 -o
> build/lib.linux-i686-2.7/numpy/numarray/_capi.so" failed with exit status 1
> ---------------------------------------- Rolling back uninstall of numpy
> Replacing /usr/lib/python2.7/site-packages/numpy-1.6.1-py2.7.egg-info
> Command /usr/bin/python -c "import
> setuptools;__file__='/home/chaouche/build/numpy/setup.py';exec(compile(open(__file__).read().replace('\r\n',
> '\n'), __file__, 'exec'))" install --single-version-externally-managed
> --record /tmp/pip-lppaDW-record/install-record.txt failed with error code 1
> Exception information:
> Traceback (most recent call last):
> ...
> InstallationError: Command /usr/bin/python -c "import
> setuptools;__file__='/home/chaouche/build/numpy/setup.py';exec(compile(open(__file__).read().replace('\r\n',
> '\n'), __file__, 'exec'))" install --single-version-externally-managed
> --record /tmp/pip-lppaDW-record/install-record.txt failed with error code 1
>
>
>
> What the problem was
> --------------------
>
> I eventually figured out that they didn't link to the math library
> where all those symbols where defined (log10, sqrt, sincos etc.). I
> found that out by manually trying the gcc command with the -lm flag and
> it compiled fine.
>
>
> My question
> ------------
> What files do I need to edit in order to add this -lm flag and install
> numpy correctly ?
>

numpy build links against the math library when needed, your problem most
likely comes from somewhere else.

You should contact the numpy mailing list, and post your full build log
there (not just the last lines).

David

> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> https://mail.python.org/mailman/listinfo/distutils-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20140221/282b60cb/attachment-0001.html>


More information about the Distutils-SIG mailing list