Reproducer is here: https://github.com/osa1/wasm_test/tree/master/rs_nostd_core_lib_2
To reproduce locally make sure you have clang-10 installed and then run ./build.sh
. The output is as shown in the README. As also described in the README, I think the problem is core
library for wasm32 (tried with both wasm32-unknown-emscripten and wasm32-wasi) is not built with PIC relocation model, so as soon as I start using stuff from core
I get "recompile with -fPIC" errors. If you look at build.sh
, there's a version of the same commands for native compilation, and it works, so my guess is the problem is specific to wasm32 libraries.
My questions are:
- Am I right that there's an issue in
core
for the wasm32 targets (emscripten and wasi). - If yes, is there an easy way for me to build rustc with
core
(and possiblystd
too) built with PIC relocation model? - If no, do you know what the problem may be? It's interesting that I can build this just fine unless I use functions from
core
. Note that using types is not a problem, e.g. I can usePanicInfo
just fine.
Thanks.
EDIT: This isn't related to no_std, if I remove no_std the build fails the same way (though symbol names change IIRC).