Error compiling GCC 9.2: libgotool.a: No such file - gcc

On a fresh install of Fedora 30 onto a VM (in the below yum gets gcc 9.1, and trying to use that to build gcc 9.2):
sudo yum install make cmake gmp gmp-devel mpfr mpfr-devel libmpc libmpc-devel zlib-devel libgo libgo-devel go g++
wget https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz
tar xf gcc-9.2.0.tar.xz
cd gcc-9.2.0
./configure --prefix=/usr --disable-multilib --with-system-zlib --enable-languages=c,c++,d,fortran,go,objc,obj-c++
make
gives:
make[4]: Leaving directory '/home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo'
make[3]: Leaving directory '/home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo'
make[2]: Leaving directory '/home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo'
make[2]: Entering directory '/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gotools'
/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gcc/gccgo -B/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gcc/ -B/usr/x86_64-pc-linux-gnu/bin/ -B/usr/x86_64-pc-linux-gnu/lib/ -isystem /usr/x86_64-pc-linux-gnu/include -isystem /usr/x86_64-pc-linux-gnu/sys-include -g -O2 -I ../x86_64-pc-linux-gnu/libgo -static-libstdc++ -static-libgcc -L ../x86_64-pc-linux-gnu/libgo -L ../x86_64-pc-linux-gnu/libgo/.libs -o go ../.././gotools/../libgo/go/cmd/go/alldocs.go ../.././gotools/../libgo/go/cmd/go/go11.go ../.././gotools/../libgo/go/cmd/go/main.go ../x86_64-pc-linux-gnu/libgo/libgotool.a
gccgo: error: ../x86_64-pc-linux-gnu/libgo/libgotool.a: No such file or directory
make[2]: *** [Makefile:821: go] Error 1
make[2]: Leaving directory '/home/mmalak/gcc-9.2.0/host-x86_64-pc-linux-gnu/gotools'
make[1]: *** [Makefile:14649: all-gotools] Error 2
make[1]: Leaving directory '/home/mmalak/gcc-9.2.0'
make: *** [Makefile:997: all] Error 2
Yet libgotool.a exists in /home/mmalak/gcc-9.2.0/x86_64-pc-linux-gnu/libgo/libgotool.a

I don't know if this is the reason but it is not recommended to configure and build gcc in the same directory of source code. Try:
cd ../
mkdir stage1-build && cd stage1-build
../gcc-9.2.0/configure --prefix=/usr --disable-multilib --with-system-zlib --enable-languages=c,c++,d,fortran,go,objc,obj-c++
make

Related

Problem installing libgcc from gcc source

I was trying to build & install GCC cross-compiler for arm-none-eabi, and got this error after running make install-target-libgcc, and I got this:
dingus#DingusPC:~/src/build-gcc$ make install-target-libgcc
/bin/bash ../gcc-11.2.0/mkinstalldirs /home/dingus/opt/gcc /home/dingus/opt/gcc
make[1]: Entering directory '/home/dingus/src/build-gcc/arm-none-eabi/libgcc'
make[1]: *** No rule to make target 'install'. Stop.
make[1]: Leaving directory '/home/dingus/src/build-gcc/arm-none-eabi/libgcc'
make: *** [Makefile:13220: install-target-libgcc] Error 2
The full list of commands I run is:
mkdir build-gcc
cd build-gcc
../gcc-11.2.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c --without-headers
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc
$PREFIX is set to /home/dingus/opt/gcc, and $TARGET is arm-none-eabi
Oddly enough, I have built it for i686-elf multiple times with no problem.
I was following a guide from https://wiki.osdev.org/GCC_Cross-Compiler

Compiling gcc 4.5.0 in red hat 7

