I’m having trouble getting cinterop working on Lin...
# kotlin-native
r
I’m having trouble getting cinterop working on Linux. eg here’s a minimal repo trying to include sdbm directly from source. On macosX64 it builds fine, but on linuxX64 I get undefined symbol errors on linking. What am I missing?
d
Looking at the cinterop setup. I'm surprised it even builds successfully for macos.
Is sdbm something that comes preinstalled with macos?
You'll have to install it on the Linux system and tell cinterop where to find the static/dynamic library.
r
I thought it would be sufficient to point to sources rather than library binaries, but maybe I misunderstood. I’ve still been having trouble getting that to work though. Wil try to throw a different demo together tomorrow
d
In theory, you could also specify the source files in the def file along with the header, then cinterop would compile them for you and it would just work. It's quite naughty though.
📏 1
r
Here's a hopefully better example. Install qdbm, point cinterop to it. Fails on the link task in gradle. Clearly I'm still missing something. repo: https://github.com/russhwolf/qdbm-cinterop build output: https://github.com/russhwolf/qdbm-cinterop/runs/621080165?check_suite_focus=true#step:4:178
s
-L
is for library search path while
-l
is for library name.
👍 1
r
That looks like it! Thanks a lot!