如何在没有sudo的情况下构建库? [英] How to build library without sudo?

查看:108
本文介绍了如何在没有sudo的情况下构建库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常会建立我的图书馆./configure && make && sudo make install.但是,Travis文档不鼓励使用sudo http://docs.travis-ci .com/user/workers/container-based-infrastructure/

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/

因此我将构建命令更改为./configure --prefix=$HOME && make && make install.这行得通,但是在下一步(构建Python扩展)时出现错误

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:找不到-lprimesieve

/usr/bin/ld: cannot find -lprimesieve

有什么想法吗?因为更改了前缀,我是否需要在某些环境变量中添加$HOME/lib?

Any ideas? Do I need to add $HOME/lib to some environment variables, because I changed prefix?

  1. 我的travis配置 https://github.com/hickford/primesieve-python/blob/travis-ci/.travis.yml
  2. 生成错误日志 https://travis-ci.org/hickford/primesieve-python/jobs/69536543#L382
  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

推荐答案

尝试设置集LD_LIBRARY_PATH,类似于库的PATH.例如:

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.

具体影响 configure 脚本将参数传递给编译方式的环境变量是 LIBS LD_FLAGS . bash ./configure --help提到了这些.

Environment variables that specifically influence how the configure script passes arguments to compilation are LIBS and LD_FLAGS. bash ./configure --help mentions these.

正如您在注释中提到的,LIBRARY_PATH也需要设置.有关差异的说明,请参见 LD_LIBRARY_PATH与LIBRARY_PATH .

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.

这篇关于如何在没有sudo的情况下构建库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