Skip to content

Build failure with MinGW-w64 gcc 5.2.0 #29649

Closed
@alexcrichton

Description

@alexcrichton

Updated description

We need to document that the standard MSYS2 package for gcc will not work when building Rust, you have to install a custom toolchain with a known good version and the win32 threading model, not the pthread threading model.

Original report

Looks related to #29177, perhaps the gcc_eh library picked up new dependencies in 5.2.0?

cc @vadimcn

error: linking with `gcc` failed: exit code: 1
note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-Wl,--large-address-aware" "C:\\msys64\\home\\ale\\rust2\\i686-pc-windows-gnu\\stage1\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\dllcrt2.o" "C:\\msys64\\home\\ale\\rust2\\i686-pc-windows-gnu\\stage1\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\msys64\\home\\ale\\rust2\\i686-pc-windows-gnu\\stage1\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "i686-pc-windows-gnu/stage1/lib/rustlib/i686-pc-windows-gnu/lib\\std-71b07a99.0.o" "-o" "i686-pc-windows-gnu/stage1/lib/rustlib/i686-pc-windows-gnu/lib\\std-71b07a99.dll" "i686-pc-windows-gnu/stage1/lib/rustlib/i686-pc-windows-gnu/lib\\std-71b07a99.metadata.o" "-nodefaultlibs" "-L" "i686-pc-windows-gnu/rt" "-L" "C:\\msys64\\home\\ale\\rust2\\i686-pc-windows-gnu\\llvm\\Release/lib" "-L" "C:\\msys64\\home\\ale\\rust2\\i686-pc-windows-gnu\\stage1\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "-L" "C:\\msys64\\home\\ale\\rust2\\.rust\\lib\\i686-pc-windows-gnu" "-L" "C:\\msys64\\home\\ale\\rust2\\lib\\i686-pc-windows-gnu" "-Wl,-Bstatic" "-Wl,--whole-archive" "-l" "backtrace" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "-l" "gcc_eh" "-l" "gcc_eh" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-l" "advapi32" "-Wl,--whole-archive" "C:\\msys64\\tmp\\rustc.hZLinbW19bbD\\libcollections-71b07a99.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "C:\\msys64\\tmp\\rustc.hZLinbW19bbD\\liballoc-71b07a99.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "C:\\msys64\\tmp\\rustc.hZLinbW19bbD\\librustc_unicode-71b07a99.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "C:\\msys64\\tmp\\rustc.hZLinbW19bbD\\liballoc_jemalloc-71b07a99.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "C:\\msys64\\tmp\\rustc.hZLinbW19bbD\\liblibc-71b07a99.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "C:\\msys64\\tmp\\rustc.hZLinbW19bbD\\librand-71b07a99.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "C:\\msys64\\tmp\\rustc.hZLinbW19bbD\\libcore-71b07a99.rlib" "-Wl,--no-whole-archive" "-shared" "-l" "compiler-rt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\msys64\\home\\ale\\rust2\\i686-pc-windows-gnu\\stage1\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsend.o"
note: C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2.o):(.text+0x1a4b): undefined reference to `pthread_once'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1a3): undefined reference to `pthread_mutex_init'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0xf99): undefined reference to `pthread_once'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0xfa5): undefined reference to `pthread_mutex_lock'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x10b4): undefined reference to `pthread_once'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x10c0): undefined reference to `pthread_mutex_lock'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x118b): undefined reference to `pthread_once'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1197): undefined reference to `pthread_mutex_lock'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x11f9): undefined reference to `pthread_mutex_unlock'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1228): undefined reference to `pthread_mutex_unlock'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x12af): undefined reference to `pthread_once'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x12bb): undefined reference to `pthread_mutex_lock'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x12f7): undefined reference to `pthread_mutex_unlock'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x13b6): undefined reference to `pthread_mutex_unlock'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0xfc4): undefined reference to `pthread_mutex_unlock'
C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.2.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x10df): undefined reference to `pthread_mutex_unlock'
collect2.exe: error: ld returned 1 exit status

error: aborting due to previous error

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
/home/ale/rust2/mk/target.mk:231: recipe for target 'i686-pc-windows-gnu/stage1/lib/rustlib/i686-pc-windows-gnu/lib/stamp.std' failed
make: *** [i686-pc-windows-gnu/stage1/lib/rustlib/i686-pc-windows-gnu/lib/stamp.std] Error 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-windows-gnuToolchain: GNU, Operating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions