-
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
Linking empty rust file fails with "unable to find library -lc-debug" #17191
Comments
Can you show the failing wasm-ld comment? I'm pretty sure emscripten will never add I think you best bet is to remove any/all explicit additions of (I don't think this is actually and emscripten bug BTW, but a rustc driver bug) |
Yes Rust is adding it. I agree it's probably not an emscripten bug. It's added by Rust in a way that makes it hard to remove, but if I patch emcc to delete
|
That looks like an invalid wasm file... can you gram |
Nope. |
Returns a lot of errors like:
|
|
What is the default ? full LTO? |
Can you see which function is at those offsets? ( |
For the record, to get to this point I have applied the following patch: diff --git a/emcc.py b/emcc.py
index b97321cde..66b13d744 100755
--- a/emcc.py
+++ b/emcc.py
@@ -3841,6 +3841,9 @@ def process_libraries(state, linker_inputs):
state.forced_stdlibs.append(native_lib)
continue
+ if lib == "-c":
+ continue
+
# We don't need to resolve system libraries to absolute paths here, we can just
# let wasm-ld handle that. However, we do want to map to the correct variant.
# For example we map `-lc` to `-lc-mt` if we are building with threading support.
diff --git a/tools/building.py b/tools/building.py
index cb015e18f..7879c868a 100644
--- a/tools/building.py
+++ b/tools/building.py
@@ -360,9 +360,9 @@ def link_lld(args, target, external_symbols=None):
# Emscripten currently expects linkable output (SIDE_MODULE/MAIN_MODULE) to
# include all archive contents.
- if settings.LINKABLE and not any(arg.endswith(".rlib") for arg in args):
- args.insert(0, '--whole-archive')
- args.append('--no-whole-archive')
if settings.STRICT:
args.append('--fatal-warnings') With that patch,
works and produces a valid empty side module. |
According to sbc100, when linking with emcc we shouldn't pass -lc: > your best bet is to remove any/all explicit additions of -lc, since > the compiler driver (emcc) will add it if/when its needed. > (I don't think this is an emscripten bug BTW, but a rustc driver bug) emscripten-core/emscripten#17191 (comment)
The following:
Results in
wasm-ld: error: unable to find library -lc-debug
.Rust always includes
-sASSERTIONS=1
in the linker args, see rust-lang/rust#97928.This seems to be a regression between emscripten version 2.0.27 and version 3.1.6. If I surgically set
settings.ASSERTIONS=0
, then it still fails with "unable to find library -lc". I don't think it should be trying to link-lc
anyways because I am trying to make a side module. But I am not sure what the proper setting is to convince Rust or Emscripten to discard this.The text was updated successfully, but these errors were encountered: