Building gperf from source - configure

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

You need the libunwind headers too. Install the libunwind-devel package or equivalent.

Similar to bwzhou's answer, I tried following the answers in this SO question:
How to add include and lib paths to configure/make cycle?
and was able to finally get past the fatal error: libunwind.h: No such file or directory error when compiling gperftools with libunwind-1.2.1 compiled beforehand. More specifically, I set CPPFLAGS and LDFLAGS using the commands:
export CPPFLAGS='-I'$MY_INSTALL_DIR'/include '$CPPFLAGS
export LDFLAGS='-L'$MY_INSTALL_DIR'/lib '$CPPFLAGS
prior to executing ./configure --prefix=$MY_INSTALL_DIR, where $MY_INSTALL_DIR is my personal, non-standard directory in which I have to install software in the HPC cluster I work with due to lacking adequate permissions. After doing this, I was able to successfully execute make; make install. I hope this is helpful.

Try CPPFLAGS instead of CFLAGS when you invoke configure.

Related

Linker path not found

Currently I am working on GnuWin32 rpcgen tool on Windows 10. My files get compiled and I am able to generate .o files for client and server. But It fails in the linking process. I am running following makefile by make -f Makefile. I am using cygwin tool on windows.
# Compiler flags
CC = gcc
CFLAGS += -g
LDLIBS += -lnsl
RPCGENFLAGS =
I am getting following error:
gcc -g -o ipg_rpc_client ipg_rpc_clnt.o ipg_rpc_client.o ipg_rpc_xdr.o -lnsl
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lnsl: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile.ipg_rpc:41: ipg_rpc_client] Error 1
please help in solving this error. From last week I am struggling on this.
Finally the error got solved.
I have downloaded libtirpc-devel from cygwin, and changed my LDLIBS in makefile to -ltirpc.
Now my exes got created.

Error in make cdec

I am trying to implement text generator of JAMR. It redirects me to install cdec. I followed this tutorial to install cdec. BUT
I installed gcc-4.8 (I had a better version 5.x but I thought 4.8 is neccessary). So I installed gcc-4.8 using this. And I build Boost using this (in ~/prefix/sw), I used boost_1_58 because it was latest. Everything worked fine.
Coming back to the tutorial, instead of cd ~/prefix/sw I went to cd jamr/tools/cdec where my cdec is present. Did autoreconf -ifv and ./configure --prefix=/home/student/prefix, fine till now (I just had to comment line 216 of containing boost_major_version and wrote boost_major_version="158"). But when I do make after a while I get
libtool: link: g++ -std=gnu++11 -fPIC -g -O3 /usr/lib /usr/lib -o reconstruct_weights reconstruct_weights.o -L/usr/lib libutils.a -ldl -lrt -lboost_program_options -lboost_regex -lboost_serialization -lboost_system -lboost_filesystem -lz -lbz2
/usr/bin/ld: cannot find /usr/lib: File format not recognized
/usr/bin/ld: cannot find /usr/lib: File format not recognized
collect2: error: ld returned 1 exit status
Makefile:836: recipe for target 'reconstruct_weights' failed
make[2]: *** [reconstruct_weights] Error 1
make[2]: Leaving directory '/home/student/ATS/jamr/tools/cdec-2014-10-12/utils'
Makefile:480: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/student/ATS/jamr/tools/cdec-2014-10-12'
Makefile:410: recipe for target 'all' failed
make: *** [all] Error 2
I tried sudo make, simple ./configure and make clean;make. No help. This is make file.
When you are in the cdec folder and you try to execute the commands there according to the instructions, we see that you get the collect2 error: error: ld returned 1 exit status. In the cdec folder, i initially execute the command:
gcc -std=gnu99 -Wall -Werror -g array_product.c -o array_product -I../../ZDK -L../../ZDK -I../../TestLib04 -L../../TestLib04 -ltestlib04 -lzdk -lncurses -lm
After this command, the error is solved and i get to the file and it says:
> First, you need all the build dependencies, and the fastest way to install them all is this command, which installs not only the compiler but the additional boost libraries and Flex that you'll need. sudo apt-get install build-essential libboost-all-dev cmake flex
> Secondly, create a directory and go into it (you said ~/prefix/sw in your comments).
> Thirdly, git clone https://github.com/redpony/cdec.git
> Fourthly, you probably did not read the README page on the GitHub repository which explains what commands to run to make the software build. It lists these as the build steps, after cd-ing into the newly created cdec folder.

How to cross compile iw to Xilinx Petalinux?

