Open jacobsvante opened 6 months ago
Same here. With cargo run
it works, similar to the bundled feature.
Seems like the same difficulties with dynamic linking. Is it possible to add static linking now with from-source-building?
Sorry guys for the false hope 😄 but at least now the build process can be controlled from rust, so it's a small step in the right direction. Unfortunately, only setting SHARED=false
is not enough, I will be iterating on it in this PR https://github.com/scipopt/scip-sys/pull/15
No worries, I'm just happy to see you working on it 😀
I think I found a nice solution that doesn't requires much work. I updated scip-sys (v0.1.12, and a corresponding russcip version 0.3.4 to use it) to also say where it found libscip. It sets the environment variable DEP_SCIP_LIBDIR
. You could use that information to set the rpath of the binary you're building by adding something like this to your build script
fn main() {
let libscip_dir = std::env::var("DEP_SCIP_LIBDIR").unwrap();
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", libscip_dir);
}
I think you might also need to add scip-sys to the dependencies of your crate not just russcip.
It's not probably the nicest solution since it requires a bit of effort from the downstream user of scip-sys
but should do the job. @jacobsvante @mwien What do you think?
I think for the bundled feature with pre-built binary that cannot be statically linked it is likely the only way and a nice-to-have option 👍
Will test it out in the coming days.
I'm still gonna look into static linking because I probably need it for a project. Gonna write if I can make it work, should be doable in principle 🤔
Thanks for your work ❤️
Haven't had the chance to try yet but will soon. Have you tried building and linking scip statically?
Using the new feature from-source, available since 0.3.3, I'm unable to run the built binary. Here's my MRE:
Dockerfile:
Build:
Run / error: