Closed OscarTHZhang closed 1 year ago
It looks like it's failing to link to the C library functions called from flate2-rs when using zlib or miniz (assuming zlib since it's attempting to link *setDictionary). Does it work if using the rust miniz_oxide back-end (which is the default unless explicitly set to something else)? Maybe there is some issue with the C libraries not being built or located when using corrosion/cxx.rs?
Not sure how to solve this if you can't use the rust back-end, though I suspect it's more an issue with corrosion not fully handling rust code that in turn builds/links back to C code rather than an issue in flate2 itself.
@OscarTHZhang I ran into the same problem. One solution I found is to link the imported corrosion target against libz
in your CMakeLists.txt
. For example:
corrosion_import_crate(MANIFEST_PATH rust/Cargo.toml)
target_link_libraries(MY_CORROSION_CRATE INTERFACE z)
where MY_CORROSION_CRATE
is the name of your crate in the rust/Cargo.toml
file.
@alexcrichton @joshtriplett this ticket should be ok to close with the solution I provided in https://github.com/rust-lang/flate2-rs/issues/281#issuecomment-1207277303
I was trying to use compile my code that uses this library into C++ callable static library using cxx.rs and corrosion following this example.
As my code is building, the following linker error appeared:
By tracing the error message I noticed that the error is coming from
flate2-rs
. So I wonder if someone would know the solution for this cross-compiling linker error?Thanks in advance!