Skip to content

i686-pc-windows-gnu fails to link on appveyor #70316

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
retep998 opened this issue Mar 23, 2020 · 6 comments · Fixed by #70605
Closed

i686-pc-windows-gnu fails to link on appveyor #70316

retep998 opened this issue Mar 23, 2020 · 6 comments · Fixed by #70605
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example O-windows-gnu Toolchain: GNU, Operating system: Windows O-x86_32 Target: x86 processors, 32 bit (like i686-*) (IA-32) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@retep998
Copy link
Member

retep998 commented Mar 23, 2020

error: linking with `i686-w64-mingw32-gcc` failed: exit code: 1
  |
  = note: "i686-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-Wl,--large-address-aware" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\crt2.o" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.0.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.1.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.10.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.11.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.12.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.13.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.14.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.15.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.2.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.3.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.4.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.5.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.6.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.7.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.8.rcgu.o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.build_script_build.aj5y0a64-cgu.9.rcgu.o" "-o" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.exe" "C:\\projects\\winapi-rs\\target\\debug\\build\\winapi-i686-pc-windows-gnu-443effcf81014333\\build_script_build-443effcf81014333.r46olty88oc842v.rcgu.o" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:\\projects\\winapi-rs\\target\\debug\\deps" "-L" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "-Wl,--start-group" "-Wl,-Bstatic" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libstd-7dc27a6f3096fff5.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libpanic_unwind-b9fb1be3dc76db82.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libhashbrown-52ece7fac3462bf3.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\librustc_std_workspace_alloc-92c58a1a3a774a1f.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libbacktrace-d14a966be767447d.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libbacktrace_sys-ceb056ead5f4dd46.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\librustc_demangle-5aaa5927600b79eb.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libunwind-c470ca234bf4591f.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcfg_if-c0a586ae7f2fa67b.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liblibc-81876339e21271aa.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liballoc-1b8d5d0b1b608063.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\librustc_std_workspace_core-8f97c41df79c34b0.rlib" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcore-657b4379f124771d.rlib" "-Wl,--end-group" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcompiler_builtins-c7e55169dc2dbc63.rlib" "-Wl,-Bdynamic" "-ladvapi32" "-lws2_32" "-luserenv" "-lmingwex" "-lmingw32" "-lmsvcrt" "-lmsvcrt" "-luser32" "-lkernel32" "-lgcc" "-lgcc_eh" "-lpthread" "-lkernel32" "C:\\Users\\appveyor\\.rustup\\toolchains\\nightly-i686-pc-windows-gnu\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsend.o"
  = note: C:\Users\appveyor\.rustup\toolchains\nightly-i686-pc-windows-gnu\lib\rustlib\i686-pc-windows-gnu\lib/libpthread.a(libwinpthread_la-thread.o):thread.c:(.text+0x631): undefined reference to `_imp___ultoa'
          C:\Users\appveyor\.rustup\toolchains\nightly-i686-pc-windows-gnu\lib\rustlib\i686-pc-windows-gnu\lib/libpthread.a(libwinpthread_la-thread.o):thread.c:(.text+0xbf7): undefined reference to `_setjmp3'
          C:\Users\appveyor\.rustup\toolchains\nightly-i686-pc-windows-gnu\lib\rustlib\i686-pc-windows-gnu\lib/libpthread.a(libwinpthread_la-thread.o):thread.c:(.text+0xc8d): undefined reference to `_imp___endthreadex'
          C:\Users\appveyor\.rustup\toolchains\nightly-i686-pc-windows-gnu\lib\rustlib\i686-pc-windows-gnu\lib/libpthread.a(libwinpthread_la-thread.o):thread.c:(.text+0xda8): undefined reference to `printf'
          C:\Users\appveyor\.rustup\toolchains\nightly-i686-pc-windows-gnu\lib\rustlib\i686-pc-windows-gnu\lib/libpthread.a(libwinpthread_la-thread.o):thread.c:(.text+0xdd6): undefined reference to `printf'
          C:\Users\appveyor\.rustup\toolchains\nightly-i686-pc-windows-gnu\lib\rustlib\i686-pc-windows-gnu\lib/libpthread.a(libwinpthread_la-thread.o):thread.c:(.text+0x14e2): undefined reference to `longjmp'
          C:\Users\appveyor\.rustup\toolchains\nightly-i686-pc-windows-gnu\lib\rustlib\i686-pc-windows-gnu\lib/libpthread.a(libwinpthread_la-thread.o):thread.c:(.text+0x152e): undefined reference to `_imp___endthreadex'
          C:\Users\appveyor\.rustup\toolchains\nightly-i686-pc-windows-gnu\lib\rustlib\i686-pc-windows-gnu\lib/libpthread.a(libwinpthread_la-thread.o):thread.c:(.text+0x1f47): undefined reference to `_imp___beginthreadex'
          C:\Users\appveyor\.rustup\toolchains\nightly-i686-pc-windows-gnu\lib\rustlib\i686-pc-windows-gnu\lib/libpthread.a(libwinpthread_la-thread.o):thread.c:(.text+0x2484): undefined reference to `strdup'
          C:\Users\appveyor\.rustup\toolchains\nightly-i686-pc-windows-gnu\lib\rustlib\i686-pc-windows-gnu\lib/libpthread.a(libwinpthread_la-rwlock.o):rwlock.c:(.text+0x44e): undefined reference to `printf'
          C:\Users\appveyor\.rustup\toolchains\nightly-i686-pc-windows-gnu\lib\rustlib\i686-pc-windows-gnu\lib/libpthread.a(libwinpthread_la-rwlock.o):rwlock.c:(.text+0x480): undefined reference to `printf'
          

error: aborting due to previous error

Using image: Visual Studio 2017. No environment changes other than installing Rust itself.

@retep998 retep998 added A-linkage Area: linking into static, shared libraries and binaries O-windows-gnu Toolchain: GNU, Operating system: Windows labels Mar 23, 2020
@jonas-schievink jonas-schievink added O-x86 T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Mar 23, 2020
@mati865
Copy link
Contributor

mati865 commented Mar 24, 2020

Has it started with latest nightly?
It'd be good to rule out AppVeyor change by installing previously working nightly.

@tmiasko
Copy link
Contributor

tmiasko commented Mar 31, 2020

The compiler-builtins CI now fails with the same error. The latest working nightly is 2020-03-14.
Looks like it is related to changes from #67502 which included -lpthread in link args.

@mati865
Copy link
Contributor

mati865 commented Mar 31, 2020

@rustbot modify labels: +E-needs-mcve

cc @Amanieu

FWIW winpthreads depend on two libraries:

$ ntldd /mingw64/bin/libwinpthread-1.dll
        KERNEL32.dll => C:\WINDOWS\SYSTEM32\KERNEL32.dll (0x0000000000dd0000)
        msvcrt.dll => C:\WINDOWS\SYSTEM32\msvcrt.dll (0x0000000000dd0000)

@rustbot rustbot added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Mar 31, 2020
@Amanieu
Copy link
Member

Amanieu commented Mar 31, 2020

Ugh, mingw has a stupid amount of circular dependencies in its libraries...

What I am more concerned about is why Rust CI didn't catch this. Maybe it's because it is using an older mingw version. We should considering upgrading it.

@mati865
Copy link
Contributor

mati865 commented Mar 31, 2020

@Amanieu I'd love to upgrade MinGW on the CI as it would help me with a few thing but there is a problem. Upstream no longer provides prebuilt GCC and latest version available had issue where it ran out of memory on the CI: #51989
I can help with building GCC or providing builds but I don't really know how to start.

@Amanieu
Copy link
Member

Amanieu commented Mar 31, 2020

I managed to reproduce this locally. It only happens if you don't have MSYS installed, in which case rustc will use the gcc and libraries from the rust-mingw component.

This is a bit worrying, since it means that rust-mingw isn't being properly tested in CI.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 31, 2020
Add missing -lmsvcrt on mingw after -lpthread

Fixes rust-lang#70316
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 31, 2020
Add missing -lmsvcrt on mingw after -lpthread

Fixes rust-lang#70316
@bors bors closed this as completed in 1ae3b50 Apr 1, 2020
@Noratrieb Noratrieb added O-x86_32 Target: x86 processors, 32 bit (like i686-*) (IA-32) and removed O-x86-all labels Oct 25, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example O-windows-gnu Toolchain: GNU, Operating system: Windows O-x86_32 Target: x86 processors, 32 bit (like i686-*) (IA-32) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants