Fix the build issue when using 'make' command when installing OSRM - c++

I am setting up a OSRM server locally on a EC2 instance which is running Ubuntu 18.04.
I have followed the following steps to install OSRM:-
sudo apt update
sudo apt install -y git \
cmake \
build-essential \
jq \
liblua5.2-dev \
libboost-all-dev \
libprotobuf-dev \
libtbb-dev \
libstxxl-dev \
libbz2-dev
git clone https://github.com/Project-OSRM/osrm-backend.git
cd osrm-backend/
mkdir build
cd build/
cmake ..
make /* fails here */
On executing this in the given sequence, I get this error
[ 8%] Built target UTIL
[ 10%] Built target MICROTAR
[ 12%] Linking CXX executable osrm-components
CMakeFiles/osrm-components.dir/src/tools/components.cpp.o:components.cpp:function main: error: undefined reference to 'boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
CMakeFiles/osrm-components.dir/build.make:132: recipe for target 'osrm-components' failed
make[2]: *** [osrm-components] Error 1
CMakeFiles/Makefile2:100: recipe for target 'CMakeFiles/osrm-components.dir/all' failed
make[1]: *** [CMakeFiles/osrm-components.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
Thanks in advance

Reinstalling everything in the same manner after deleting every related file and folder worked for me.

Related

undefined reference to `__printf_chk' when building from source with musl-g++

I'm attempting to compile a C++ library called VRPN with musl instead of glibc, and running into linker errors.
Dockerfile
# This build container compiles fully static binaries for alpine
FROM ekidd/rust-musl-builder:1.49.0 AS build
ENV CC=musl-gcc
ENV CXX=musl-g++
ENV CFLAGS=-static
ENV CXXFLAGS=-static
USER root
# Install build dependencies
RUN apt-get update && apt-get install -y cmake
# Install VRPN (VR peripheral device network)
WORKDIR /usr/local/src
RUN git clone --depth 1 --branch v07.34 https://github.com/vrpn/vrpn.git
RUN cd vrpn && git submodule update --init --recursive
RUN mkdir vrpn_Build
WORKDIR /usr/local/src/vrpn_Build
RUN cmake -DCMAKE_BUILD_TYPE=RELEASE \
-DVRPN_USE_GPM_MOUSE=OFF \
-DVRPN_BUILD_CLIENT_LIBRARY=OFF \
-DVRPN_BUILD_JAVA=OFF \
-DVRPN_BUILD_PYTHON_HANDCODED_3X=OFF \
-DVRPN_BUILD_SERVERS=OFF \
-DVRPN_USE_LIBUSB_1_0=OFF \
-DVRPN_USE_DEV_INPUT=OFF \
-DVRPN_USE_HID=OFF \
-DVRPN_USE_I2CDEV=OFF \
-DVRPN_USE_JOYLIN=OFF \
-DVRPN_USE_LIBUSB_1_0=OFF \
../vrpn
RUN make VERBOSE=1
Save the above to a file and run docker build . to get the following error (after lots of successful building):
Output
[ 72%] Linking CXX executable time_test
/usr/bin/cmake -E cmake_link_script CMakeFiles/time_test.dir/link.txt --verbose=1
/usr/bin/musl-g++ -static -fPIC -O3 -DNDEBUG -rdynamic CMakeFiles/time_test.dir/time_test.cpp.o -o time_test -L/usr/lib/x86_64-linux-musl libvrpnserver.a quat/libquat.a -lm atmellib/libvrpn_atmel.a gpsnmealib/libgpsnmea.a -Wl,-Bstatic -lgcc -lgcc_eh
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x12): undefined reference to `__libc_csu_fini'
(.text+0x19): undefined reference to `__libc_csu_init'
CMakeFiles/time_test.dir/time_test.cpp.o: In function `main':
time_test.cpp:(.text.startup+0x45): undefined reference to `__printf_chk'
time_test.cpp:(.text.startup+0xee): undefined reference to `__printf_chk'
time_test.cpp:(.text.startup+0x120): undefined reference to `__printf_chk'
collect2: error: ld returned 1 exit status
CMakeFiles/time_test.dir/build.make:100: recipe for target 'time_test' failed
make[2]: Leaving directory '/usr/local/src/vrpn_Build'
make[2]: *** [time_test] Error 1
CMakeFiles/Makefile2:973: recipe for target 'CMakeFiles/time_test.dir/all' failed
make[1]: Leaving directory '/usr/local/src/vrpn_Build'
make[1]: *** [CMakeFiles/time_test.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
The command '/bin/sh -c make VERBOSE=1' returned a non-zero code: 2
It seems that for some reason, musl's glibc hasn't been linked correctly, but I've been unable to figure out why.
I've read that linking to pre-compiled objects is generally the cause of this type of issue, but in this case, I'm pretty confident that everything is being built from source.
I don't have much experience with compiler internals, and I'm having a hard time finding reading material about musl simple enough that I can understand. Any insight or pointers would be much appreciated.
Thanks!
I managed to figure this one out. I think I was using host libraries rather than a proper musl toolchain. I got it to work by building in the messense/rust-musl-cross docker image (created with musl-cross-make), which contains the gcc toolchain compiled for the x86_64-unknown-linux-musl target.
Here's my working docker build script for future reference.
# This build container compiles fully static binaries for alpine
FROM messense/rust-musl-cross:x86_64-musl AS build
USER root
# Install build dependencies
RUN apt-get update && apt-get install -y cmake
# Install VRPN (VR peripheral device network)
WORKDIR /usr/local/src
RUN git clone --depth 1 --branch v07.34 https://github.com/vrpn/vrpn.git
RUN cd vrpn && git submodule update --init --recursive
RUN mkdir vrpn_Build
WORKDIR /usr/local/src/vrpn_Build
RUN set -x
ENV TARGET=x86_64-unknown-linux-musl
ENV CC=$TARGET-gcc
ENV CXX=$TARGET-g++
RUN cmake -DCMAKE_BUILD_TYPE=Release \
-DVRPN_USE_GPM_MOUSE=OFF \
-DVRPN_BUILD_JAVA=OFF \
-DVRPN_BUILD_PYTHON_HANDCODED_3X=OFF \
-DVRPN_BUILD_SERVERS=OFF \
-DVRPN_BUILD_CLIENTS=OFF \
-DVRPN_USE_LIBUSB_1_0=OFF \
-DVRPN_USE_DEV_INPUT=OFF \
-DVRPN_USE_HID=OFF \
-DVRPN_USE_I2CDEV=OFF \
-DVRPN_USE_JOYLIN=OFF \
-DVRPN_USE_LIBUSB_1_0=OFF \
../vrpn
RUN make VERBOSE=1
Cheers!

Error in installation of quorum blockchain

Error in installing the quorum
github.com/ethereum/go-ethereum/crypto/secp256k1 exec: "gcc":
executable file not found in $PATH
github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid #
github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid exec:
"gcc": executable file not found in $PATH util.go:44: exit status 2
exit status 1 Makefile:25: recipe for target 'all' failed make: ***
[all] Error 1
`
Install gcc
$ apt-get install build-essential
or
$ apt-get install gcc
After that you can run make all it will run.

Install GCC: fatal error: gnu/stubs-32.h: No such file or directory

I'm using a server with Centos 6.6. I don't have root access and I want to install the gcc-4.8.1 to my own directory. I found a solution and I run the following commands:
wget http://www.netgull.com/gcc/releases/gcc-4.8.1/gcc-4.8.1.tar.gz
tar zxvf gcc-4.8.1.tar.gz
cd gcc-4.8.1
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.8.1/configure --prefix=$HOME/gcc-4.8.1 --enable-languages=c,c++,fortran,go
make
I got errors when running the make command. It reports the following information:
configure: error: `CC' has changed since the previous run:
configure: former value: `/home/mypath/software/try_gcc2/objdir/./gcc/xgcc -B/home/mypath/software/try_gcc2/objdir/./gcc/ -B/home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/bin/ -B/home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/lib/ -isystem /home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/include -isystem /home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/sys-include '
configure: current value: `/home/mypath/software/try_gcc2/objdir/./gcc/xgcc -B/home/mypath/software/try_gcc2/objdir/./gcc/ -B/home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/bin/ -B/home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/lib/ -isystem /home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/include -isystem /home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/sys-include '
configure: error: in `/home/mypath/software/try_gcc2/objdir/x86_64-unknown-linux-gnu/libgcc':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ./config.cache' and start over
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/home/mypath/software/try_gcc2/objdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/mypath/software/try_gcc2/objdir'
make: *** [all] Error 2
I cannot figure what's wrong with my command. Thank you all for helping me!!!
I think I have found the solution. When I'm trying to build gcc-5.2.0, it reports that my server does not have 32-bit libraries. It also informs that if I still want to install anyway, I can add --disable-multilib when building. I tried and now the build is running normally.

Linking error: "relocation R_X86_64_32 ... can not be used when making a shared object; recompile with -fPIC"

I am attempting to compile Tox (specifically toxcore). When I attempt to compile it, I encounter the following error:
>make
make all-recursive
make[1]: Entering directory '/root/Tox/toxcore'
Making all in build
make[2]: Entering directory '/root/Tox/toxcore/build'
CCLD libtoxav.la
/usr/bin/ld: /usr/local/lib/libvpx.a(vpx_codec.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libvpx.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:1385: recipe for target 'libtoxav.la' failed
make[2]: *** [libtoxav.la] Error 1
make[2]: Leaving directory '/root/Tox/toxcore/build'
Makefile:506: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/Tox/toxcore'
Makefile:410: recipe for target 'all' failed
make: *** [all] Error 2
Following the error message, I have attempted to use fPIC by exporting C++ flags (export CXXFLAGS="$CXXFLAGS -fPIC"), by adding an argument to configure (./configure --enable-shared) and by editing the Makefile (changing CC = gcc to CC = gcc -fPIC), but these attempts have not worked and I still encounter the same error. What might be going wrong?
Here's the approach I have right now (on Ubuntu):
sudo apt-get install pkg-config
sudo apt-get install build-essential
sudo apt-get install libtool
sudo apt-get install autotools-dev
sudo apt-get install automake
sudo apt-get install checkinstall
sudo apt-get install check
sudo apt-get install git
sudo apt-get install yasm
cd ~
mkdir Tox
cd Tox
git clone https://github.com/jedisct1/libsodium.git
cd libsodium
git checkout tags/1.0.3
./autogen.sh
./configure && make check
sudo checkinstall --install --pkgname libsodium --pkgversion 1.0.0 --nodoc
sudo ldconfig
cd ..
git clone https://chromium.googlesource.com/webm/libvpx
cd libvpx
git checkout tags/v1.3.0
./configure
make
make install
cd ..
git clone https://github.com/irungentoo/toxcore.git
cd toxcore
autoreconf -i
./configure
make
sudo make install
cd ..
There must be a bug in the configuration script, it shouldn't come up with libvpx.a.
But worry not, since Ubuntu provides packages for both libvpx-dev and libsodium-dev, and using those seems to work just fine, so you should probably just do that unless there's some strong reason not to.
Also, unless you need classic toxcore, it seems c-toxcore is the successor, so you probably should use it instead.
Configuring with --enable-pic will add in the necessary -fPIC options, and works for me.

Coova-Chilli 1.3.0 build fails for Ubuntu server 14.04

Followed the directions from Coova-Chilli distribution build.
wget https://coova.github.io/coova-chilli/coova-chilli-1.3.0.tar.gz
tar xzf coova-chilli-1.3.0.tar.gz
cd coova-chilli-1.3.0/
debuild -b
and the results are the following error.
...........Error Section................
/usr/bin/ld: /usr/lib/libssl.a(s23_srvr.o): relocation R_X86_64_32 against
`.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/libssl.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
libtool: install: error: relink `libchilli.la' with the above command before
installing it
make[4]: *** [install-libLTLIBRARIES] Error 1
make[4]: Leaving directory `/home/download/coova-chilli-1.3.0/src'
make[3]: *** [install-am] Error 2
make[3]: Leaving directory `/home/download/coova-chilli-1.3.0/src'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/download/coova-chilli-1.3.0/src'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/download/coova-chilli-1.3.0'
make: *** [install] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit
status 2
debuild: fatal error at line 1364:
dpkg-buildpackage -rfakeroot -D -us -uc -b failed
I initially thought maybe openssl was not a recent enough version. None of the other applications had that problem. So I removed openssl package, built and installed it from source. The latest version is openssl 1.0.2e. I retested radius server after ripping up and rebuilding openssl and all is surprisingly still working fine.
I tried to compile coova-chilli again and also 1.2.9 as well but received the same error. libssl.a is present in that location.
Any thoughts on how best to proceed?
The instructions for Debian/Ubuntu on Coova-Chilli were not correct for Ubuntu.
wget https://coova.github.io/coova-chilli/coova-chilli-1.3.0.tar.gz
tar xzf coova-chilli-1.3.0.tar.gz
cd coova-chilli-1.3.0/
./configure --prefix= --enable-miniportal (or whatever flags you want)
make
sudo make install
update-rc.d chilli defaults
Reference: https://help.ubuntu.com/community/WifiDocs/CoovaChilli