Hi:
I want to build a cross compiler mingw-w64 gcc in x86_64-unknown-linux-gnu to
i686-w64-mingw32 with winphreads. From the document in the source package
mingw-w64-v3.1.0/mingw-w64-doc, I know how to build cross gcc with win32
thread. However, I need to use c++11 thread, so I need to build cross gcc with
posix thread. Moreover I know that mingw-w64 support posix thread in
mingw-w64-v3.1.0/mingw-w64-libraries/winpthreads. Unfortunately, the above
document does not explain how to build cross compiler mingw-w64 gcc.
Additional requirement, I need gcc, g++ gfortran and dwarf2 exception mode
As a result, I try the following procedure:
1 #!/bin/sh
2
3 threads=8
4
#build binutils
5 wget http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.bz2 -O - | tar -xj
6 cd binutils-2.24
7 mkdir build; cd $_
8 ../configure --prefix=$HOME/cross --with-sysroot=$HOME/cross
--target=i686-w64-mingw32 --disable-multilib
9 make -j $threads; make check; make install-strip; cd ..; cd ..; rm -rf ~-
10
#install mingw-w64-headers
11 wget
http://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v3.1.0.tar.bz2/download
-O - | tar -xj
12 cd mingw-w64-v3.1.0/mingw-w64-headers
13 mkdir build; cd $_
14 ../configure --prefix=$HOME/cross/i686-w64-mingw32
15 make install; cd $HOME
16
17 ln -s $HOME/cross/i686-w64-mingw32 $HOME/cross/mingw
18
#build static gcc
19 wget http://www.netgull.com/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2 -O - |
tar -xj
20 cd gcc-4.8.2
21 mkdir build; cd $_
22 ../configure --prefix=$HOME/cross --with-sysroot=$HOME/cross
--target=i686-w64-mingw32 --with-gmp=$HOME/gcc --with-mpfr=$HOME/gcc
--with-mpc=$HOME/gcc --with-isl=$HOME/gcc --with-cloog=$HOME/gcc
--enable-threads=posix --enable-checking=release --disable-multilib
--enable-languages=c,c++,fortran --enable-__cxa_atexit --enable-dwarf2
23 make -j $threads all-gcc; make install-gcc
24
25 export PATH=$HOME/cross/bin:$PATH
26
#build mingw-w64-crt
27 cd $HOME/mingw-w64-v3.1.0/mingw-w64-crt
28 mkdir build; cd $_
29 ../configure --prefix=$HOME/cross/i686-w64-mingw32
--with-sysroot=$HOME/cross --host=i686-w64-mingw32
30 make -j $threads; make install-strip
31
#build winpthreads
32 cd $HOME/mingw-w64-v3.1.0/mingw-w64-libraries/winpthreads
33 mkdir build; cd $_
34 ../configure --prefix=$HOME/cross/i686-w64-mingw32
--with-sysroot=$HOME/cross --host=i686-w64-mingw32 --enable-shared=no
35 make -j $threads; make install-strip
36
#build full gcc
37 cd $HOME/gcc-4.8.2/build
38 make -j $threads; make check; make install-strip
However, when I do the last step build full gcc, I get the error as the
following:
.libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_lock':
/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:748:
undefined reference to `_imp__pthread_mutex_lock'
.libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_unlock':
/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:778:
undefined reference to `_imp__pthread_mutex_unlock'
.libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_lock':
/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:748:
undefined reference to `_imp__pthread_mutex_lock'
.libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_unlock':
/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:778:
undefined reference to `_imp__pthread_mutex_unlock'
collect2: error: ld returned 1 exit status
make[5]: *** [libstdc++.la] Error 1
make[5]: Leaving directory
`/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/src'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory
`/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory
`/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3'
make[2]: *** [all] Error 2
make[2]: Leaving directory
`/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: *** Waiting for unfinished jobs....
config.status: executing libtool commands
config.status: executing gstdint.h commands
make[1]: Leaving directory `/home/cguo/gcc-4.8.2/build'
make: *** [all] Error 2
So, how to fix the problem?
Thank you very much
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public