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

x86_64-pc-windows-msvc Link error with very large number of objects #1441

Open
4 of 11 tasks
estk opened this issue Feb 7, 2024 · 4 comments
Open
4 of 11 tasks

x86_64-pc-windows-msvc Link error with very large number of objects #1441

estk opened this issue Feb 7, 2024 · 4 comments
Labels
A-windows Area: windows targets

Comments

@estk
Copy link

estk commented Feb 7, 2024

Checklist

Describe your issue

Linking fails with a very large number of objects on x86_64-pc-windows-msvc.

What target(s) are you cross-compiling for?

other (specify in description)

Which operating system is the host (e.g computer cross is on) running?

  • macOS
  • Windows
  • Linux / BSD
  • other OS (specify in description)

What architecture is the host?

  • x86_64 / AMD64
  • arm32
  • arm64 (including Mac M1)

What container engine is cross using?

  • docker
  • podman
  • other container engine (specify in description)

cross version

0.2.5

Example

cross build --release -p mypackage
...
 = note: 0048:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
          0048:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
          0048:err:systray:initialize_systray Could not create tray window
          0024:err:environ:build_command_line command line too long (38785)

Additional information / notes

I found this issue in rustc: rust-lang/rust#41190, and it makes me wonder if the workaround implemented there is somehow not getting triggered in the cross docker container.

Note: that the msvc docker container was built unmodified from the cross-toolchain image

@Emilgardis Emilgardis added the A-windows Area: windows targets label Feb 8, 2024
@Emilgardis
Copy link
Member

Emilgardis commented Feb 8, 2024

are you sure you're actually using cross? We only support msvc via https://github.com/cross-rs/cross-toolchains, which you need to build yourself. Cross will output a warning if it fallbacks to not using a container

I should've read the last note in your report :)

@Emilgardis
Copy link
Member

Can you show the entire build log with -v added to the cross invocation

@estk
Copy link
Author

estk commented Feb 8, 2024

@Emilgardis unfortunately I cant post the log publicly. Can you tell me what you're looking for?

I can confirm that the link command is extremely long 38k chars sounds right.

If you look at the rust issue, their fix seemed trivial, however i am not familiar enough with how rust links to know if we can get in the middle of object generation and linking...

@Emilgardis
Copy link
Member

I just wanted more context, but it's fine :) A way to reproduce this would be good though.

Do you see any "linker failed with exit code" message?

https://github.com/rust-lang/rust/blob/5d3d3479d774754856db2db3e439dfb88ef3c52f/compiler/rustc_codegen_ssa/src/back/link.rs#L1544-L1557

I suspect this is the root problem, the fallback is never invoked, and I think that's because WINE doesn't give us error code E2BIG (7)

I think a fix would have to be done in rustc here or we wrap wine and translate the error code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-windows Area: windows targets
Projects
None yet
Development

No branches or pull requests

2 participants