tensorflow: TF 1.5.0 Java API broken in Ubuntu 14.04: `GLIBCXX_3.4.20' not found

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 14.04
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 1.5.0
  • Python version: N/A
  • Bazel version (if compiling from source): N/A
  • GCC/Compiler version (if compiling from source): N/A
  • CUDA/cuDNN version: N/A
  • GPU model and memory: N/A
  • Exact command to reproduce: N/A

Describe the problem

The 1.5.0 Java API fails at runtime on Ubuntu 14.04 (after working okay for 1.3/1.4) on the hello world example. I originally noticed this behavior in CentOS 7; I’m reporting this as a bug for Ubuntu 14.04 because it is officially supported in the docs and the error appears to be the same.

Possibly related to #15777, in which case the solution may just be to build libtensorflow_jni.so on Ubuntu 14. Thanks in advance for looking into this!

Source code / logs

  1. (Optionally) use docker container with Java 8 and Maven: docker pull goyalzz/ubuntu-java-8-maven-docker-image docker run -it goyalzz/ubuntu-java-8-maven-docker-image:latest bash
  2. Follow instructions in official Java API Maven example.
  3. Upon Step 3 of above ( mvn -q compile exec:java), observe the following error:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project hellotf: An exception occured while executing the Java class. /tmp/tensorflow_native_libraries-1518205710861-0/libtensorflow_jni.so: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /tmp/tensorflow_native_libraries-1518205710861-0/libtensorflow_jni.so) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

1.6.0-rc1 will not support 14.04, but we will try to support it in 1.6.0 official.

I would appreciate it if you would reconsider for the same reasons it was reconsidered in #15777. We are happily using the java API on CentOS 7. This version upgrade to TF effectively means we need to rebuild these artifacts and deploy the associated (non-trivial) build chain.

I have the exact same problem with TF Java 1.5.0 on Red Hat Enterprise Linux 7 and CentOS 7. TF 1.4.0 Java worked fine before.

$ cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
$ uname -a 
Linux adam 3.10.0-693.17.1.el7.x86_64 #1 SMP Thu Jan 25 20:13:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ rpm -qf /lib64/libstdc++.so.6
libstdc++-4.8.5-16.el7_4.1.x86_64
$ file /lib64/libstdc++.so.6.0.19 
/lib64/libstdc++.so.6.0.19: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=ecd3167b42e7d9035fe94a5276cf1d21dd00a462, stripped
$ mvn -q compile exec:java
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project hellotf: An exception occured while executing the Java class. /tmp/tensorflow_native_libraries-1518364937142-0/libtensorflow_jni.so: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /tmp/tensorflow_native_libraries-1518364937142-0/libtensorflow_jni.so) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Unfortunately, this is the newest version of RHEL/CentOS (there is no 8 yet, not even beta).

Python TF 1.5.0 (tensorflow-1.5.0-cp27-cp27mu-manylinux1_x86_64.whl) works just fine on RHEL/CentOS7, so this seems specific to TF Java.

We can try looking into building this with ubuntu 14.04 We can work together on Monday to come up with a solution.