Closed datben closed 11 months ago
Hi @datben, it should work with whatever is in the i.e. native
dir; just put / modify a generated Cargo.toml in it.
https://github.com/sbt/sbt-jni#cargo
Have you tried it? If it does not work a bug report will be very helpful.
Ty @pomadchin , indeed my cargo.toml was miss configured, it seems to work now, ty for your time !
Hello @pomadchin, i have another issue, i'd like to build multiple library with jni in one workspace, however i got a message telling me that only one library can be build: [warn] More than one file was created during compilation, only the first one (/builds/defi/solana-scala/jni-integration/target/native/x86_64-linux/bin/release/libwhirlpool_native.so) will be used.
@datben I think I'd need a reproducible example project to help with this one
I'll try to make one since i can't share the code
@pomadchin could you try to compile this https://github.com/datben/jni-test with sbt compile? this message should appear [warn] More than one file was created during compilation, only the first one (/jni-test/jni-integration/target/native/x86_64-linux/bin/release/liba.so) will be used.
Oh that's a known limitation, we expect the underlying library to produce a single dylib. That's a good question what to do with multiple / how to handle it, so any suggestions and PRs are welcome.
I believe all of the supported build tools have this limitation.
That's the origin of the message: https://github.com/sbt/sbt-jni/blob/main/plugin/src/main/scala/com/github/sbt/jni/build/Cargo.scala#L56-L62
ok, so i guess the only solution is too split each crate for now
Or figure out what we really need to do here in case of multiple libs present.
Mb there is a room for improvement 🤔
Is there a specific reason why 'lib' has to be 'File' and can't be 'List[File]'? i dont see where the output of nativeCompile is used
@datben you know it looks like nothing prevents us from packing more libs into a jar 🤷 I'll bring up a PR and we see what breaks.
Hello, could you tell me how to configure sbt-jni with a cargo workspace and not a simple cargo lib, i did not find any example about this