Skip to content
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

Emscripten dynamic linking and libc #98155

Closed
hoodmane opened this issue Jun 16, 2022 · 2 comments
Closed

Emscripten dynamic linking and libc #98155

hoodmane opened this issue Jun 16, 2022 · 2 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL! O-wasm Target: WASM (WebAssembly), http://webassembly.org/ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@hoodmane
Copy link
Contributor

When dynamically linking Emscripten modules, Rust passes -lc to Emscripten. This causes wasm-ld: error: unable to find library -lc-debug. I see that -lc is coming via EmLinker.link_dylib. If I make link_dylib into a no-op this fixes the problem, though maybe that has other bad side effects. I am not sure how to filter out libraries that shouldn't be statically linked into a dynamic library. But it would be great to fix this. I am currently using an emcc linker wrapper that deletes the -lc argument.

@sbc100
xref emscripten-core/emscripten#17191

@hoodmane
Copy link
Contributor Author

For a reproduction:

touch lib.rs
rustc lib.rs -C link-arg=-sSIDE_MODULE=2 --target wasm32-unknown-emscripten --crate-type cdylib

using tip of tree emcc and nightly rust.

@jyn514 jyn514 added A-linkage Area: linking into static, shared libraries and binaries T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. O-wasm Target: WASM (WebAssembly), http://webassembly.org/ C-bug Category: This is a bug. labels Apr 10, 2023
@workingjubilee workingjubilee added the O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL! label Oct 11, 2024
@hoodmane
Copy link
Contributor Author

Closed because the Emscripten issue that causes this problem seems to have been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-emscripten Target: 50% off wasm32-unknown-musl. the savings come out of stdio.h, but hey, you get SDL! O-wasm Target: WASM (WebAssembly), http://webassembly.org/ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants