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

Linking with LLD fails (on Windows) but only in 32-bit (due to space in path) #78686

Closed
Boscop opened this issue Nov 2, 2020 · 9 comments
Closed
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. O-windows-msvc Toolchain: MSVC, Operating system: Windows O-x86_32 Target: x86 processors, 32 bit (like i686-*) O-x86_64 Target: x86-64 processors (like x86_64-*) regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Boscop
Copy link

Boscop commented Nov 2, 2020

The 32-bit build of my DLL fails to build with nightly-2020-10-19 when linking with LLD.
It was building fine with nightly-2020-04-12, but I'm not sure if I was using LLD back then already.
LLD seems to have problems with a space in my rustup path, but it used to work before, also building for 32-bit!
My rustup folder is D:\Program Files\.multirust, but it tries to use Files\.multirust.
Btw, this DLL builds fine in 64-bit with this nightly!

  = note: lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libeasyvst-7a8738ccac37439f.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libarray_macro-2b71173e2a79656f.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\liblazy_static-0de2833aa4303022.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libitertools-75a9c1c17325349d.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libeither-aa94c37967e008e6.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libc_fixed_string-8d1124b1c76f7e82.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libmemchr-e2259ec4523fc568.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libsublime_fuzzy-de293d34669e9dd7.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libron-c6e5d0c14aa8afe7.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libbitflags-5c012e57ffbe56ea.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libbase64-213d31a37202d205.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libbyteorder-bad377bdb0120245.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libboolinator-551df7afa7ae84d2.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libasprim-4f82e6617c60293a.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libsimplelog-e76090bfe18f431e.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libtime-921d7a0f588c9276.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libterm-86609a00208a9c6c.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\liblog_panics-15dfb7bb59469c3c.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libvst-9d2979ff986da315.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libbitflags-1f6fef3ee32e9ef9.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\liblog-eb76fcb7f2706963.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\liblog-6e5ecb16eafd4862.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libcfg_if-f1f2b9528ae9a5cd.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\liblibloading-48abf4a37ee36207.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libkernel32-ad762fc204d97edb.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libwinapi-d625ce9a2ea76b4c.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\liblibc-718757e0ebf8be62.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libreaper_api-e562353af2768c3e.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libfoobar_config-9e73727d59b96661.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libserde-8aefc32c499e45ec.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libshortmsg-69ba7413354c2b0e.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libenum_count-1f7635dfbe93b412.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\librimd-ff9e02fb180febf9.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libencoding-0ccebfb44cb5a5c6.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libencoding_index_tradchinese-56975872a8aba386.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libencoding_index_simpchinese-d1232a3197f07bc9.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libencoding_index_japanese-e759b1dc9fd511b0.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libencoding_index_korean-f497a323d30da112.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libencoding_index_singlebyte-5920c6926b714127.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libnum-a4c7b78d2b66d2a8.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libnum_rational-95e67133f6cb485a.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libnum_bigint-30601424daf18c22.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\librand-10bef9b973b67363.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libwinapi-950fd670bbb93895.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libnum_complex-0346b25f5c728548.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\librustc_serialize-1634c57b3af99045.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libnum_iter-92a87612c5b18cc0.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libnum_integer-b8ef21ff533ffbdd.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libenum_primitive-3903f47e2541cb7b.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libnum_traits-077d42f91afc67f7.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libbyteorder-c4286e542a8ca9c1.rlib
          D:\projects\vstplugins\foobar\target\i686-pc-windows-msvc\release\deps
\libnum_traits-6e3165eedd1a0e29.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libstd-7a1
8ec7fc231bb29.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libpanic_u
nwind-c544953d0d722951.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\librustc_d
emangle-87350483bc38d2b1.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libhashbro
wn-2efb755558a60d85.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\librustc_s
td_workspace_alloc-1337199bff2828b2.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libunwind-
7409746f778811ad.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libcfg_if-
73ba9bd83b75c6a4.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\liblibc-88
089498ba09518c.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\liballoc-8
d350847855f2cf5.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\librustc_s
td_workspace_core-945c601817cdaedc.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libcore-a9
414fa6d2989d9c.rlib
          D:\Program': invalid argument

          lld-link: error: could not open 'Files\.multirust\toolchains\nightly-2
020-10-19-x86_64-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib\libcompile
r_builtins-fed5b7efac91cb5b.rlib
          kernel32.lib
          credui.lib
          advapi32.lib
          kernel32.lib
          secur32.lib
          advapi32.lib
          ws2_32.lib
          userenv.lib
          msvcrt.lib
          -fuse-ld=lld
          ': no such file or directory


