运行configure时如何覆盖环境变量?
在 Linux 的任何主要软件包中,运行 ./configure --help
将在最后输出:
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
How do I use those variables to include a directory?我尝试运行 ./configure --CFLAGS="-I/home/package/custom/"
和 ./configure CFLAGS="-I/home/package/custom/",但是这些不起作用。有什么建议吗?
In any major package for Linux, running ./configure --help
will output at the end:
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
How do I use these variables to include a directory? I tried running ./configure --CFLAGS="-I/home/package/custom/"
and ./configure CFLAGS="-I/home/package/custom/"
, however these do not work. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
-I
需要使用的变量是CPPFLAGS
,而不是CFLAGS
。 (正如您复制的帮助消息中所说的那样。)CPP 代表“C 预处理器”,而不是 C++。所以:The variable you need to use for
-I
isCPPFLAGS
, notCFLAGS
. (As it says right there in the help message you copied.) CPP stands for "C preprocessor", not C++. So:这些不是传递给配置的标志。这些是您需要设置的环境变量。例如
export CFLAGS="-I foo"
。These are not flags passed to configure. These are environment variables you need to set. e.g.
export CFLAGS="-I foo"
.