我试图从源代码构建gperf(Google的分析器)。在构建过程中出现以下错误:从源代码构建gperf
src/stacktrace_config.h:58:5: error: #error Cannnot calculate stack trace: need either libunwind or frame-pointers (see INSTALL file)
src/stacktrace.cc:109:3: error: #error Cannot calculate stack trace: will need to write for your environment
make: *** [stacktrace.lo] Error 1
所以看来我需要libunwind
。
1)我从savannah的git回购库中获得了图书馆。 2)安装在/opt/unwind
。 3)我还加了/opt/unwind/lib/pkgconfig
到我的PKG_CONFIG_PATH
。 4)我编辑了libunwind.pc
,以便pkg-config --cflags --libs libunwind
都有正确的值。 5)我在/etc/ld.so.conf.d/
中增加了一个libunwind.conf
,指向/opt/unwind/lib
。
毕竟这些我重新运行./configure
在gperf
根目录。
的config.log
读取以下内容:
configure:15852: checking libunwind.h usability
configure:15852: gcc -c -g -O2 conftest.c >&5
conftest.c:67:23: fatal error: libunwind.h: No such file or directory
compilation terminated.
configure:15852: result: no
<***snip****>
configure:15852: checking libunwind.h presence
configure:15852: gcc -E conftest.c
conftest.c:34:23: fatal error: libunwind.h: No such file or directory
compilation terminated.
<***snip***>
ac_cv_header_libunwind_h=no
如此看来它仍然不知道在哪里libunwind
是。
然后我试图设定CFLAGS环境变量和LDFLAGS类似以下内容:
[email protected]:~/src/gperf$ CFLAGS=`pkg-config --cflags libunwind` LDFLAGS=`pkg-config --libs libunwind` ./configure
现在config.log
似乎更令人费解:
configure:15852: checking libunwind.h usability
configure:15852: gcc -c -I/opt/unwind/include conftest.c >&5
configure:15852: $? = 0
configure:15852: result: yes
configure:15852: checking libunwind.h presence
configure:15852: gcc -E conftest.c
conftest.c:34:23: fatal error: libunwind.h: No such file or directory
compilation terminated.
据报道第一个有libunwind.h
但后来却无法找到它。
config.log
也有这个奇怪的条目:
configure:15852: WARNING: libunwind.h: accepted by the compiler, rejected b y the preprocessor!
configure:15852: WARNING: libunwind.h: proceeding with the compiler's result
而且其搭建ac_cv_header_libunwind_h=yes
如果我做make
这与以下停止错误:
In file included from src/stacktrace.cc:65:0:
src/stacktrace_libunwind-inl.h:46:23: fatal error: libunwind.h: No such file or directory
compilation terminated.
make: *** [stacktrace.lo] Error 1