Anyone here a Nix fan & able to get Kotlin/Nat...
# kotlin-native
j
Anyone here a Nix fan & able to get Kotlin/Native linux builds working? Here is what I tried for my
shell.nix
Copy code
with import <nixpkgs> {};
mkShell {
  NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [
    stdenv.cc.cc.lib
    zlib
    libclang.lib
  ];
  NIX_LD = lib.fileContents "${<http://stdenv.cc|stdenv.cc>}/nix-support/dynamic-linker";
}
Running:
Copy code
~/.konan/kotlin-native-prebuilt-linux-x86_64-1.8.10/bin/konanc main.kt
I get a working
program.kexe
but the konanc program crashes with:
Copy code
# V  [libjvm.so+0x58aeca]  AccessInternal::PostRuntimeDispatch<G1BarrierSet::AccessBarrier<548964ul, G1BarrierSet>, (AccessInternal::BarrierType)0, 548964ul>::oop_access_barrier(void*, oopDesc*)+0x1a
n
Do note that K/N doesn't support NixOS. K/N supports Ubuntu, Debian, and any Linux distro that uses Ubuntu or Debian as the base like Linux Mint ( https://linuxmint.com/ ) for example. I'm assuming that NixOS uses its own base. In that case K/N compiler won't work properly, which isn't surprising considering the issues you are encountering.
s
Is it true that K/N (still) only supports linux distros based on Ubuntu or Debian? The documentation doesn't mention this: https://kotlinlang.org/docs/native-target-support.html#tier-1
c
I'm running K/N on ArchLinux without issues. Haven't tried other distros, but I don't see why it would make a difference?
p
I am using K/N on Arch Linux too with no practical issues. I did have some issues with linking, but when I added the
--allow-shlib-undefined
option, everything works perfectly.
e
@Panayotis Katsaloulismaybe worth opening a YT issue?
n
Some C libs require the
--allow-shlib-undefined
to be passed to the linker due to the way they are designed. This isn't an issue specific to Kotlin itself.
s
I am using NixOS and am seeing the same issue that @James Ward mentioned earlier. NixOS is pretty unique so it's somewhat unsurprising things aren't working as expected, but I'm curious if there's any insight into the OpenJDK segfault.
120 Views