Open danbev opened 2 years ago
@cjihrig Do we know if the shared library version of uvwasi works? I'm getting linking errors when trying to link uvwasi with wasm-micro-runtime (instead of compiling the sources together).
I'm not sure. I didn't work on nor use the shared library version. It was added in https://github.com/nodejs/uvwasi/commit/d8280df01378fb1cb6eb27032d09537dde5389c3. Maybe @Diatrus knows.
I'm not sure. I didn't work on nor use the shared library version. It was added in d8280df. Maybe @Diatrus knows.
I currently use the shared version of the uvwasi library when linking with nodejs, and I don't know that anything has changed linking-wise. I'd have to see the error myself. As for the link error above, the shared library should be compiled with -fPIC. If this was a mistake on my part by not adding that, I can look into a PR soon.
I can reproduce the issue with:
➜ gcc --version
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
...will take a look
I also encounter this problem.
My compilation environment information is as follows:
Is there any progress for this issue?
@phated do you know if #210 helps with this at all?
@cjihrig I'm uncertain. I think wamr is doing static linking and I don't know how to build their executable with dynamic linking. My PR definitely enables linking somehow from produced artifacts.
@cjihrig I'm uncertain. I think wamr is doing static linking and I don't know how to build their executable with dynamic linking. My PR definitely enables linking somehow from produced artifacts.
@phated I compiled standalone uvwasi, rather than linking it with WAMR.
You can work around it by adding -fPIC
:
cmake ../.. -DBUILD_TESTING=ON -DCMAKE_C_FLAGS=-fPIC
I'm seeing the following link error when building locally using the following commands:
This can be avoided around by setting
CMAKE_POSITION_INDEPENDENT_CODE
toTrue
:This could also be set in CMakeLists.txt:
GCC version:
I'm not sure if this is an issue with my local environment, as the CI servers are obviously working as expected. But I wanted to create this issue just in case anyone else runs into it.