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

Build failure in i686-pc-windows-gnu in MSYS2 with mingw-w64-i686-gcc 6.3.0-1 (rustbuild) #39357

Closed
segevfiner opened this issue Jan 28, 2017 · 10 comments

Comments

@segevfiner
Copy link
Contributor

segevfiner commented Jan 28, 2017

It looks like gcc_eh is dependent on -pthread for this build mingw gcc, which we are not using.

We probably need to add it after gcc_eh for gcc versions that use winpthreads if we want to support this. And it might also require copying some extra dlls if some this is built non static, but I'm not sure.

Otherwise we need to document what a user should do since the instructions in the README.md don't work.

The AppVeyor configuration seems to use a different gcc toolchain to work around this.

Commands

./configure --disable-manage-submodules
./x.py build --stage 1 src/libtest

Log

$ ./x.py build --stage 1 src/libtest
downloading https://static.rust-lang.org/dist/2016-12-20/rust-std-beta-i686-pc-windows-gnu.tar.gz
extracting C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/cache/2016-12-20/rust-std-beta-i686-pc-windows-gnu.tar.gz
downloading https://static.rust-lang.org/dist/2016-12-20/rustc-beta-i686-pc-windows-gnu.tar.gz
extracting C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/cache/2016-12-20/rustc-beta-i686-pc-windows-gnu.tar.gz
downloading https://s3.amazonaws.com/rust-lang-ci/cargo-builds/bfee18f73287687c543bda8c35e4e33808792715/cargo-nightly-i686-pc-windows-gnu.tar.gz
extracting C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/cache/bfee18f73287687c543bda8c35e4e33808792715/cargo-nightly-i686-pc-windows-gnu.tar.gz
   Compiling libc v0.2.17
   Compiling build_helper v0.1.0 (file:///C:/Users/Segev/prj/rust/msys64/home/Segev/rust/src/build_helper)
   Compiling getopts v0.2.14
   Compiling gcc v0.3.40
   Compiling rustc-serialize v0.3.19
   Compiling num_cpus v0.2.13
   Compiling filetime v0.1.10
   Compiling cmake v0.1.18
   Compiling toml v0.1.30
   Compiling bootstrap v0.0.0 (file:///C:/Users/Segev/prj/rust/msys64/home/Segev/rust/src/bootstrap)
error: linking with `gcc` failed: exit code: 1
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:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\crt2.o" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/bootstrap\\debug\\deps\\rustdoc-cac1478551edc83e.0.o" "-o" "C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/bootstrap\\debug\\deps\\rustdoc-cac1478551edc83e.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/bootstrap\\debug\\deps" "-L" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libbootstrap-6f04f84317445243.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libtoml-d0f5ce18ac66b2a1.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\librustc_serialize-3b865aa3ee09716b.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libnum_cpus-513a8863e609ac66.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libfiletime-d560767a4c777792.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libcmake-d69b39de971f47cb.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libgcc-37c8c9cdcdd8c50f.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\liblibc-6b3f59a9afc30852.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libbuild_helper-d5b659912403c159.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libgetopts-22ac765ab130e957.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libstd-7d6126f0ef0901cb.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libpanic_unwind-b4daa9765d3ae0bb.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libunwind-4a37909219e60225.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liblibc-3df323c429f37cf5.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\librand-5792a3895fb54557.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcollections-08cde4e33bbaacfd.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liballoc-eb15a6a74d86ce91.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liballoc_system-8ee1eedae7ebf6c6.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libstd_unicode-ecd22a4806fad3c6.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcore-5aba7a22a1c2d47f.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcompiler_builtins-3e1adf4ec17675c1.rlib" "-l" "advapi32" "-l" "advapi32" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-l" "gcc_eh" "-l" "gcc_eh" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsend.o"
  = note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-Wl,--large-address-aware" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\crt2.o" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/bootstrap\\debug\\deps\\bootstrap-abaa8f61265cceaa.0.o" "-o" "C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/bootstrap\\debug\\deps\\bootstrap-abaa8f61265cceaa.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/bootstrap\\debug\\deps" "-L" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libbootstrap-6f04f84317445243.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libtoml-d0f5ce18ac66b2a1.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\librustc_serialize-3b865aa3ee09716b.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libnum_cpus-513a8863e609ac66.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libfiletime-d560767a4c777792.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libcmake-d69b39de971f47cb.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libgcc-37c8c9cdcdd8c50f.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\liblibc-6b3f59a9afc30852.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libbuild_helper-d5b659912403c159.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libgetopts-22ac765ab130e957.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libstd-7d6126f0ef0901cb.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libpanic_unwind-b4daa9765d3ae0bb.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libunwind-4a37909219e60225.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liblibc-3df323c429f37cf5.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\librand-5792a3895fb54557.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcollections-08cde4e33bbaacfd.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liballoc-eb15a6a74d86ce91.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liballoc_system-8ee1eedae7ebf6c6.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libstd_unicode-ecd22a4806fad3c6.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcore-5aba7a22a1c2d47f.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcompiler_builtins-3e1adf4ec17675c1.rlib" "-l" "advapi32" "-l" "advapi32" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-l" "gcc_eh" "-l" "gcc_eh" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsend.o"
  = note: C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2.o):(.text+0x19bf): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1a3): undefined reference to `pthread_mutex_init'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0xfd9): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0xfe5): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x10f4): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1100): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x11cb): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x11d7): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1239): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1268): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x12ef): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x12fb): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1337): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x13f6): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1004): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x111f): undefined reference to `pthread_mutex_unlock'
