When trying to link against python ``` /usr/lib/...
# kotlin-native
j
When trying to link against python
Copy code
/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
Copy code
headers = Python.h
libraryPaths = /usr/include/python3.6m
linkerOpts = -L/usr/lib -lpython3.6m -ldl -lutil -lm -Xlinker -export-dynamic
o
not sure if the problem relates to K/N in any way: https://lwn.net/Articles/711013/
j
I can't tell what calls kotlinc-native is making to the linker, I have 2.26 installed and that provides
getrandom
o
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
Any idea when the sysroot with K/n will change
o
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
Thanks!