GoogleCloudPlatform/professional-services

UnsatisfiedLinkError: libstdc++.so.6: cannot open shared object file:

saikrishnab27 opened this issue · 2 comments

Did you see similar issue before or is it specific to my Cloudtop?
Thank you in Advance.
1.I'm trying to run the code from google linux Cloudtop, tried to troubleshoot for few days but not able to understand the issue:

Error::
Exception in thread "main" java.util.ServiceConfigurationError: com.google.zetasql.ClientChannelProvider: Provider com.google.zetasql.JniChannelProvider could not be instantiated
        at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:583)
        at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:805)
        at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:723)
        at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1397)
        at com.google.zetasql.ClientChannelProvider.loadChannel(ClientChannelProvider.java:31)
        at com.google.zetasql.Client.getStub(Client.java:29)
        at com.google.zetasql.LanguageOptions.getDefaultFeatures(LanguageOptions.java:57)
        at com.google.zetasql.LanguageOptions.<init>(LanguageOptions.java:65)
        at com.google.zetasql.ZetaSQLBuiltinFunctionOptions.<init>(ZetaSQLBuiltinFunctionOptions.java:46)
        at com.pso.bigquery.optimization.catalog.CatalogUtils.createEmptyCatalog(CatalogUtils.java:53)
        at com.pso.bigquery.optimization.BuildCatalogBasedOnQueryAndAnalyzeJoins.main(BuildCatalogBasedOnQueryAndAnalyzeJoins.java:41)
**Caused by: java.lang.UnsatisfiedLinkError: /tmp/nativeutils7412363731141/liblocal_service_jni.so: libstdc++.so.6: cannot open shared object file: No such file or directory**
        at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
        at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2447)
        at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2503)
        at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2721)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2632)
        at java.base/java.lang.Runtime.load0(Runtime.java:769)
        at java.base/java.lang.System.load(System.java:1840)
        at com.google.zetasql.cz.adamh.utils.NativeUtils.loadLibraryFromJar(NativeUtils.java:109)
        at com.google.zetasql.JniChannelProvider.<clinit>(JniChannelProvider.java:66)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:781)
        ... 9 more

trials::
tried to install/update libstdc++.so.6, but the system saying we already have latest version

lib32stdc++6 is already the newest version (12.2.0-10).
lib32stdc++6 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

tried few other resolutions but not able to fix it
gave full permissions (777) to the libstdc++.so.6 file in /usr/lib32 location
copied the file to /usr/lib64 location with full permissions..etc

ZetaSQL dynamically links to a few system libraries during initialization, including libstdc++. In general, you don't need to tweak the installation for these libraries (and probably shouldn't 😅). You can check what libraries are available on a linux system using ldconfig -p.

For this issue in particular, the key to fix it is making sure your java process can dynamically link to libstdc++. If it doesn't work out of the box, It should usually be a matter of setting the system property java.library.path in such a way that it includes the directory where the library is installed.

If getting dynamic linking to work is a problem, I'd recommend working on containers using Jib. That makes it very easy to run ZetaSQL-based applications.

The ZetaSQL Toolkit has also been moved to GoogleCloudPlatform/zetasql-tookit and has been released through Maven central. Please share any further questions or issues over on that repository!

Thanks for looking into this Pablo