如何添加包含和库路径来配置/制作循环? [英] How to add include and lib paths to configure/make cycle?

查看:36
本文介绍了如何添加包含和库路径来配置/制作循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个在我没有 su 访问权限的 linux 盒子中安装库的地方.我正在使用 ~/local[/bin,/lib,/include],但我不知道如何告诉 ./configure 在那里查找库(特别是,我正在尝试编译需要 libgif 的 emacs,我的发行版中没有).

我尝试添加

导出 PATH=$PATH:~/local/bin导出 LD_LIBRARY_PATH=~/local/lib导出 C_INCLUDE_PATH=~/local/include导出 CPLUS_INCLUDE_PATH=~/local/include

到 .bashrc 但它似乎不起作用.

解决方案

你想要一个 config.site 文件.试试:

<上一页>$ mkdir -p ~/local/share$猫 <~/local/share/config.siteCPPFLAGS=-I$HOME/local/includeLDFLAGS=-L$HOME/local/lib...EOF

每当您使用 --prefix=$HOME/local 调用 autoconf 生成的配置脚本时,都会读取 config.site 并为您完成所有分配.CPPFLAGS 和 LDFLAGS 应该是您所需要的,但您也可以进行任何其他所需的分配(因此在上面的示例中...).请注意,-I 标志属于 CPPFLAGS 而不是 CFLAGS,因为 -I 用于预处理器而不是编译器.

I need a place to install libraries in a linux box I have no su access to. I'm using ~/local[/bin,/lib,/include], but I don't know how can I tell ./configure to look for libraries there (particularly, I'm trying to compile emacs, which needs libgif, which doesn't come in my distro).

I tried adding

export PATH=$PATH:~/local/bin
export LD_LIBRARY_PATH=~/local/lib
export C_INCLUDE_PATH=~/local/include
export CPLUS_INCLUDE_PATH=~/local/include

to .bashrc but it doesn't seem to work.

解决方案

You want a config.site file. Try:

$ mkdir -p ~/local/share
$ cat << EOF > ~/local/share/config.site
CPPFLAGS=-I$HOME/local/include
LDFLAGS=-L$HOME/local/lib
...
EOF

Whenever you invoke an autoconf generated configure script with --prefix=$HOME/local, the config.site will be read and all the assignments will be made for you. CPPFLAGS and LDFLAGS should be all you need, but you can make any other desired assignments as well (hence the ... in the sample above). Note that -I flags belong in CPPFLAGS and not in CFLAGS, as -I is intended for the pre-processor and not the compiler.

这篇关于如何添加包含和库路径来配置/制作循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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