Im having trouble to compile gcc 4.5.0 in red hat 7.
Im following the instructions from here ("The hard way", without libelf).
I use following versions:
# rpm -qa | grep -e libelf -e gmp -e mpfr -e mpc
mpfr-3.1.1-4.el7.x86_64
mpfr-devel-3.1.1-4.el7.x86_64
elfutils-libelf-0.170-4.el7.x86_64
elfutils-libelf-devel-0.170-4.el7.x86_64
gmp-6.0.0-15.el7.x86_64
libmpc-1.0.1-3.el7.x86_64
gmp-devel-6.0.0-15.el7.x86_64
While compiling, he doesnt find mpc.h:
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
So I compiled it.
Here is the working configure:
/opt/app/gcc/gcc-4.5.0_SOURCE/configure
--prefix=/opt/app/gcc-4.5.0
--enable-languages=c,c++,fortran
--enable-bootstrap
--enable-shared
--enable-threads=posix
--enable-checking=release
--with-system-zlib
--enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-gnu-unique-object
--with-mpc=/opt/app/gcc/tmp/
At the end of make I get this:
...
ar rc libgcc.a $objects
ranlib libgcc.a
make[5]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/x86_64-unknown-linux-gnu/32/libgcc'
make[4]: *** [multi-do] Error 1
make[4]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/x86_64-unknown-linux-gnu/libgcc'
make[3]: *** [all-multi] Error 2
make[3]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/x86_64-unknown-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make: *** [all] Error 2
After some research I found out, that texinfo was missing. Install texinfo got me to a new failure:
...
make[3]: *** [doc/gccint.info] Error 1
rm gcc.pod
make[3]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/opt/app/gcc/gcc-4.5.0_BUILD'
make: *** [all] Error 2
After some research I found here that texinfo has a bug. Now Im trying to compile texinfo 4.13a but again, I get into trouble with no clear error message.
Did anyone achieve to compile gcc 4.5.0 in redhat 7?
UPDATE
I can compile gcc 4.5.4, but ONLY IF texinfo is NOT installed ...
kind regards
Your errors 1. GCC requires a build directory outside the gcc-source/ https://gcc.gnu.org/install/configure.html
gcc-4.5.x cannot use the EL7 texinfo. Please install a texinfo from "the gcc-4.5 days" :
yum remove texinfo
yum install Downloads/texinfo-4.13a-10.fc14.x86_64.rpm
http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/14/Everything/x86_64/os/Packages/texinfo-4.13a-10.fc14.x86_64.rpm
GCC-4.5 : The bugfix version is 4.5.4 .
Note: The default build directory is $HOME/tmp/ (Or other dir. in $HOME). ... My build example :
cd gcc-4.5.4/
tar xvf mpfr-3.0.1.tar.xz
mv mpfr-3.0.1/ mpfr
tar xvf gmp-5.0.5.tar.xz
mv gmp-5.0.5/ gmp
tar xvf mpc-0.8.2.tar.gz
mv mpc-0.8.2/ mpc
cd ../
mkdir build-gcc45
cd build-gcc45/
../gcc-4.5.4/configure --prefix=/usr/local/gcc45 --program-suffix=45 --enable-clocale=gnu --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,fortran --disable-libstdcxx-pch --disable-multilib --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs
make
# make install
cd /usr/bin/
# ln -s /usr/local/gcc45/bin/gcc45
# ln -s /usr/local/gcc45/bin/g++45
# ln -s /usr/local/gcc45/bin/gfortran45
Using, examples : $ export CC=gcc45 CXX=g++45 FC=gfortran45 && ./configure .... .... $ CC=gcc45 CXX=g++45 FC=gfortran45 cmake ../
Result : "gcc45-c++-4.5.4-1.el7.x86_64.rpm" https://drive.google.com/file/d/15aRg-BPhuyaEyZA9Jy-iAyC21_pwN7nD/view?usp=sharing
Example with the older gcc-4.5.0 :
$ cd build-gcc450/
$ ../gcc-4.5.0/configure --prefix=/opt/app/gcc-4.5.0 --program-suffix=450 --enable-clocale=gnu --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,fortran --disable-libstdcxx-pch --disable-multilib --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs
$ make -j4
# make install ( No errors at all )
https://www.dropbox.com/s/45kfetdjj9lif66/gcc450-configure-opt.txt?dl=0
... More examples → https://drive.google.com/drive/folders/1j7qE9YKTT313B5VBg3kevzCNiykGkonO?usp=sharing

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

