Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Set the SONAME to
libwasmer.so
on Linux.
See wasmerio#2429 for more context. I'm copy-pasting the original comment from @MartinKolbAtWork here: > The shared library `libwasmer.so` does not have an `SONAME` > specified. This can be checked using this command: `objdump -p > libwasmer.so | grep SONAME` > > When `libwasmer.so` is consumed in CMake, the **linker produces a > wrong output file due to the missing SONAME**. There is a > workaround for this in CMake, but according to a reply from the > CMake folks, the missing SONAME is a bug that must be fixed by the > library provider: > https://gitlab.kitware.com/cmake/cmake/-/issues/22307#note_971562 > “_The libwasmer.so file should have a SONAME. If it doesn't, that's > a bug in the wasmer package_” > > The problem is **inherent for all Rust builds of cdylibs**: > rust-lang/cargo#5045 The Rust community > did not fix this since 2018 (see issue above), but fortunately it’s > **easy to fix** for library creators. You just need to put the > following code into the `build.rs` of the library: > > ``` > if cfg!(target_os = "linux") { > println!("cargo:rustc-cdylib-link-arg=-Wl,-soname,libwasmer.so"); > } > ``` > > I tried putting these lines into `lib/c-api/build.rs`, and then > `libwasmer.so` was built correctly, including a SONAME entry.
- Loading branch information