Update
The error happens at line 8962 of libtool, which performs a lot of commands inside a loop. The content of the problematic command is
arm-xilinx-linux-gnueabi-gcc -shared -fPIC -DPIC genl/.libs/ctrl.o genl/.libs/family.o genl/.libs/genl.o genl/.libs/mngt.o -Wl,-rpath -Wl,/usr/arm-linux-gnueabi/lib -L/usr/arm-linux-gnueabi/lib -lnl-3 -lpthread -lm -O2 -Wl,--version-script=../libnl.sym -Wl,-soname -Wl,libnl-genl-3.so.200 -o .libs/libnl-genl-3.so.200.19.0
If I manually run it, it says
error: genl/.libs/ctrl.o: No such file or directory
the .o s are there, but the problem is that make install is under sudo, but sudo is a different environment and it doesn't recognize the paths. So solution is:
sudo -s
source /opt/pkg/......./settings.sh
source command is required by Xilinx Petalinux for the paths. Now make install will work
Original
I am following the beyond logic example to cross compile the iw tool. The first step is the libnl. I am using CentOS to crossc compile libnl, so I have to run source /opt/pkg/.../settings.sh to setup the arm-xilinx-linux-gnueabi-gcc paths. I then used ./configure --host=arm-xilinx-linux-gnueabi --prefix=/usr/arm-xilinx-linux-gnueabi
The make is running fine. But make install failed with following errors:
libtool: install: (cd /xxx/libnl-3.2.24/lib; /bin/sh /home/xxx/libnl-3.2.24/libtool --silent --tag CC --mode=relink arm-xilinx-linux-gnueabi-gcc -g -O2 -version-info 219:0:19 -Wl,--version-script=../libnl.sym -o libnl-genl-3.la -rpath /usr/arm-xilinx-linux-gnueabi/lib genl/ctrl.lo genl/family.lo genl/genl.lo genl/mngt.lo libnl-3.la -lpthread -lm )
/xxx/libnl-3.2.24/libtool: line 8962:
arm-xilinx-linux-gnueabi-gcc: command not found
libtool: install: error: relink `libnl-genl-3.la' with the above command before installing it
make[3]: *** [install-libLTLIBRARIES] Error 1
make[3]: Leaving directory `/xxx/libnl-3.2.24/lib'
make[2]: *** [install-am] Error 2
make[2]: Leaving directory `/xxx/libnl-3.2.24/lib'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/xxx/libnl-3.2.24/lib'
make: *** [install-recursive] Error 1
so since make is successful using arm-xilinx-linux-gnueabi-gcc, why make install is complaining it can't find it?
Problem is with following statement
./configure --host=arm-xilinx-linux-gnueabi --prefix=/usr/arm-xilinx-linux-gnueabi
arm-xilinx-linux-gnueabi is not installed at /usr thats why getting arm-xilinx-linux-gnueabi-gcc: command not founderror.
Install arm toolchain and then follow procedure mentioned in beyond logic example

Build wxWidgets 2.8.12 GCC 4.6.2

I am getting this error when building wxWidgets in Cygwin:
../src/generic/dirctrlg.cpp:67:24: fatal error: direct.h: No such file or directory
compilation terminated.
make: *** [corelib_dirctrlg.o] Error 1
T_BITS=64 -D_LARGE_FILES -D__WXDEBUG__ -I/cygdrive/c/wxWidgets-2.8.12/build-debug/lib/wx/include/msw-ansi-debug-static-2.8 -I../include -Wall -Wundef -Wno-ctor-dtor-privacy -ggdb -O0 ../src/generic/dirctrlg.cpp
Makefile:28340: recipe for target `corelib_dirctrlg.o' failed
I followed the instructions included in wxWidgets for Windows using configure in install.txt(Compiling wxWidgets).
Which compiler do you use? See http://wxwidgets.blogspot.com/2011/06/choosing-gcc-for-building-wxwidgets.html for some of the choices you have. FWIW direct.h should be present in MinGW compiler headers.

Chef-solo install - gecode compile error

Im trying to install chef-solo on CentOS 6.3 x64 and when I run:
sudo chef-solo -c /etc/chef/solo.rb -j ~/chef.json -r http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz
I'm getting this output:
g++ -I. -ffast-math -fno-strict-aliasing -O3 -fvisibility=hidden -ggdb -pipe -Wall -Wextra -fPIC -pthread -DNDEBUG \
-c -o gecode/int/extensional.o gecode/int/extensional.cpp
make[1]: Leaving directory `/tmp/chef-solo/gecode-3.5.0'
STDERR: {standard input}: Assembler messages:
{standard input}:13822: Warning: end of file not at end of a line; newline inserted
{standard input}:14946: Error: unknown pseudo-op: `.'
{standard input}:14946: Error: open CFI at the end of file; missing .cfi_endproc directive
g++: Internal error: Killed (program cc1plus)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make[1]: *** [gecode/int/extensional.o] Error 1
make: *** [compilelib] Error 2
---- End output of "bash" "/tmp/chef-script20120904-19809-1ofhwoq" ----
Ran "bash" "/tmp/chef-script20120904-19809-1ofhwoq" returned 2
I can install gecode from the RBEL6 repo without any problems but the cookbook attempts to install from source. I found this pull request on github which attempts to install from the RBEL repo but I got an error saying that the repository metadata couldn't be found. Anyone know what to do?
Since I have been searching for an answer to this, my findings were rather ... unsurprising.
I simply ran out of memory. I had to compile my files on another system with the same OS (copied over /tmp/chef-solo/gecode-3.5.0 to the box and just ran make) and synced the resulting folder back to run make install
Once the library is found the compile step is skipped and you should be good to continue.

Resources