I'm trying to use libxml2 in a linuxX64 target and...
# kotlin-native
s
I'm trying to use libxml2 in a linuxX64 target and think I'm getting burned by the age of the konan gcc stack again. With libxml2, after getting all the required libraries into the def file linkerOpts.linux clause, trying to run a unit test causes this linker error:
ld.lld: error: undefined symbol: fcntl64
I think
fcntl
was renamed to
fcntl64
in glibc 2.28, and I'm afraid this is newer than the native konan stack is handling. I tried this line in the .def:
Copy code
linkerOpts.linux = --allow-shlib-undefined -L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata -lz -llzma -lpthread
hoping that the --allow option would tell the linker to ignore the missing symbol, but no help. Libxml2 required all those other libs. Has anyone seen this issue with the fcntl64 undefined symbol and have a fix/workaround?
Yup glibc in the konan stuff is 2.19. Pretty old.
Hmm, I did find this link Look at last reply in chain for one possibility . I guess I might try that if nothing easier pops. No way I want to compile libxml2 from source with the konan stack just for this, as it would likely cause me to have to rebuild ICU, zlib, lzma, any of which might be using fcntl64. Way too much work 🙂
Found a workaround. Used this, was previously (stupidly) specifying libxml2 as a static library in the .def. Changed to this line instead and it's working:
linkerOpts.linux = --allow-shlib-undefined --dy -L/usr/lib/x86_64-linux-gnu -lxml2 -licui18n -licuuc -licudata -lz -llzma -lpthread