-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Incorrect library name passed to linker when linking with versioned dynamic libraries #14689
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
Comments
This does indeed look like a bug. emscripten should not be turning explicit libraries references such as BTW, when you like explictly with a library such as |
It looks like the offending code is: Lines 1235 to 1240 in 94b70c5
What kind of file is libz.so.1.2.11? It looks like its not a wasm or a bitcode file which is why its hitting this code path. I think we should simply remove this feature.. it doesn't seem very useful to me and can be very confusing. |
The commit that caused your use case to start failing was #14355, although the previous behaviour was to not pass anything to the linker at all :-/ |
This is rather an odd feature and I think we should notify users if they are relying on it. Honestly I doubt many are. See #14689 for an example of how confusing it can be when it goes wrong. Also, make sure we strip off the full suffix in the case of `.so.1.2.3` suffixes.
This is rather an odd feature and I think we should notify users if they are relying on it. Honestly I doubt many are. See #14689 for an example of how confusing it can be when it goes wrong. Also, make sure we strip off the full suffix in the case of `.so.1.2.3` suffixes.
This is rather an odd feature and I think we should notify users if they are relying on it. Honestly I doubt many are. See #14689 for an example of how confusing it can be when it goes wrong. Also, make sure we strip off the full suffix in the case of `.so.1.2.3` suffixes.
This is rather an odd feature and I think we should notify users if they are relying on it. Honestly I doubt many are. See #14689 for an example of how confusing it can be when it goes wrong. Also, make sure we strip off the full suffix in the case of `.so.1.2.3` suffixes.
I think this issue should be fixed by #14746., However I'm still curious about whether libz.so.1.2.11 exists in your working directory? It seems that it doesn't? Or that it is perhaps not a wasm file? |
What does |
Thank you for all the explanations and a rapid fix. You can look at the build commands executed for the library here, though it's nothing special: https://github.com/NixOS/nixpkgs/blob/456ac9c646c6bcdbf81c63e42f8941904da2435a/pkgs/top-level/emscripten-packages.nix#L148 This is a stable master but I didn't change configure, build and install phases when trying to upgrade. |
Its possible that something on the emscripten side changed to ouput a JS file called Can you go back to a working build (a working version of emsdk) and verify that this is the case? If I'm wrong and that contents of |
Looks like the contents did change. Current nixpkgs build of emscriptenPackages.zlib reports:
This is under a very old emscripten 2.0.1. I'll try bisecting and see when it changes. |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
After upgrading emscripten in nixpkgs, I found that
zlib
example is not building, failing at the step of seemingly building examples that have to be linked with just produced library.Looking at the produced linker command, it appears that the library name passed to
wasm-ld
is incorrect.This happened on emscripten 2.0.25 but the offending code appears to be unchanged between that and current main.
Here's the invoked command (with unrelated parts omitted for brevity):
Library file produced during compilation is called
libz.so.1.2.11
and is symlinked asFrom these logs it's clear that
.11
part is getting chopped, as if it was an extension.I went digging in
emcc.py
and found that the call tounsuffixed_basename
is likely to be incorrect, as it doesn't have the special logic for ignoring the library version extension part and acts as a normalbasename
.After applying a local hack to do
libname = strip_prefix(arg[:arg.rfind(file_suffix)], 'lib')
instead (taking only the name part until the format suffix), the linking succeeded.I'm not sure whether it should be passing version and what kind of a long-term solution would maintainers prefer so I refrained from opening a PR.
The text was updated successfully, but these errors were encountered: