Stream: t-compiler/help

Topic: wasm32 core and std relocation model?

osa1 (Jul 30 2020 at 07:07, on Zulip):

I asked this question here first: 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.

pachi (Jul 30 2020 at 08:06, on Zulip):

@osa1 I don't know how to do it, but I know there's xargo for that usecase but maybe there's a simpler way. IIRC there has been some work to make it easier.

osa1 (Jul 30 2020 at 08:24, on Zulip):

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:

rustflags = ["-Crelocation-model=pic"]
osa1 (Jul 30 2020 at 08:24, on Zulip):


pachi (Jul 30 2020 at 08:28, on Zulip):

Glad it helped!

Last update: Jan 22 2021 at 13:15UTC