How to build library without sudo?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 05:22:35

问题


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?

  1. My travis config https://github.com/hickford/primesieve-python/blob/travis-ci/.travis.yml
  2. Build log with error https://travis-ci.org/hickford/primesieve-python/jobs/69536543#L382

回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!