sci-libs/tensorflow 2.2.0 fails to build on amd64 with error ERROR: /var/tmp/portage/sci-libs/tensorflow-2.2.0/work/tensorflow-2.2.0-python3_7/tensorflow/cc/BUILD:517:1: Linking of rule '//tensorflow/cc:ops/manip_ops_gen_cc' failed (Exit 1) /usr/bin/ld: /usr/lib64/libjsoncpp.so.22: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()@GLIBCXX_3.4.26' collect2: error: ld returned 1 exit status Reproducible: Always Steps to Reproduce: USE="cuda python -mpi -xla" emerge -av "sci-libs/tensorflow-2.2.0::gentoo" # emerge -pqv '=sci-libs/tensorflow-2.2.0::gentoo' sci-libs/tensorflow-2.2.0 USE="cuda python -mpi -xla" CPU_FLAGS_X86="avx avx2 fma3 sse sse2 sse3 sse4_1 sse4_2 -fma4" PYTHON_TARGETS="python3_6 python3_7" Another seemingly jsoncpp related error. Also see https://bugs.gentoo.org/721338 This was tested with dev-libs/jsoncpp 1.9.2-r2 (ebuild linked in the issue above), 1.9.3_pre20200412 and 1.9.3, all causing the same error.
Created attachment 646070 [details] emerge --info '=sci-libs/tensorflow-2.2.0::gentoo'
Created attachment 646072 [details] build.log.gz
You need to re-emerge dev-libs/jsoncpp.
I am pretty sure the tensorflow maintainers cannot help you with this.
As written above I have tested this with jsoncpp 1.9.2-r2, 1.9.3 and 1.9.3_pre20200412 which have all been re-emerged specifically before building tensorflow. Are you saying this is a bug in jsoncpp?
I believe it comes from having jsoncpp compiled with a newer version of gcc than what is used for tensorflow. I get the same bug when jsoncpp is compiled with gcc 10 and it disappears when I compile it with gcc 8.
I have the same problem. With GCC8, "nm -C /usr/lib64/debug/usr/lib64/libjsoncpp.so.24.debug |grep basic_ostringstream" says I have: U std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::str() const@@GLIBCXX_3.4.21 U std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)@@GLIBCXX_3.4.21 U std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()@@GLIBCXX_3.4.21 With GCC9 and GCC10, nn says: U std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::str() const@@GLIBCXX_3.4.21 U std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream()@@GLIBCXX_3.4.26 U std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()@@GLIBCXX_3.4.21 I keep you in touch if I found something.
I was trying to compile tensorflow with GCC10.0 with glibc compiled with GCC8.0 and jsoncpp with GCC10.0. I'm recompiling glibc then tensorflow with GCC10. Tensorflow takes days to compile on my computer. I keep you in touch if it solves the problem.
It was not glibc the problem :(
Go it ! In the log, I have: * TensorFlow is being built with Nvidia CUDA support. Your default compiler * version is not supported by the currently installed CUDA. TensorFlow will * instead be compiled using: /usr/x86_64-pc-linux-gnu/gcc-bin/8.4.0/x86_64-pc-linux-gnu-gcc.
Yeah this is a jsoncpp or gcc issue, not TensorFlow. The CUDA 10.x requires gcc-8 not gcc9. and if jsoncpp is built with gcc9 and then TF is built with gcc-8 (which it will if cuda is enabled) then you get this error. The fix is to switch your compiler to gcc8 then rebuild jsoncpp then switch back. Or you can use package.env to set the compiler per-package. something like this: # cat /etc/portage/package.env/tensorflow dev-libs/jsoncpp gcc8.conf # cat /etc/portage/env/gcc8.conf CC="x86_64-pc-linux-gnu-gcc-8.4.0" CXX="x86_64-pc-linux-gnu-g++-8.4.0" Just remember to remove the package.env stuff when you switch to cuda11, that will support the newer compiler.