Errors occuring when make-ing Aircrack-ng on raspberry pi

As it can be seen in the log I have some errors when trying to compile Aircrack on my Raspberry pi B+ running latest raspbian. I can't manage to find out what's wrong.
(I have also installed libnl)
make -C src all
make[1]: Entering directory '/home/pi/aircrack-ng-1.2-rc1/src'
gcc -g -W -Wall -O3 -D_FILE_OFFSET_BITS=64 -D_REVISION=0
-DCONFIG_LIBNL30 -DCONFIG_LIBNL -I/usr/include/libnl3
-Wno-unused-but-set-variable -Wno-array-bounds -Iinclude wpaclean.o
osdep/radiotap/radiotap.o -o wpaclean -Losdep -losdep -lnl-genl-3
-lnl-3
/usr/bin/ld: cannot find -lnl-genl-3
collect2: ld returned 1 exit status
Makefile:189: recipe for target 'wpaclean' failed
make[1]: *** [wpaclean] Error 1
make[1]: Leaving directory '/home/pi/aircrack-ng-1.2-rc1/src'
Makefile:25: recipe for target 'all' failed
make: *** [all] Error 2
Thanks
sudo apt-get install libnl-3-dev
sudo ln -s /lib/arm-linux-gnueabihf/libnl-genl-3.so.200 /lib/arm-linux-gnueabihf/libnl-genl-3.so
You have installed libnl-3-dev but it doesn't create proper library link.
Try "sudo make" and "sudo make install"
You also might need to install the libssl-dev package if you havent done so already.

make install permission denied even with --prefix passed to configure

I am trying to install gcc (a branch of gcc, not the trunk in the svn), and I configured it with:
./configure --prefix=/home/user/myroot/ --enable-languages=c,c++ \
--disable-multilib --libexecdir=/usr/lib --without-included-gettext \
--enable-threads=posix --disable-werror --with-arch-32=i486 \
--with-tune=generic --enable-checking=release --build=i486-linux-gnu \
--host=i486-linux-gnu --target=i486-linux-gnu
/home/user/myroot is a directory that exists.
When I run make, it builds gcc fine.
However, when I do make install, this is what I get:
make[1]: Entering directory `/home/user/gcc/gcc-cjung'
/bin/bash ./mkinstalldirs /home/user/myroot /home/user/myroot
make[2]: Entering directory `/home/user/gcc/gcc-cjung/host-i486-linux-gnu/fixincludes'
rm -rf /usr/lib/gcc/i486-linux-gnu/4.5.0/install-tools
/bin/bash ../.././fixincludes/../mkinstalldirs /usr/lib/gcc/i486-linux-gnu/4.5.0/install-tools
mkdir -p -- /usr/lib/gcc/i486-linux-gnu/4.5.0/install-tools
mkdir: cannot create directory `/usr/lib/gcc/i486-linux-gnu/4.5.0': Permission denied
make[2]: *** [install] Error 1
make[2]: Leaving directory `/home/user/gcc/gcc-cjung/host-i486-linux-gnu/fixincludes'
make[1]: *** [install-fixincludes] Error 2
make[1]: Leaving directory `/home/user/gcc/gcc-cjung'
make: *** [install] Error 2
Why does it still want to copy stuff to /usr/lib when I specified the prefix to be /home/user/myroot?
Btw, I am using Ubuntu 9.10 if that matters. I have already installed build-essential, gawk, flex, bison, and libmpfr.
Why did you set the libexecdir to /usr/lib? That means it will have to install things into /usr/lib, a directory to which you cannot write.
You probably want --libexecdir=/home/user/myroot/usr/lib

Resources