GNOME Bugzilla – Bug 737120
build-toolchains: Failure to build gcc (pthread issue ?)
Last modified: 2014-11-08 14:14:45 UTC
I've started looking at building a more "recent" toolchain for cerbero I already pushed 3 minor fixes to master which makes it build (mingw-w64-headers, binutils, gcc-core (and deps)) ... until the point where mingw-w64 configure fails. checking _mingw_mac.h usability... no checking _mingw_mac.h presence... no checking for _mingw_mac.h... no configure: error: Please check if the mingw-w64 header set and the build/host option are set properly. configure: error: ./configure failed for mingw-w64-crt Running command './configure --prefix /home/bilboed/mingw/linux/w64 --libdir /home/bilboed/mingw/linux/w64/lib --without-headers --with-sysroot=$CERBERO_PREFIX --disable-lib32 --host=x86_64-w64-mingw32 --disable-maintainer-mode --disable-silent-rules --enable-introspection ' That header (and all other from mingw-w64-header) is in fact in ~/mingw/linux/w64/x86_64-w64-mingw32/include/ (and not in $prefix/include) Should we add that directory somehow ? How did it work originally ?
Something else I just noticed in the config.log ... it's picking up the system-wide gcc/strip/... and not the ones built in the gcc-core step.
Easy way to reproduce : tools/build-toolchain.sh
This particular issue has been fixed. But it now fails further on when building gcc (not gcc-core) make[3]: Entering directory `/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/src' /bin/sh ../libtool --tag CXX --mode=link /home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/./gcc/xgcc -shared-libgcc -B/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/./gcc -nostdinc++ -L/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/src -L/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/src/.libs -L/home/bilboed/mingw/linux/w32/i686-w64-mingw32/lib -L/home/bilboed/mingw/linux/w32/mingw/lib -isystem /home/bilboed/mingw/linux/w32/i686-w64-mingw32/include -isystem /home/bilboed/mingw/linux/w32/mingw/include -B/home/bilboed/mingw/linux/w32/i686-w64-mingw32/bin/ -B/home/bilboed/mingw/linux/w32/i686-w64-mingw32/lib/ -isystem /home/bilboed/mingw/linux/w32/i686-w64-mingw32/include -isystem /home/bilboed/mingw/linux/w32/i686-w64-mingw32/sys-include -Wl,-O1 -no-undefined -bindir "/home/bilboed/mingw/linux/w32/i686-w64-mingw32/lib/../lib" -Wl,--gc-sections -DDLL_EXPORT -DPIC -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=libstdc++.la -o libstdc++.la -version-info 6:17:0 -Wl,--version-script=libstdc++-symbols.ver -lm -rpath /home/bilboed/mingw/linux/w32/i686-w64-mingw32/lib/../lib compatibility.lo compatibility-debug_list.lo compatibility-debug_list-2.lo compatibility-list.lo compatibility-list-2.lo compatibility-parallel_list.lo compatibility-parallel_list-2.lo compatibility-c++0x.lo compatibility-atomic-c++0x.lo compatibility-thread-c++0x.lo ../libsupc++/libsupc++convenience.la ../src/c++98/libc++98convenience.la ../src/c++11/libc++11convenience.la libtool: link: rm -fr .libs/libstdc++.dll.a libtool: link: /home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/./gcc/xgcc -shared-libgcc -B/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/./gcc -nostdinc++ -L/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/src -L/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/src/.libs -L/home/bilboed/mingw/linux/w32/i686-w64-mingw32/lib -L/home/bilboed/mingw/linux/w32/mingw/lib -isystem /home/bilboed/mingw/linux/w32/i686-w64-mingw32/include -isystem /home/bilboed/mingw/linux/w32/mingw/include -B/home/bilboed/mingw/linux/w32/i686-w64-mingw32/bin/ -B/home/bilboed/mingw/linux/w32/i686-w64-mingw32/lib/ -isystem /home/bilboed/mingw/linux/w32/i686-w64-mingw32/include -isystem /home/bilboed/mingw/linux/w32/i686-w64-mingw32/sys-include -shared -nostdlib /home/bilboed/mingw/linux/w32/i686-w64-mingw32/lib/dllcrt2.o /home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/./gcc/crtbegin.o .libs/compatibility.o .libs/compatibility-debug_list.o .libs/compatibility-debug_list-2.o .libs/compatibility-list.o .libs/compatibility-list-2.o .libs/compatibility-parallel_list.o .libs/compatibility-parallel_list-2.o .libs/compatibility-c++0x.o .libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o -Wl,--whole-archive ../libsupc++/.libs/libsupc++convenience.a ../src/c++98/.libs/libc++98convenience.a ../src/c++11/.libs/libc++11convenience.a -Wl,--no-whole-archive -L/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/src -L/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/src/.libs -L/home/bilboed/mingw/linux/w32/i686-w64-mingw32/lib -L/home/bilboed/mingw/linux/w32/mingw/lib -L/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/./gcc -L/home/bilboed/mingw/linux/w32/i686-w64-mingw32/bin -L/home/bilboed/mingw/linux/w32/mingw/lib/../lib -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt /home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/./gcc/crtend.o -Wl,-O1 -Wl,--gc-sections -Wl,--version-script=libstdc++-symbols.ver -o .libs/libstdc++-6.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libstdc++.dll.a Creating library file: .libs/libstdc++.dll.a .libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_lock': /home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:769: undefined reference to `_imp__pthread_mutex_lock' .libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_unlock': /home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:799: undefined reference to `_imp__pthread_mutex_unlock' .libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_lock': /home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:769: undefined reference to `_imp__pthread_mutex_lock' .libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_unlock': /home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:799: undefined reference to `_imp__pthread_mutex_unlock' collect2: error: ld returned 1 exit status make[3]: *** [libstdc++.la] Error 1 make[3]: Leaving directory `/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/src' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/bilboed/cerbero/sources/mingw-w32-lin/gcc-4.7.3/i686-w64-mingw32/libstdc++-v3' make: *** [all] Error 2
Forgot to mention, it also fails with the 64bit gcc (logs above are from a manual build run)
For the record, the first issue was fixed in: commit 29dce9b17bfb72f0a3b21e99addd376312c287da Author: Andoni Morales Alastruey <ylatuya@gmail.com> Date: Tue Sep 23 19:28:55 2014 +0200 toolchain: fix build when toolchain env vars are set mingw-w64-crt and winpthreads must be built with gcc bootstraped by gcc-core. Whith CC and friends env variables set, it's using system toolchain instead of the one built with gcc-core commit abbfadd3c7691c42e71e127d98dccc755f60a626 Author: Andoni Morales Alastruey <ylatuya@gmail.com> Date: Tue Sep 23 19:27:49 2014 +0200 gmp: target 32 ABI when crosscompiled from a x86_64 host commit c9af4bb3820cbc9dcdd3d115e5bb5b5b364783f9 Author: Andoni Morales Alastruey <ylatuya@gmail.com> Date: Tue Sep 23 18:15:01 2014 +0200 toolchain: fix mingw-w32 toolchain build for linux Set host='' to prevent the linux.config to append the host triplet in toolchain env variables. Since we are cross-compiling from x86_64, we don't want to end up with CC=i686-linux-gnu-gcc
Created attachment 286973 [details] gcc compile log We can't reproduce the issue from debian based distros. I upload the full log here
I did a new completely-from-scratch build. Some findings: $ find /home/bilboed/cerbero/ -iname 'libpthr*' /home/bilboed/cerbero/sources/mingw-w64-lin/winpthreads-v2.0.8/mingw-w64-libraries/winpthreads/libpthread.a /home/bilboed/cerbero/sources/mingw-w64-lin/winpthreads-v2.0.8/mingw-w64-libraries/winpthreads/libgcc/libpthread.a $ find /home/bilboed/mingw/ -iname 'libpthr*' /home/bilboed/mingw/linux/w64/lib/libpthread.a => i.e. there's only a static libpthread. Is that expected/normal ?
Obviously... it wasn't expected :) commit 6470735071d45dc04722a2456089b79d1d71804d Author: Edward Hervey <bilboed@bilboed.com> Date: Wed Sep 24 17:17:38 2014 +0200 toolchain: Specify proper LD/CPP when building For some reason, on non-debian, if it's not specified the host (i.e. linux/x86) ones are picked up. https://bugzilla.gnome.org/show_bug.cgi?id=737120