Compiling GCC 4.8.4 Error (CXX_ABI 1.3.8) - linux

I'm trying to compile GCC version 4.8.4 using the following configuration parameters:
--prefix=<path to gcc src> --enable-languages=c,c++ --build=x86_64-linux-gnu
However, when I try to make I get the following error:
make[5]: Entering directory '/DIR/gcc/objdir/x86_64-linux
gnu/libstdc++-v3/po'
msgfmt -o de.mo ../../../../libstdc++-v3/po/de.po
msgfmt -o fr.mo ../../../../libstdc++-v3/po/fr.po
msgfmt: /DIR/gcc/objdir/x86_64-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6: version CXXABI_1.3.8 not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)
Makefile:460: recipe for target fr.mo failed
make[5]: *** [fr.mo] Error 1
make[5]: *** Waiting for unfinished jobs....
msgfmt: /DIR/gcc/objdir/x86_64-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6: version CXXABI_1.3.8 not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)
Try 1: I've tried setting LD_LIBRARY_PATH to /usr/lib/x86_64-linux-gnu/:/usr/lib/lib32/. Yet it does not seem to work.
Try 2: I've tried changing the GCC version used to compile it. I've used versions 4.7, 4.5, and 5. This also does not seem to work.
It seems that when compiling GCC, the wrong libstdc++.so.6 is pull?
Any ideas or aclarations are welcome.
PS: I'm using Ubuntu 16.04 and Linux kernel 4.4.0-62

Building gcc-4.8.4 : Unpack mpfr-3.1.3.tar.xz, gmp-6.1.0.tar.xz, mpc-1.0.3.tar.gz into gcc-4.8.4/. Rename to have gcc-4.8.4/{mpfr/, gmp/, mpc/}.
gcc requires a build directory outside gcc-4.8.4/ : mkdir build-gcc
! If you configured inside gcc-4.8.4/, you will have to delete gcc-4.8.4/, and start from scratch.
cd build-gcc/
../gcc-4.8.4/configure --prefix=/usr/local/gcc484 --program-suffix=484 --enable-clocale=gnu --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++ --disable-multilib --disable-libstdcxx-pch --with-mpfr-include=$(pwd)/../gcc-4.8.4/mpfr/src --with-mpfr-lib=$(pwd)/mpfr/src/.libs
make
gcc-4.8.4 can be built with Ubuntu 14.04, not 16.04 . Result: gcc48-c++_4.8.4-2ubuntu14_amd64.deb (24.4MB) https://drive.google.com/file/d/0B7S255p3kFXNeWI3N1E2MXdrVm8/view?usp=sharing
Ubuntu 16.04 : gcc48, g++48 were tested with some applications, one has 400 c++ files : OK.
No dependencies, install with sudo dpkg -i gcc48-c++_4.8.4-2ubuntu14_amd64.deb Provides /usr/local/bin/{ gcc48, g++48 }

Related

Micronucleus does not update

I'm trying to upgrade my micronuclues to upload my code to digispark,but when I try to upgrade that happens:
Building command line tool: micronucleus...
gcc -Ilibrary -O -g -D LINUX -o micronucleus micronucleus.c micronucleus_lib.o littleWire_util.o -static -L/usr/lib/x86_64-linux-gnu -lusb
/usr/bin/ld: cannot find -lusb
collect2: error: ld returned 1 exit status
make: *** [Makefile:61: micronucleus] Error 1
I'm a little confused as to how you've gotten it compiling but not linking because, at least on Debian based distributions, the header file that would be needed during compiling is provided by the same package that provides the libusb.a that it is failing to link against.
If you are on a Debian based distro, try (re)installing libusb-dev:
sudo apt install libusb-dev
This is what I've built it against locally.
If you have a libusb.a and it's not in /usr/lib/x86_64-linux-gnu, then you'd need a different directory supplied to -L.

Compile an old Linux kernel on Ubuntu 16.04 LTS

I tried to compile the Linux kernel 3.10.31 on Ubuntu 16.04 LTS.
I used to compile the exact same kernel on Ubuntu 12.04 LTS, and everything works well.
On Ubuntu 16.04, the gcc version is gcc-5;
On Ubuntu 12.04, the gcc version is gcc-4.6.
It seems that the Linux kernel kernel before 3.18 cannot compile with the gcc-5. The kernel 3.10.31 reports the following error when it is compiled by make
fatal error: linux/compiler-gcc5.h: No such file or directory
I tried to install gcc-4.7 onto Ubuntu 16.04 and change the /usr/bin/gcc to point to the gcc-4.7. This could solve the above error. However, it leads to new issues after I run make
$linux/arch/x86/Makefile:98: stack protector enabled but no compiler support
make[1]: Nothing to be done for 'all'.
make[1]: Nothing to be done for 'relocs'.
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CC kernel/bounds.s
gcc-4.7.real: error: unrecognized command line option ‘-no-pie’
linux/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:835: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
My question is:
Is there a neat way to use the old compiling chain to compile the old kernel 3.10.31 on Ubuntu 16.04?
Thank you very much for your help! Any advice is really appreciated.
I think I figured out a solution.
We don't have to install the old version gcc. We only need to copy the file compiler-gcc5.h from here or from here into include/linux/. It will solve the compilation issue.
Ubuntu 16.04 now still supports gcc-4.7 so you can install it and then you can choose the version of gcc before using it by update-alternatives.
For examples:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50
sudo update-alternatives --config gcc # here you choose by hint
If you directly download compiler-gcc5.h, you may meet problems like arch/x86/kvm/svm.c error invalid character that I met when compiling 3.3.8 in Ubuntu 16.04.3 x64.
Open the Makefile, look for CFLAGS_EXTRA and add the following option to it -fno-pie.
See, https://askubuntu.com/questions/851433/kernel-doesnt-support-pic-mode-for-compiling.

