问题
I am trying to install the python library pyinterval. It requires the crlibm C headers which I have installed without error, but seem to be at the root of the problem.
When I run:
$ sudo easy_install pyinterval
I get the following:
Searching for pyinterval
Reading http://pypi.python.org/simple/pyinterval/
Reading http://pyinterval.googlecode.com/
Best match: pyinterval 1.0b21
Downloading http://pypi.python.org/packages/source/p/pyinterval/pyinterval-1.0b21.tar.gz#md5=a65fe9855d3b6b0a9ddcc5b2f1e1e421
Processing pyinterval-1.0b21.tar.gz
Running pyinterval-1.0b21/setup.py -q bdist_egg --dist-dir /tmp/easy_install-K58WK9/pyinterval-1.0b21/egg-dist-tmp-Tp03Mb
ext/crlibmmodule.c: In function ‘crlibm_cospi_rn’:
ext/crlibmmodule.c:45:1: warning: implicit declaration of function ‘cospi_rn’
ext/crlibmmodule.c: In function ‘crlibm_cospi_ru’:
ext/crlibmmodule.c:45:1: warning: implicit declaration of function ‘cospi_ru’
...
ext/crlibmmodule.c: In function ‘crlibm_log1p_rz’:
ext/crlibmmodule.c:59:1: warning: implicit declaration of function ‘log1p_rz’
/usr/bin/ld: /usr/local/lib/libcrlibm.a(addition_scs.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libcrlibm.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
error: Setup script exited with error: command 'gcc' failed with exit status 1
I have called:
$ sudo apt-get install python-all-dev
and that did not fix the problem.
回答1:
In case anyone still has problems with this, you need to set "CPPFLAGS = -fPIC" in "scs_lib/Makefile", not "./Makefile".
回答2:
I had been having the same problem, and I found the issue was with crlibm (the flags -fPIC are mentioned in the error).
I ended up installing crlibm from source, and was able to get the the installation working. Once I'd run ./configure for crlibm, I manually edited the Makefile by changing the line "CPPFLAGS = " to "CPPFLAGS = -fPIC". From here I ran "make", "make install", and then "sudo easy_install pyinterval".
I'll add that I'm not 100% confident in this solution, and its not very elegant. I'm not sure about the technical details of the -fPIC flag, and what effect it really has.
But it does work.
回答3:
It seems to work ok for me:
wget http://lipforge.ens-lyon.fr/frs/download.php/152/crlibm-1.0beta3.tar.gz
tar vfxz crlibm-1.0beta3.tar.gz
cd crlibm-1.0beta3
export CPPFLAGS=-fPIC
./configure
make
sudo make install
sudo pip install pyinterval
python
>>> from interval import *
Thanks for the answer.
回答4:
I just went through installing pyinterval on ubuntu 12.10 using the above suggestions for crlibm.
I tried adding -fPIC to CPPFLAGS in the scs_lib Makefile but it didn't work. I think later versions of crlibm (I am using 1.0beta-4) require that crlibm_private.o is also compiled with -fPIC so the flag needs to be added to CPPFLAGS in the Makefile of the base directory
来源:https://stackoverflow.com/questions/9608471/installing-pyinterval-in-ubuntu