Skip to content

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

Description

@Boscop

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)

Activity

  1. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Nov 2, 2020
  2. jyn514 commented on Nov 2, 2020

    @jyn514
    Member

    This looks awfully like #76466.

  3. mati865 commented on Nov 2, 2020

    @mati865
    Member

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

  4. added
    A-linkageArea: linking into static, shared libraries and binaries
    O-windowsOperating system: Windows
    O-x3232 bit ABI for x86-64
    on Nov 2, 2020
  5. added
    P-highHigh priority
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Nov 4, 2020
  6. apiraino commented on Nov 4, 2020

    @apiraino
    Contributor

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

  7. mati865 commented on Nov 4, 2020

    @mati865
  8. added and removed
    O-x3232 bit ABI for x86-64
    on Nov 4, 2020
  9. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Nov 4, 2020
  10. pnkfelix commented on Dec 9, 2022

    @pnkfelix
    Contributor

    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).

  11. mati865 commented on Dec 9, 2022

    @mati865
    Member

    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

  12. added
    O-windows-msvcToolchain: MSVC, Operating system: Windows
    and removed
    O-windowsOperating system: Windows
    on Dec 9, 2022
  13. pnkfelix commented on Mar 3, 2023

    @pnkfelix
    Contributor

    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)

  14. lqd commented on Mar 3, 2023

    @lqd
    Member

    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.

  15. added
    O-x86_64Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64)
    O-x86_32Target: x86 processors, 32 bit (like i686-*) (also known as IA-32, i386, i586, i686)
    and removed on Oct 25, 2023
  16. wesleywiser commented on Nov 3, 2023

    @wesleywiser
    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!

  17. Walnut356 commented on Apr 6, 2026

    @Walnut356
    Contributor

    Well, it's been two and a half years but I think I have also run into this issue on 64bit Windows. LLD works fine with no spaces in the build path, but breaks when there are spaces. Similar error messages to op's.

    # .cargo/config.toml
    [target.x86_64-pc-windows-gnu]
    rustflags = ["-C", "link-arg=-fuse-ld=lld"]

    Windows version: Microsoft Windows [Version 10.0.19045.6466]

    ld.lld --version
    LLD 22.1.2 (https://github.com/llvm/llvm-project 1ab49a973e210e97d61e5db6557180dcb92c3e98) (compatible with GNU linkers)
    
    cargo +stable-x86_64-pc-windows-gnu --version
    cargo 1.94.1 (29ea6fb6a 2026-03-24)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.O-windows-msvcToolchain: MSVC, Operating system: WindowsO-x86_32Target: x86 processors, 32 bit (like i686-*) (also known as IA-32, i386, i586, i686)O-x86_64Target: x86-64 processors (like x86_64-*) (also known as amd64 and x64)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions