【发布时间】:2017-03-02 19:52:47
【问题描述】:
在运行 Octave 的配置脚本时,我会这样做:
./configure CFLAGS="-I/customlibs/pcre/gnu/8.40/include -L/customlibs/pcre/gnu/8.40/lib/" LD_LIBRARY_PATH="/customlibs/pcre/gnu/8.40/lib"
我也试过了:
./configure CFLAGS="-I/customlibs/pcre/gnu/8.40/include" LDFLAGS="-L/customlibs/pcre/gnu/8.40/lib/" LD_LIBRARY_PATH="/customlibs/pcre/gnu/8.40/lib"
这两者都会产生相同的故障:
checking pcre.h usability... yes
checking pcre.h presence... no
configure: WARNING: pcre.h: accepted by the compiler, rejected by the preprocessor!
configure: WARNING: pcre.h: proceeding with the compiler's result
checking for pcre.h... yes
checking pcre/pcre.h usability... no
checking pcre/pcre.h presence... no
checking for pcre/pcre.h... no
checking whether pcre.h defines the macros we need... no
configure: error: to build Octave, you must have the PCRE library and header files installed
我对它如何找到 pcre.h 感到迷茫,但无法用它做任何其他事情。我在配置线上做错了什么还是 pcre 坏了?如果它是我的配置行,我如何正确链接 pcre? 作为参考,这里是pcre路径:
ls /customlibs/pcre/gnu/8.40/
bin
include
lib
share
【问题讨论】:
-
预期的顺序显然是 -I -L 然后 -l 在 Octave 的情况下,它被编写为期望 pcre 位于系统路径中,因此加载外部版本需要很多额外的步骤。必须使用 C_INCLUDE_PATH 和 CPLUS_INCLUDE_PATH 来强制 gcc 指向我的库。
标签: gcc compilation linker