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

cross build --target x86_64-pc-windows-gnu missing synchronization library #1453

Open
4 of 11 tasks
mcarson-sandia opened this issue Mar 5, 2024 · 5 comments
Open
4 of 11 tasks

Comments

@mcarson-sandia
Copy link

mcarson-sandia commented Mar 5, 2024

Checklist

Describe your issue

I am unable to cross compile for windows on the 1.78.0 nightly due to the following error (it also occurs on new cargo init project).

➜ cross-test git:(master) ✗ cross build --target x86_64-pc-windows-gnu --release Compiling cross-test v0.1.0 (/project) error: linking withx86_64-w64-mingw32-gcc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/rust/lib/rustlib/x86_64-unknown-linux-gnu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/rust/bin" VSLANG="1033" "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/rsbegin.o" "/tmp/rustcjyWv8U/symbols.o" "/target/x86_64-pc-windows-gnu/release/deps/cross_test-451dd26ad7f599f1.cross_test.a1c4cb6c121cfa17-cgu.0.rcgu.o" "/target/x86_64-pc-windows-gnu/release/deps/cross_test-451dd26ad7f599f1.46gbdv0597lf24is.rcgu.o" "-L" "/target/x86_64-pc-windows-gnu/release/deps" "-L" "/target/release/deps" "-L" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib" "-Wl,-Bstatic" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libstd-53284af569e5f6ed.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libpanic_unwind-1886f36c6527e50c.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libobject-78ff9a17aa8e2177.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libmemchr-f41420a0b26cc037.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libaddr2line-8c4034e188fcccc2.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libgimli-e63890247676e919.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/librustc_demangle-77e65611771dd860.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libstd_detect-6b3d6f307421a89a.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libhashbrown-03166ff941b0d917.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/librustc_std_workspace_alloc-0cf300b3796ae454.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libminiz_oxide-52f9046473ace87d.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libadler-9db720405742c618.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libunwind-1bdaeecf79a3def1.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libcfg_if-9df93765f1cbf124.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/liblibc-bca6b94a9de46761.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/liballoc-7724ac2fef16edeb.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/librustc_std_workspace_core-430c8ff8148a7795.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libcore-0a5a55778bdea4e0.rlib" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/libcompiler_builtins-9cd876ce3c045fc3.rlib" "-Wl,-Bdynamic" "-lkernel32" "-ladvapi32" "-lkernel32" "-lntdll" "-luserenv" "-lws2_32" "-lsynchronization" "-lkernel32" "-lws2_32" "-lkernel32" "-lntdll" "-lkernel32" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-L" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib" "-o" "/target/x86_64-pc-windows-gnu/release/deps/cross_test-451dd26ad7f599f1.exe" "-Wl,--gc-sections" "-no-pie" "-Wl,-O1" "-nodefaultlibs" "/rust/lib/rustlib/x86_64-pc-windows-gnu/lib/rsend.o"
= note: /usr/bin/x86_64-w64-mingw32-ld: cannot find -lsynchronization
collect2: error: ld returned 1 exit status

error: could not compile cross-test (bin "cross-test") due to 1 previous error
`

#1445 is close but that is specific to a python lib where as I believe the synchronization library should be in the standard mingw install?

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

No response

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

cross 0.2.5

Example

mkdir cross-test
cd cross-test
cargo init
cross build --target x86_64-pc-windows-gnu --release

Additional information / notes

I tested this on an ubuntu 22 host, in an ubuntu 22 container and in an ubuntu 24 container. I have made sure my mingw package is up to date.

@mcarson-sandia
Copy link
Author

I did some testing and everything works on nightly-2024-02-26-x86_64-unknown-linux-gnu but is broken on any nightly version after that.

@Emilgardis
Copy link
Member

can you try this with cross from the main branch instead?

cargo install cross --git https://github.com/cross-rs/cross

@mcarson-sandia
Copy link
Author

That appears to have fixed it on the latest nightly. Is there an ETA on when the next release will be so I can switch our pipelines back to a tagged release?

Amanieu added a commit to Amanieu/hashbrown that referenced this issue Mar 6, 2024
@mcarson-sandia
Copy link
Author

mcarson-sandia commented Mar 6, 2024

Let me know if I should make this a new issue but while that fix did work on my local tests with a bare bones project when applying it to our CI/CD pipelines it fails with the following error (pinning to the 2024-02-26 nightly does work though with no other changes).

$ cross build --target x86_64-pc-windows-gnu  --features vendored-openssl --release
[cross] warning: got volume of "/usr/local/share/ca-certificates/ca.crt:/usr/local/share/ca-certificates/ca.crt" which is not a valid environment variable name. the proper syntax is `volumes = ["ENVVAR=/path/to/directory"]`

@Emilgardis
Copy link
Member

Emilgardis commented Mar 6, 2024

that warning is explaining itself, you have a malformatted entry in the config. the reason it fails in CI is because warnings are treated as errors in CI now due to many people missing the warnings that cross gives, and sometimes even believing they are using cross when they actually weren't

Amanieu added a commit to Amanieu/hashbrown that referenced this issue Mar 7, 2024
Amanieu added a commit to Amanieu/hashbrown that referenced this issue Mar 7, 2024
VorpalBlade added a commit to VorpalBlade/ini-merge that referenced this issue Mar 14, 2024
VorpalBlade added a commit to VorpalBlade/ini-roundtrip that referenced this issue Mar 14, 2024
Itsusinn added a commit to Itsusinn/tuic that referenced this issue Mar 23, 2024
FrancisRussell added a commit to FrancisRussell/zoog that referenced this issue Mar 31, 2024
FrancisRussell added a commit to FrancisRussell/zoog that referenced this issue Apr 1, 2024
It's unclear what's happening here besides a linking error.  The
relevant issues are: cross-rs/cross#1463 and
cross-rs/cross#1453.

Pinning to cross 0.2.5 and swtching to the Rust stable toolchain seems
to fix things for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants