I'm trying to build gperf(Google's profiler) from source. During build process the following error comes up :
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
So it seems i need libunwind
.
1) I got the library from savannah's git repo.
2) Installed it in /opt/unwind
.
3) I also added /opt/unwind/lib/pkgconfig
to my PKG_CONFIG_PATH
.
4) I edited libunwind.pc
so that both pkg-config --cflags --libs libunwind
comes up with correct values.
5) I added a libunwind.conf
in /etc/ld.so.conf.d/
pointing to /opt/unwind/lib
.
After all of these i've rerun ./configure
in gperf
root directory.
The config.log
reads following :
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
So it seems It still does not know where libunwind
is.
Then i tried to set environment variables with CFLAGS and LDFLAGS like following :
arif@khost:~/src/gperf$ CFLAGS=`pkg-config --cflags libunwind` LDFLAGS=`pkg-config --libs libunwind` ./configure
Now config.log
seems more puzzling :
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.
It reports first that there is libunwind.h
but later it cant find it.
config.log
also has this curious entry :
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
Also its putting up ac_cv_header_libunwind_h=yes
If i do make
here it stops with the following error:
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