collect2.exe: error: ld returned 1 exit status


  = note: C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2.o):(.text+0x19bf): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1a3): undefined reference to `pthread_mutex_init'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0xfd9): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0xfe5): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x10f4): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1100): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x11cb): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x11d7): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1239): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1268): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x12ef): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x12fb): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1337): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x13f6): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1004): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x111f): undefined reference to `pthread_mutex_unlock'
collect2.exe: error: ld returned 1 exit status


error: aborting due to previous error

error: aborting due to previous error

Build failed, waiting for other jobs to finish...
Build failed, waiting for other jobs to finish...
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:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\crt2.o" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsbegin.o" "-L" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/bootstrap\\debug\\deps\\rustc-54178caa5e9440c9.0.o" "-o" "C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/bootstrap\\debug\\deps\\rustc-54178caa5e9440c9.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "C:/Users/Segev/prj/rust/msys64/home/Segev/rust/build/bootstrap\\debug\\deps" "-L" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libbootstrap-6f04f84317445243.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libtoml-d0f5ce18ac66b2a1.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\librustc_serialize-3b865aa3ee09716b.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libnum_cpus-513a8863e609ac66.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libfiletime-d560767a4c777792.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libcmake-d69b39de971f47cb.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libgcc-37c8c9cdcdd8c50f.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\liblibc-6b3f59a9afc30852.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libbuild_helper-d5b659912403c159.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\bootstrap\\debug\\deps\\libgetopts-22ac765ab130e957.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libstd-7d6126f0ef0901cb.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libpanic_unwind-b4daa9765d3ae0bb.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libunwind-4a37909219e60225.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liblibc-3df323c429f37cf5.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\librand-5792a3895fb54557.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcollections-08cde4e33bbaacfd.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liballoc-eb15a6a74d86ce91.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\liballoc_system-8ee1eedae7ebf6c6.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libstd_unicode-ecd22a4806fad3c6.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcore-5aba7a22a1c2d47f.rlib" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\libcompiler_builtins-3e1adf4ec17675c1.rlib" "-l" "advapi32" "-l" "advapi32" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-l" "gcc_eh" "-l" "gcc_eh" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "C:\\Users\\Segev\\prj\\rust\\msys64\\home\\Segev\\rust\\build\\i686-pc-windows-gnu\\stage0\\lib\\rustlib\\i686-pc-windows-gnu\\lib\\rsend.o"
  = note: C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2.o):(.text+0x19bf): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1a3): undefined reference to `pthread_mutex_init'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0xfd9): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0xfe5): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x10f4): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1100): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x11cb): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x11d7): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1239): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1268): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x12ef): undefined reference to `pthread_once'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x12fb): undefined reference to `pthread_mutex_lock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1337): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x13f6): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x1004): undefined reference to `pthread_mutex_unlock'
