-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement set_output_kind for Emscripten linker #98358
Conversation
|
@hoodmane |
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 |
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. |
@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... |
I would say that executable comes in two flavors, normal and MAIN_MODULE. You can think of them like |
Well there are four executable |
Technically it's 5, there's also |
I think linking executables with dynamic linking enabled cannot work right now without fixes from Emscripten. We can't use |
I don't think passing it for the |
Yes that sounds right. |
@sbc100 how does it look to you? |
50dadcc
to
b1b106b
Compare
This comment has been minimized.
This comment has been minimized.
60b7b21
to
48678de
Compare
@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? |
…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`
Failed in rollup: #99305 (comment) |
@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? |
No, it's fine as is. |
…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`
@bors r- Failed in rollup: #99776 (comment) |
b0da01f
to
1304f17
Compare
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This problem is fixed now:
emscripten-core/emscripten#17328
so I should remove it.
I think there's still a test failure that I don't understand. I will try to look into it again soon. |
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