Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 729440 - sci-libs/tensorflow-2.2.0 - 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
Summary: sci-libs/tensorflow-2.2.0 - ld: /usr/lib64/libjsoncpp.so.22: undefined refere...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Jason Zaman
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-24 13:08 UTC by Conrad
Modified: 2020-10-09 03:49 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info '=sci-libs/tensorflow-2.2.0::gentoo' (info.log,6.85 KB, text/plain)
2020-06-24 13:09 UTC, Conrad
Details
build.log.gz (emerge-build.log.gz,214.11 KB, application/gzip)
2020-06-24 13:11 UTC, Conrad
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Conrad 2020-06-24 13:08:23 UTC
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.
Comment 1 Conrad 2020-06-24 13:09:50 UTC
Created attachment 646070 [details]
emerge --info '=sci-libs/tensorflow-2.2.0::gentoo'
Comment 2 Conrad 2020-06-24 13:11:08 UTC
Created attachment 646072 [details]
build.log.gz
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2020-06-26 08:49:23 UTC
You need to re-emerge dev-libs/jsoncpp.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2020-06-26 08:50:55 UTC
I am pretty sure the tensorflow maintainers cannot help you with this.
Comment 5 Conrad 2020-06-26 11:25:11 UTC
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?
Comment 6 blacknfuzzy 2020-06-29 09:00:27 UTC
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.
Comment 7 LE GARREC Vincent 2020-07-04 01:17:07 UTC
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.
Comment 8 LE GARREC Vincent 2020-07-04 01:45:55 UTC
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.
Comment 9 LE GARREC Vincent 2020-07-04 08:22:51 UTC
It was not glibc the problem :(
Comment 10 LE GARREC Vincent 2020-07-04 08:36:45 UTC
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.
Comment 11 Jason Zaman gentoo-dev 2020-10-09 03:49:57 UTC
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.