Error loading shared library libstdc++.so.6: No such file or directory


(Bo Zhang) #1

When I was using gradlew in a docker container of kubernetes, I got error message as follow:

net.rubygrapefruit.platform.NativeException: Failed to load native library ‘libnative-platform.so’ for Linux amd64.
at net.rubygrapefruit.platform.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:49)
at net.rubygrapefruit.platform.Native.init(Native.java:55)
at org.gradle.internal.nativeintegration.services.NativeServices.initialize(NativeServices.java:70)
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:73)
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:34)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:85)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:45)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:62)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:67)
Caused by: java.lang.UnsatisfiedLinkError: /root/.gradle/native/21/linux-amd64/libnative-platform.so: Error loading shared library libstdc++.so.6: No such file or directory (needed by /root/.gradle/native/21/linux-amd64/libnative-platform.so)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at net.rubygrapefruit.platform.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:45)
… 8 more

My container has “privileged=true” enabled, and I tried gradle 2.13 and 3.1 but neither of them worked.

Is there an issue with the docker image?

Thank you very much.


(Daniel Lacasse) #2

It looks like your container may not have the correct std runtime library. I would argue that the Kubernetes containers may be set up in a minimalistic way that happens to not have the runtime required by Gradle. It is an external factor to Gradle and should be solved at the container level.

An actionable step you could do is take a look into what kind of C++ runtime is available by default.


(Bo Zhang) #3

Yes, you’re right. It was solved after I installed python and nodejs. Thank you!