Can't build cross compiler

I can't seem to build Rust as a cross-compiler, either on Windows with MSYS2 or on a fresh install of Debian Wheezy. The error is the same for both. I run this configure:
./configure --target=arm-unknown-linux-gnueabihf,x86_64-pc-windows-gnu
make works, but then make install fails with:
[...]
prepare: tmp/dist/rustc-1.0.0-dev-x86_64-pc-windows-gnu-image/bin/rustlib/x86_64-pc-windows-gnu/lib/rustdoc-*.dll
prepare: tmp/dist/rustc-1.0.0-dev-x86_64-pc-windows-gnu-image/bin/rustlib/x86_64-pc-windows-gnu/lib/fmt_macros-*.dll
prepare: tmp/dist/rustc-1.0.0-dev-x86_64-pc-windows-gnu-image/bin/rustlib/x86_64-pc-windows-gnu/lib/libmorestack.a
prepare: tmp/dist/rustc-1.0.0-dev-x86_64-pc-windows-gnu-image/bin/rustlib/x86_64-pc-windows-gnu/lib/libcompiler-rt.a
compile: arm-unknown-linux-gnueabihf/rt/arch/arm/morestack.o
make[1]: arm-linux-gnueabihf-gcc: Command not found
/home/Sandro/rust/mk/rt.mk:94: recipe for target 'arm-unknown-linux-gnueabihf/rt/arch/arm/morestack.o' failed
make[1]: *** [arm-unknown-linux-gnueabihf/rt/arch/arm/morestack.o] Error 127
make[1]: Leaving directory '/home/Sandro/rust'
/home/Sandro/rust/mk/install.mk:22: recipe for target 'install' failed
make: *** [install] Error 2
Everything builds fine if I don't specify a cross architecture. Am I missing some special configure flag to make this work?
The error message says that make did not find the arm-linux-gnueabihf-gcc binary, which is supposed to be a C compiler producing ARM code. That means that you probably don't have any ARM C cross-compilation toolchain installed.
I know Ubuntu has packages for cross compilers (gcc-arm-linux-gnueabihf in 14.04) so Debian may have the same packages. You can also find fully packaged ARM C cross-compilers for Windows and Linux on the Linaro website. If you are building for the Rapsberry Pi, you can also find toolchains to build for Raspbian and Archlinux on https://github.com/raspberrypi/tools.
Here is an example under Linux with a Linaro toolchain (should be distribution-agnostic for the host)
$ wget http://releases.linaro.org/14.11/components/toolchain/binaries/arm-linux-gnueabihf/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz
$ tar -xf gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf.tar.xz
$ export PATH=$PATH:$PWD/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin
$ cd <your_configured_rustc_build_directory>
$ make
You can then use the cross compiler with the following line. You can provide the full path to the arm-linux-gnueabihf-gcc binary if you don't want to put it in your PATH.
rustc --target=arm-unknown-linux-gnueabihf -C linker=arm-linux-gnueabihf-gcc hello.rs
If you are using Cargo, you can specify the linker to use for each target in the .cargo/config with this option:
[target.arm-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

ARM-GCC build error under Fedora 21

I'm trying to build GCC for ARM under Fedora 21 but 4.6.4 and 4.9.2 fails with same error:
checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
Makefile:8200: recipe for target 'configure-zlib' failed
I follow this guide: http://www.kunen.org/uC/gnu_tool.html
Can't understand, what I'm doing wrong?
P.S. configure command:
../../src/gcc-4.9.2/configure --target=arm-none-eabi --prefix=$MYTOOLS --enable-interwork --enable-multilib --enable-languages="c,c++" --with-newlib --with-headers=../../src/newlib-1.20.0/newlib/libc/include/
if you have zlib installed on this system, you could try adding --with-system-zlib to the configure command you're using.

"cannot find -lreadline" error when compiling Lua

This should be a pretty straightforward issue -- I'm trying to compile Lua (or rather lua-vec, which is a minor variant) on a CentOS Linux install, and I get the following error:
[jt#flyboy src]#make linux
make all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
make[1]: Entering directory `/jt/flyboy/fly/lua/lua-vec/src'
gcc -o lua lua.o liblua.a -lm -Wl,-E -ldl -lreadline -lhistory -lncurses
/usr/bin/ld: cannot find -lreadline
collect2: ld returned 1 exit status
make[1]: *** [lua] Error 1
That would suggest the readline lib is not installed. But...
[jt#flyboy src]#ls /usr/lib/libreadline*
/usr/lib/libreadline.so.5 /usr/lib/libreadline.so.5.1
Interestingly, if I rearrange the order of readline/history/ncurses, whichever is first triggers the same error, so I suspect that this is some sort of a folder-specification problem, not a missing library problem.
Any ideas?
yum install readline-devel.x86_64 readline-devel.i386 ncurses-devel.i386 ncurses-devel.x86_64
seems to have done the trick! The odd thing is I have compiled this before without these libs... but enough time pondering life's mysteries...
libreadline is not enough, it will give you libraries related to readline. You need libreadline-dev for compiling package which depends upon readline like in above case.
In Red Hat like distros, name of package is readline-devel
Following command will do the trick in such environment:
$ yum install -y readline-devel
If somebody has this issue in ubuntu/debian:
sudo apt-get install libreadline-dev

Resources