-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linux: Missing SONAME in "libwasmtime.so" hinders usage in CMake #2996
Comments
That snippet is wrong if a user of wasmtime wants to rename the library to for example allow multiple versions to be installed at the same time. (common when packaging shared libraries by distros) You could use |
Thanks for the report! We actually do something similar for macOS already. @MartinKolbAtWork would you be up for making a PR to update that script? I unfortunately don't really know much about SONAME... |
Hi @alexcrichton , |
Hi @alexcrichton , I have a question/proposal on this topic, and I’d like to know your opinion/view. Like you, I don’t care about that SONAME thing at all. As stated in the title of the issue, the missing SONAME “just” hinders the usage of Wasmtime in a C/C++ based CMake environment. Wasmtime has both a C API (wasm-c-api) as well as the new C++ API that you mentioned. The vast majority of people using these APIs do have a CMake environment.
I can tell you, today that’s a lot more… 😉 I’m sure in wasmtime there are some C++ enthusiasts around that could add the relevant CMakeLists.txt files to the Git repo. If you think, my suggestion is a valid approach, I'd close this issue and open a new one with the new suggestion. Thanks |
Yeah that seems reasonable to me to add! I've never worked with CMake in this regard before (maybe others have?) but adding that for consuming the C API seems pretty reasonable to me. |
Hi @alexcrichton, I'll close this issue now and hopefully I'll see Wasmtime's CMake friendliness increased over time 👍 Thanks and best regards, |
The shared library
libwasmtime.so
does not have anSONAME
specified. This can be checked using this command:objdump -p libwasmtime.so | grep SONAME
When
libwasmtime.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 (note: the CMake ticket refers to wasmer, but wasmtime has exactly the same issue, due to the Rust heritage):
https://gitlab.kitware.com/cmake/cmake/-/issues/22307#note_971562
“The .so file should have a SONAME. If it doesn't, that's a bug in the package”
I know that 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:I tried putting these lines into
crates/wasi-common/build.rs
, and thenlibwasmtime.so
was built correctly, including a SONAME entry.Could you please fix this issue?
Thanks
Martin
The text was updated successfully, but these errors were encountered: