-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
bug: Emscripten doesn't generate PIC libc #16680
Comments
Or probably it makes no sense to link |
Does replacing |
Well what works for me is just filtering out |
So perhaps I should close this as resolved? |
Oh, ignore my comment on main module, I misread those commands... I'm not sure where we landed on automatically ignoring redundant link libraries like |
When building a side module we don't add I think its probably bug that we don't auto-build wasm32-emscripten/pic/libc.a here. |
On the other hand you almost certainly don't want to be including libc in your side module... I'm not sure if its best to just ignore it or to give a warning in this case? |
Yeah we are filtering it out. Maybe dropping it and printing a warning would be best? |
I think PR #19405 might be an alternative solution for this. |
Or, if possible(?), perhaps we could avoid that rust passes $ rustc --target=wasm32-unknown-emscripten --crate-type staticlib --print native-static-libs - < /dev/null
note: Link against the following native artifacts when linking against this static library. The order and any duplication can be significant on some platforms.
note: native-static-libs: -lc |
Well the rust people rejected my suggestions to adjust rust since in their opinion passing
works fine and same with clang. So Emscripten is really doing the wrong thing here by failing. We currently pass I also don't think #19405 is the right solution for this particular problem because we don't really want or need to actually link anything extra into the |
@katietz ran into this problem today trying to build |
I think #19405 probably won't fix your issue, since you really don't want to link libc.a into both your main module and your side module. That could lead to all kind of problems I think. |
Out of curiousity does passing |
|
In emscripten we don't build libc as a side module (shared library) but always link it statically into the main module. |
"always" as in independently of whether |
Ah I see from #19414 that |
This doesn't seem to reproduce anymore, so I'll close it as fixed. |
The upstream bug that made this necessary seems to have been resolved: emscripten-core/emscripten#16680
There have been a lot of bugs when the caller passes `-lc` over the years. For example it crashes if we do: ``` emcc -lc -sDISABLE_EXCEPTION_CATCHING=0 -sMIN_SAFARI_VERSION=150000 ``` Rust likes to pass `-lc`. Let's drop it and stop causing trouble for Rust. Resolves emscripten-core#22758, emscripten-core#22742 and would have resolved emscripten-core#16680 if it hadn't disappeared first.
See: emscripten-core/emscripten#22742 emscripten-core/emscripten#16680 rust-lang/rust#98155 rust-lang/rust#98303 rust-lang/rust#131885 (backport <rust-lang#4002>) (cherry picked from commit 66e3665)
Tested
Example:
test.c:
fails with:
The text was updated successfully, but these errors were encountered: