2013-06-05 190 views
2

我試圖從源代碼構建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

畢竟這些我重新運行./configuregperf根目錄。

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 

回答

-1

嘗試CPPFLAGS而不是當您調用配置時,CFLAGS。

3

您還需要libunwind標題。安裝libunwind-devel包或同等產品。