Closed teras closed 9 months ago
Did your Linux executable program project add the linkerOpts
into your build.gradle.kts
correctly?
I was following the documentation to the letter. Are there any options I should put?
The interesting part is that the library itself added the -lsqlite3
option, not me.
Try adding this line to your build.gradle.kts
executable program project:
linkerOpts += listOf("-lsqlite3", "-L/usr/lib")
If that doesn't work, try using the libsqlite3.a
to replace your libsqlite3.so
file.
This improved the situation, but I have another problem now: (The error list is exhaustive)
The /home/teras/.konan/dependencies/x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2/x86_64-unknown-linux-gnu/bin/ld.gold command returned non-zero exit code: 1.
output:
/usr/lib/libsqlite3.so: error: undefined reference to 'fmod', version 'GLIBC_2.38'
/usr/lib/libsqlite3.so: error: undefined reference to 'fcntl64', version 'GLIBC_2.28'
/usr/lib/libsqlite3.so: error: undefined reference to 'fstat64', version 'GLIBC_2.33'
/usr/lib/libsqlite3.so: error: undefined reference to 'log', version 'GLIBC_2.29'
/usr/lib/libsqlite3.so: error: undefined reference to 'dlerror', version 'GLIBC_2.34'
/usr/lib/libsqlite3.so: error: undefined reference to 'pthread_mutexattr_destroy', version 'GLIBC_2.34'
/usr/lib/libsqlite3.so: error: undefined reference to 'stat64', version 'GLIBC_2.33'
/usr/lib/libsqlite3.so: error: undefined reference to 'dlopen', version 'GLIBC_2.34'
/usr/lib/libsqlite3.so: error: undefined reference to 'exp', version 'GLIBC_2.29'
/usr/lib/libsqlite3.so: error: undefined reference to 'pthread_join', version 'GLIBC_2.34'
/usr/lib/libsqlite3.so: error: undefined reference to 'pthread_mutexattr_init', version 'GLIBC_2.34'
/usr/lib/libsqlite3.so: error: undefined reference to 'pthread_mutexattr_settype', version 'GLIBC_2.34'
/usr/lib/libsqlite3.so: error: undefined reference to 'pthread_create', version 'GLIBC_2.34'
/usr/lib/libsqlite3.so: error: undefined reference to 'pow', version 'GLIBC_2.29'
/usr/lib/libsqlite3.so: error: undefined reference to 'pthread_mutex_trylock', version 'GLIBC_2.34'
/usr/lib/libsqlite3.so: error: undefined reference to 'dlclose', version 'GLIBC_2.34'
/usr/lib/libsqlite3.so: error: undefined reference to 'dlsym', version 'GLIBC_2.34'
/usr/lib/libsqlite3.so: error: undefined reference to 'log2', version 'GLIBC_2.29'
/usr/lib/libsqlite3.so: error: undefined reference to 'lstat64', version 'GLIBC_2.33'
Try to use the libsqlite3.a to replace your libsqlite3.so under the same directory.
Hello
First of all, asking to link statically shouldn't be a proper solution. There are reasons why dynamic libraries are present. Especially if we override system files, like /usr/lib/*.so
.
Having said that, I found a solution which probably should be documented somewhere. In order for linking to work, linker should be more relaxed. So instead of only linkerOpts += listOf("-lsqlite3", "-L/usr/lib")
as parameters, the parameter --allow-shlib-undefined
is also required.
Final list of parameters is:
linkerOpts += mutableListOf("-lsqlite3", "-L/usr/lib", "--allow-shlib-undefined")
OK, thank you. That's good. I will modify related documents.
Hello I am trying to use SQLlin in Kotlin/Native Linux x64 platform. Unfortunately it breaks with an error:
plus a huge list of unresolved references to sqlite functions.
Of course, I do have sqlite installed
so the problem must be something else. Any idea?