error: aborting due to previous error; 4 warnings emitted

At first I posted on the forum:
https://users.rust-lang.org/t/linking-with-lld-fails-but-only-in-32-bit-due-to-space-in-path/50521
Apparently it was only fixed for Wasm: #77543 (comment)

@Boscop Boscop added the C-bug Category: This is a bug. label Nov 2, 2020
@Mark-Simulacrum Mark-Simulacrum added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Nov 2, 2020
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Nov 2, 2020
@jyn514
Copy link
Member

jyn514 commented Nov 2, 2020

This looks awfully like #76466.

@mati865
Copy link
Contributor

mati865 commented Nov 2, 2020

The cause of #76466 is entirely unrelated to this issue: llvm/llvm-project@928e9e1

@jyn514 jyn514 added A-linkage Area: linking into static, shared libraries and binaries O-windows Operating system: Windows O-x32 x32 ABI labels Nov 2, 2020
@apiraino apiraino added P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 4, 2020
@apiraino
Copy link
Contributor

apiraino commented Nov 4, 2020

Assigning P-high as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.

@mati865

This comment has been minimized.

@rustbot rustbot added O-x86 and removed O-x32 x32 ABI labels Nov 4, 2020
@camelid camelid removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Nov 4, 2020
@pnkfelix
Copy link
Member

pnkfelix commented Dec 9, 2022

Visiting for P-high review.

There are a number of questions this issue raises for me.

  • Was this really a regression? The reporter says this scenario had worked for them in the past, but also says they're not sure they were using lld in the past, so its possible that this specific combination (i.e. of using lld atop 32-bit Windows) has never worked...
  • Regardless of whether its a regression or not, its definitely a bug
  • But I don't know whether it should be a P-high bug.
  • My personal suspicion is that resolving this will be a matter of figuring out what's specifically wrong in the 32-bit target handling; i.e. the hard part is probably in identifying where things are going wrong, but once we find that, the fix will probably obvious.

I'd like to find this an owner, the hardest part is probably finding someone who already has an environment set up for building for this target (32-bit windows).

@mati865
Copy link
Contributor

mati865 commented Dec 9, 2022

the hardest part is probably finding someone who already has an environment set up for building for this target (32-bit windows).

32-bit Windows MSVC to be specific 😄

@rustbot modify labels: -O-windows +O-windows-msvc

@rustbot rustbot added O-windows-msvc Toolchain: MSVC, Operating system: Windows and removed O-windows Operating system: Windows labels Dec 9, 2022
@pnkfelix
Copy link
Member

pnkfelix commented Mar 3, 2023

Just following up on my note from 2022-12-09 above: I'm not sure we have enough interest in this issue for us to keep it at P-high.

I haven't downgraded it to P-medium yet, but I probably will do so the next time I see it in the P-high triage (which is supposed to happen quarterly)

@lqd
Copy link
Member

lqd commented Mar 3, 2023

I have tried on a recent-ish nightly:

  • on a windows x64 host, with an i686 target (like it seems is the case in the OP)
  • having a 32bit LLVM 16.0.0-rc3 lld-link.exe, in a folder with spaces
  • having the project in a folder with spaces
  • having the nightly rustup toolchain in a folder with spaces

And the issue doesn't reproduce, lld seemed to link the executable correctly. Maybe things were fixed since this issue was opened ?

@Boscop are you still able to reproduce this issue ? Do you maybe have a link to a project where we can reproduce the issue, or ensure it doesn't reproduce anymore.

@Noratrieb Noratrieb added O-x86_64 Target: x86-64 processors (like x86_64-*) O-x86_32 Target: x86 processors, 32 bit (like i686-*) and removed O-x86-all labels Oct 25, 2023
@wesleywiser
Copy link
Member

Visited during the compiler team's P-high review. @Boscop have you hit this recently?

The lld codepath which sets the quoting style for COFF images hasn't changed in 6 years. I believe this bug is not actually related to the WASM issue mentioned above.

Since we do not have a repro or any other indication this is still a problem, I'm closing for now.

If anyone does run into this again, please let us know and we'll re-open. Thanks!

@apiraino apiraino removed the P-high High priority label Nov 4, 2023
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-windows-msvc Toolchain: MSVC, Operating system: Windows O-x86_32 Target: x86 processors, 32 bit (like i686-*) O-x86_64 Target: x86-64 processors (like x86_64-*) regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests