Hello,
I would like to use Kotlin as native language. So, I create a simple file and invoke a compiler:
$ kotlinc-native -version
Current kotlin-native dir: /nix/store/<hash>-kotlin-native-2.2.21
New writeable kotlin-native dir: /tmp/tmp.tvikhlq2fN
info: kotlinc-native 2.2.21 (JRE 21.0.9+8-nixos)
Kotlin/Native: 2.2.21
But the compiler crashed for no known reason
$ kotlinc-native Main.kt -o main
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007faf7e9da413, pid=44073, tid=44075
#
# JRE version: OpenJDK Runtime Environment (21.0.9+8) (build 21.0.9+8-nixos)
# Java VM: OpenJDK 64-Bit Server VM (21.0.9+8-nixos, mixed mode, emulated-client, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x5da413] AccessInternal::PostRuntimeDispatch<G1BarrierSet::AccessBarrier<548964ul, G1BarrierSet>, (AccessInternal::BarrierType)0, 548964ul>::oop_access_barrier(void*, oopDesc*)+0x53
#
# Core dump will be written. Default location: Core dumps may be processed with "/nix/store/xfssg6mkl430gibjfz31ryfijnbz6xpb-systemd/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %d %F" (or dumping to /Workspace/to/tut-kontlin-native/Hello/core.44073)
#
# An error report file with more information is saved as:
# /home/fazbdillah/Workspace/05.01-software/tut-kontlin-native/Hello/hs_err_pid44073.log
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
/nix/store/<hash>-kotlin-native-2.2.21/bin/.run_konan-wrapped: line 96: 44073 Aborted (core dumped) LIBCLANG_DISABLE_CRASH_RECOVERY=1 $TIMECMD "$JAVACMD" "${java_opts[@]}" "${java_args[@]}" -cp "$KONAN_CLASSPATH" "$TOOL_CLASS" "$TOOL_NAME" "${konan_args[@]}"
How to troubleshoot this?
I use NixOS and Nix flake for reproducibility. I do think the read-only nature of the /nix/store may cause this segfault (that’s the difference from other system). But, It doesn’t apparent from the error displayed.
Related: