I usually build my library ./configure && make && sudo make install
. However the Travis docs discourage using sudo http://docs.travis-ci.com/user/workers/container-based-infrastructure/
So I changed the build command to ./configure --prefix=$HOME && make && make install
. This worked, however at the next step (building a Python extension) I got an error
/usr/bin/ld: cannot find -lprimesieve
Any ideas? Do I need to add $HOME/lib
to some environment variables, because I changed prefix?
- My travis config https://github.com/hickford/primesieve-python/blob/travis-ci/.travis.yml
- Build log with error https://travis-ci.org/hickford/primesieve-python/jobs/69536543#L382
Try setting set LD_LIBRARY_PATH
which is like PATH
for libraries. For example:
LD_LIBRARY_PATH= $HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
More detailed information about library path variables is here.
Environment variables that specifically influence how the configure script passes arguments to compilation are LIBS and LD_FLAGS. bash ./configure --help
mentions these.
And as you mention in the comments LIBRARY_PATH
also needs to be set. See LD_LIBRARY_PATH vs LIBRARY_PATH for an explanation of the difference.
来源:https://stackoverflow.com/questions/31220762/how-to-build-library-without-sudo