C:/Users/Segev/prj/rust/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/libgcc_eh.a(unwind-dw2-fde.o):(.text+0x111f): undefined reference to `pthread_mutex_unlock'
collect2.exe: error: ld returned 1 exit status


error: aborting due to previous error

error: Could not compile `bootstrap`.

To learn more, run the command again with --verbose.

Workaround

I got the bootstrap.exe to build but no further with:

export RUSTFLAGS="-lgcc_eh -lpthread"

Probably due to this in cargo src/cargo/ops/cargo_rustc/context.rs:907-912

I also tried to use the compiler that AppVeyor uses but simply adding it to the PATH doesn't seem to be enough as rustc is insistent on using the installed gcc as the linker rather than the gcc that was added to the path. What eventually worked was to remove mingw-w64-i686-gcc in msys2 and add the gcc used in the AppVeyor config to the PATH. 😫

@alexcrichton

@ncihnegn
Copy link

You may want to use my MinGW build under https://github.com/ncihnegn/mingw-w64-packages/rust-git.

@mati865
Copy link
Contributor

mati865 commented Mar 18, 2017

Rustbuild will work only if you use Rust build with pthread (like Rust package from MSYS2) and add few hacks to Rust code.

@alexcrichton Ideally there could be config option in config.toml adding -lpthread where it is needed.

@petrochenkov
Copy link
Contributor

petrochenkov commented Mar 18, 2017

FWIW I had x.py test successfully passing with i686-6.3.0-win32-dwarf-rt_v5-rev1 mingw toolchain (e.g. win32 threading model) without any extra hacks maybe a couple of weeks ago.
Not sure what are you guys doing to get all these problems.
Also, why would you need a Rust package from MSYS2, given that rustup exists.

As a side note, the GCC package (+other toolchain) from MSYS2 is a ticking bomb, it broke on update so many times in the past, and if this happens it cannot be easily downgraded. It should be recommended to use the official standalone installer from https://mingw-w64.org/doku.php/download/mingw-builds which also gives you a choice of threading and exception models and precise version.

@mati865
Copy link
Contributor

mati865 commented Mar 18, 2017

Issue with i686-6.3.0-win32-dwarf is nobody use it (696 weekly downloads right now) vs i686-6.3.0-posix-dwarf (10,167 weekly downloads right now): https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/6.3.0/
Using MSYS2 toolchain is the only way to provide MSYS2 packages.

I've considered packaging rustup instead of Rust but I'll need to discuss with MSYS2 developers.

@petrochenkov
Copy link
Contributor

Oh, you are actually doing packaging for MSYS2, looks like it brings some special set of concerns.
The usual development of rustc is not so tied to MSYS2's ecosystem, so a standalone toolchain and win32 threading model can be used in most cases.

@mati865
Copy link
Contributor

mati865 commented Mar 18, 2017

@petrochenkov x.py test for Rust build with MSYS2 i686 GCC, debug* options were not touched in config.toml:

failures:
    [debuginfo-gdb] debuginfo-gdb\borrowed-enum.rs
    [debuginfo-gdb] debuginfo-gdb\generic-struct-style-enum.rs
    [debuginfo-gdb] debuginfo-gdb\generic-tuple-style-enum.rs
    [debuginfo-gdb] debuginfo-gdb\packed-struct.rs
    [debuginfo-gdb] debuginfo-gdb\recursive-struct.rs
    [debuginfo-gdb] debuginfo-gdb\struct-in-enum.rs
    [debuginfo-gdb] debuginfo-gdb\struct-style-enum.rs
    [debuginfo-gdb] debuginfo-gdb\tuple-style-enum.rs
    [debuginfo-gdb] debuginfo-gdb\union-smoke.rs
    [debuginfo-gdb] debuginfo-gdb\unique-enum.rs

test result: FAILED. 86 passed; 10 failed; 11 ignored; 0 measured

Which is not surprising as those tests fail on Linux also, here is more detailed log: https://paste.ubuntu.com/24201347/

@petrochenkov
Copy link
Contributor

@mati865
This may be a duplicate of one of these issues - #40184 #40557 #39838

@alexcrichton
Copy link
Member

The is unfortunately an expected failures, we're just not compatible with the pthread toolchain right now. Support needs to be added to libstd to detect these hidden dependencies and emit appropriate link directives, and it means an entirely new toolchain must be created regardless.

@mati865
Copy link
Contributor

mati865 commented Mar 20, 2017

I currently have this patch: https://gist.github.com/mati865/6fd83fd24bd17dc4639e03a8211bc319
But it's a bad solution and you cannot build Rust unless you already have patched Rust.

@alexcrichton
Copy link
Member

I believe this is fixed on master, so closing.

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

5 participants