I asked this question here first: https://users.rust-lang.org/t/unable-to-build-shared-wasm-lib-becuase-core-is-not-built-with-fpic/46549/2 but got no answers so wanted to ask here as well. Basically the problem is I'm unable to make shared libraries of my Rust crates if I use function from core or std and I think the problem is because core and std are not built with PIC relocation model. I'd like to try building rustc with std and core built with PIC for wasm32. Can anyone help me on this? I'm not sure what to update in config.toml.
@osa1 I don't know how to do it, but I know there's xargo for that usecase https://github.com/japaric/xargo but maybe there's a simpler way. IIRC there has been some work to make it easier.
Oh wow ... it only took 30 seconds and it worked! I'm surprised how fast it build core
from scratch.. I only had to create .cargo/config
with these lines:
[build]
rustflags = ["-Crelocation-model=pic"]
Thanks!
Glad it helped!