bell-sw / Liberica

Free and 100% open source Progressive Java Runtime for modern Java™ deployments supported by a leading OpenJDK contributor
https://bell-sw.com/pages/libericajdk/
GNU General Public License v2.0
325 stars 28 forks source link

What is the reason libstdc++ is only included in the amd64 image? #173

Open sabretus opened 5 months ago

sabretus commented 5 months ago

Hello,

Is there any specific reason that libstdc++ is only included in the amd64 architecture?

I mean this if section https://github.com/bell-sw/Liberica/blob/master/docker/repos/liberica-openjdk-alpine/17/Dockerfile#L93-L103

Thanks

sabretus commented 5 months ago

We are using async-profiler which depends on libstdc++ and for amd64 it works fine but for aarch64 we need to install libstdc++ with apk and it crashes with the following stacktrace:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000e351b38df33c, pid=7, tid=3046
#
# JRE version: OpenJDK Runtime Environment (17.0.11+10) (build 17.0.11+10-LTS)
# Java VM: OpenJDK 64-Bit Server VM (17.0.11+10-LTS, mixed mode, tiered, compressed oops, compressed class ptrs, serial gc, linux-aarch64)
# Problematic frame:
# C  [libstdc++.so.6+0x1eb33c]
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /service/core.7)
#
# An error report file with more information is saved as:
# /tmp/hs_err_pid7.log
#
# If you would like to submit a bug report, please visit:
#   https://bell-sw.com/support
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Profiling started
cfredri4 commented 1 month ago

This also means that Kafka Streams does not work for arm/aarch64 because of it's usage of RocksDB which uses libstdc++.

Exception in thread "redacted-GlobalStreamThread" java.lang.UnsatisfiedLinkError: /tmp/librocksdbjni5425207943908687501.so: libstdc++.so.6: cannot open shared object file: No such file or directory
2024-10-17 11:28:48     at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
2024-10-17 11:28:48     at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(Unknown Source)
2024-10-17 11:28:48     at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
2024-10-17 11:28:48     at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(Unknown Source)
2024-10-17 11:28:48     at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
2024-10-17 11:28:48     at java.base/java.lang.Runtime.load0(Unknown Source)
2024-10-17 11:28:48     at java.base/java.lang.System.load(Unknown Source)
2024-10-17 11:28:48     at org.rocksdb.NativeLibraryLoader.loadLibraryFromJar(NativeLibraryLoader.java:107)
2024-10-17 11:28:48     at org.rocksdb.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:87)
2024-10-17 11:28:48     at org.rocksdb.RocksDB.loadLibrary(RocksDB.java:73)
2024-10-17 11:28:48     at org.rocksdb.DBOptions.newDBOptionsInstance(DBOptions.java:1237)
2024-10-17 11:28:48     at org.rocksdb.DBOptions.<init>(DBOptions.java:27)
2024-10-17 11:28:48     at org.apache.kafka.streams.state.internals.RocksDBStore.openDB(RocksDBStore.java:193)
2024-10-17 11:28:48     at org.apache.kafka.streams.state.internals.RocksDBStore.init(RocksDBStore.java:169)
2024-10-17 11:28:48     at org.apache.kafka.streams.state.internals.WrappedStateStore.init(WrappedStateStore.java:71)
2024-10-17 11:28:48     at org.apache.kafka.streams.state.internals.CachingKeyValueStore.init(CachingKeyValueStore.java:113)
2024-10-17 11:28:48     at org.apache.kafka.streams.state.internals.WrappedStateStore.init(WrappedStateStore.java:71)
2024-10-17 11:28:48     at org.apache.kafka.streams.state.internals.MeteredKeyValueStore.lambda$init$3(MeteredKeyValueStore.java:151)
2024-10-17 11:28:48     at org.apache.kafka.streams.processor.internals.metrics.StreamsMetricsImpl.maybeMeasureLatency(StreamsMetricsImpl.java:872)
2024-10-17 11:28:48     at org.apache.kafka.streams.state.internals.MeteredKeyValueStore.init(MeteredKeyValueStore.java:151)
2024-10-17 11:28:48     at org.apache.kafka.streams.processor.internals.GlobalStateManagerImpl.initialize(GlobalStateManagerImpl.java:138)
2024-10-17 11:28:48     at org.apache.kafka.streams.processor.internals.GlobalStateUpdateTask.initialize(GlobalStateUpdateTask.java:77)
2024-10-17 11:28:48     at org.apache.kafka.streams.processor.internals.GlobalStreamThread$StateConsumer.initialize(GlobalStreamThread.java:249)
2024-10-17 11:28:48     at org.apache.kafka.streams.processor.internals.GlobalStreamThread.initialize(GlobalStreamThread.java:416)
2024-10-17 11:28:48     at org.apache.kafka.streams.processor.internals.GlobalStreamThread.run(GlobalStreamThread.java:279)