https://kotlinlang.org logo
Title
j

jkbbwr

12/30/2017, 9:52 PM
When trying to link against python
/usr/lib/libpython3.6m.so: error: undefined reference to 'getrandom', version 'GLIBC_2.25'
exception: java.lang.IllegalStateException: The /home/jakob/.konan/dependencies/target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/bin/ld.gold command returned non-zero exit code: 1.
Using cdef
headers = Python.h
libraryPaths = /usr/include/python3.6m
linkerOpts = -L/usr/lib -lpython3.6m -ldl -lutil -lm -Xlinker -export-dynamic
o

olonho

12/30/2017, 10:14 PM
not sure if the problem relates to K/N in any way: https://lwn.net/Articles/711013/
j

jkbbwr

12/30/2017, 10:16 PM
I can't tell what calls kotlinc-native is making to the linker, I have 2.26 installed and that provides
getrandom
o

olonho

12/30/2017, 10:34 PM
your Python is incompatible with the sysroot provided by Kotlin/Native, my suggestion is to use older Python. General solution of this problem is rather hard and involves using machine root as the sysroot.
j

jkbbwr

12/30/2017, 10:51 PM
Any idea when the sysroot with K/n will change
o

olonho

12/30/2017, 11:02 PM
it unlikely will soon, idea is to generate binary that could be executed on most machines out there, but not linking in whole libc. So we link libc dynamically, and use rather stable ABI version. available on most Linux machines. Using Python compiled against less demanding glibc version looks pretty sensible approach. Maybe some glibc runtime version forcing may help as well.
j

jkbbwr

12/30/2017, 11:08 PM
Thanks!