TensorFlow build fails with `GLIBCXX_3.4.20' not found - gcc

Building TensorFlow with gcc version 4.8.5 or 5.4.0 gives an error:
bazel-out/host/bin/external/protobuf/protoc: /lib64/libstdc++.so.6:
version `GLIBCXX_3.4.20' not found (required by
bazel-out/host/bin/external/protobuf/protoc)
Tried to add linker flags in CROSSTOOL.tpl file in Tensorflow, however it didn't help.

You built your app with version of GCC that's newer than your host GCC. So your app uses symbols which are not present in host libstdc++ which causes runtime linker to fail.
You can solve this by linking your app with -Wl,-rpath,path/to/new/libs or setting LD_LIBRARY_PATH appropriately.

Related

Targetting an older version of libstdc++ with recent GCC when cross-copiling to an embedded-linux ARM device

We need to find a cross-compilation toolchain for an ARM embedded linux target that satisfies the following criteria:
Kernel 3.17
GLIBC 2.18
Recent version of GCC is required to compile some third-party code
Those requirements brought me to generate a custom cross-compilation toolchain using crosstool-ng. I selected the min kernel version, min glibc version and it seemed to work well until I tried to compile code containing C++.
Because the new GCC is using a more recent libstdc++ than what is available on the target, the executable won't run and we get an error like this:
/usr/lib/libstdc++.so.6: version `CXXABI_1.3.9' not found
The code compiled fine with an older version of GCC.
Looking at the configuration options for crosstool-ng I didn't find anything that would let me change the min libstdc++ version, like for glibc.
Is there a way to target an older libstdc++ version without downgrading GCC?
Can I use the headers and libstdc++.so files from the target to replace the ones GCC is using when cross-compiling?

GLIBCXX_3.4.26 not found on centos

I am facing this issue on centos:-
/lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found
Gcc version i have is :- gcc version 7.2.0 (GCC)
How can i install GLIBCXX_3.4.26 on centos 7.8?
You need to build your application using the system compiler or GCC from Developer Toolset. Developer Toolset uses a hybrid linkage model which avoids these errors. This functionality is likely missing from your custom build of GCC.

How to set custom gcc when using gdb

I have a program that is build with a different version of the GCC than the one on the system. When I try to debug the program using GDB, I am getting errors like
libstdc++.so.6: version `GLIBCXX_3.4.20' not found
libstdc++.so.6: version `CXXABI_1.3.8' not found
libstdc++.so.6: version `GLIBCXX_3.4.21' not found
But when I build and run the executable, I get no errors.
It seems that GDB is using a different libstdc++ than the one used when building. Is there a possibility to tell GDB what libs to use ?
At build, using Makefile, there are some variables set that say what g++ to use, so it will be not the one on the system

GLIBC_2.11' not found (required by /path_name/bin/gfortran)

I already have GCC and Gfortran installed. It is gcc version 4.1.2 20080704 (Red Hat 4.1.2-52). However, I am trying to install a more recent gfortran compiler. Here is what I did so far. From the http://gfortran.meteodat.ch/download/x86_64/ I downloaded the nightly "gcc-trunk.tar.xz" and I extracted it into the directory "opt." This created the directory "gcc-trunk". I then downloaded the "gcc-5-infrastructure.tar.xz" and extracted it into "gcc-trunk." I then input
PATH="$HOME/gcc-trunk/bin":$PATH
MANPATH="$HOME/gcc-trunk/share/man"
LD_LIBRARY_PATH="$HOME/gcc-trunk/lib64":"$HOME/gcc-trunk/lib":$LD_LIBRARY_PATH
on bash. I then tried to verify whether gfortran installed correctly with
/path_name/gfortran -v
However, I get the message GLIBC_2.11' not found (required by /path_name/bin/gfortran). I am not sure what is the problem. What should I do?
The gfortran binary you downloaded was built against a newer version of glibc than the one you have installed on your system.
You can solve this problem e.g. by
Acquiring a gfortran binary built against an older version of glibc
Building GCC from source
Upgrade to a newer distro with a newer glibc

Building Qt 4.8.1 from src on MacOS using gcc 4.5

I have a question about building Qt SDK 4.8.1 using gcc on Mac. I need to use gcc 4.5 or higher, so I installed mp-gcc45 package using macports (so tried with mp-gcc47), selected this version of gcc, so
gcc -v
Says me that gcc version 4.5.4 (MacPorts gcc45 4.5.4_6)
So I downloaded QtSDK src from official site, configure it and there is an error at first step:
cc1plus: error: unrecognized command line option "-fconstant-cfstrings"
Maybe its stupid solution, but I remove this flags from configure file, so I get a error after make call:
g++: unrecognized option '-Xarch_x86_64'
Can you give me an advice, how to build Qt using this version of gcc?
Non-Apple gcc will never work with Qt of any version. Only Apple gcc recognizes those Apple flavored compiler options.
You are stuck with gcc 4.2 on Mac. There's no way around it.

Resources