Uh oh!
There was an error while loading. Please reload this page.
Implement set_output_kind for Emscripten linker - #98358
Conversation
rust-highfive
commented
Jun 21, 2022
|
petrochenkov
commented
Jun 22, 2022
@hoodmane |
hoodmane
commented
Jun 22, 2022
Copying over the most relevant comments so we can have the context all in one place.
Originally posted by @petrochenkov in #98303 (comment)
Originally posted by @petrochenkov in #98303 (comment) |
This comment was marked as resolved.
This comment was marked as resolved.
I think the output kinds map perfectly reasonably. Emscripten has the following possible outputs:
The thing that is causing the trouble is that Emscripten has decided that in many cases when native programs would use dynamic linking it is preferable to use static linking. In interest of porting these dynamic builds to Emscripten static libs without changing their build system, if you pass The problem right now is that both |
hoodmane
commented
Jun 24, 2022
I think the problem here is libraries that have both a static and a dynamic version. Emscripten doesn't have the same logic that normal compilers do for picking between them. In particular, it is not a problem if you pass It would be helpful to have more data on this though. I should try to build more crates that explicitly link non-rust libraries. |
hoodmane
commented
Jun 24, 2022
@sbc100 anything more you have to add here? It would simplify things on the Rust side a lot if linking issues could be fixed on the Emscripten side... |
sbc100
commented
Jun 24, 2022
I would say that executable comes in two flavors, normal and MAIN_MODULE. You can think of them like |
hoodmane
commented
Jun 24, 2022
Well there are four executable |
petrochenkov
commented
Jun 24, 2022
Technically it's 5, there's also |
hoodmane
commented
Jun 24, 2022
I think linking executables with dynamic linking enabled cannot work right now without fixes from Emscripten. We can't use |
bjorn3
commented
Jun 24, 2022
I don't think passing it for the |
hoodmane
commented
Jun 24, 2022
Yes that sounds right. |
hoodmane
commented
Jun 24, 2022
@sbc100 how does it look to you? |
This comment has been minimized.
This comment has been minimized.
60b7b21 to
48678deComparehoodmane
commented
Jul 6, 2022
@petrochenkov@compiler-errors could someone review this? Or if you don't have time, do you have any recommendations for other people I might ask? |
JohnTitor
commented
Jul 16, 2022
Failed in rollup: #99305 (comment) |
hoodmane
commented
Jul 22, 2022
@petrochenkov I cherry-picked the commit from #99243 to this branch because tests won't pass on this branch without it. Should I squash this too? |
petrochenkov
commented
Jul 24, 2022
No, it's fine as is. |
bors
commented
Jul 24, 2022
…chenkov Implement set_output_kind for Emscripten linker This is on top of rust-lang#98149. See also the earlier discussion on rust-lang#98303. With this PR, a crate that specifies that it is a cdylib will compile to a working Emscripten dynamic library without adding any extra cargo, rustc, or linker flags and without fiddling with environment variables. `@sbc100` r? `@petrochenkov`
ehuss
commented
Jul 27, 2022
@bors r- Failed in rollup: #99776 (comment) |
b0da01f to
1304f17CompareJohnCSimon
commented
Nov 6, 2022
ping from triage: FYI: when a PR is ready for review, send a message containing |
| // Without -sWASM_BIGINT there are issues with dynamic Rust libraries. There | ||
| // are no plans to fix this in Emscripten AFAIK. See | ||
| // https://github.com/emscripten-core/emscripten/pull/16693 This could also | ||
| // be fixed with panic=abort. | ||
| self.cmd.arg("-sWASM_BIGINT"); |
There was a problem hiding this comment.
This problem is fixed now:
emscripten-core/emscripten#17328
so I should remove it.
hoodmane
commented
Nov 6, 2022
I think there's still a test failure that I don't understand. I will try to look into it again soon. |
JohnCSimon
commented
Jan 1, 2023
…d, r=petrochenkov Implement `set_output_kind` for Emscripten linker This makes cdylibs compile to working Emscripten dynamic libraries without passing extra RUSTFLAGS. This was previously approved as rust-lang#98358 but there were CI failures that I never got around to fixing. cc @workingjubilee
Rollup merge of #151704 - hoodmane:emscripten-set-output-kind, r=petrochenkov Implement `set_output_kind` for Emscripten linker This makes cdylibs compile to working Emscripten dynamic libraries without passing extra RUSTFLAGS. This was previously approved as #98358 but there were CI failures that I never got around to fixing. cc @workingjubilee
…ochenkov Implement `set_output_kind` for Emscripten linker This makes cdylibs compile to working Emscripten dynamic libraries without passing extra RUSTFLAGS. This was previously approved as rust-lang/rust#98358 but there were CI failures that I never got around to fixing. cc @workingjubilee
This is on top of #98149. See also the earlier discussion on #98303. With this PR, a crate that specifies that it is a cdylib will compile to a working Emscripten dynamic library without adding any extra cargo, rustc, or linker flags and without fiddling with environment variables.
@sbc100
r? @petrochenkov