2014-02-20 21:04 GMT+01:00 Guo, Gcwenken <gcwenken....@ttu.edu>:
> 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/sh2 3 threads=84
> #build binutils5 wget http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.bz2
> -O - | tar -xj6 cd binutils-2.247 mkdir build; cd $_8 ../configure
> --prefix=$HOME/cross --with-sysroot=$HOME/cross --target=i686-w64-mingw32
> --disable-multilib9 make -j $threads; make check; make install-strip; cd ..;
> cd ..; rm -rf ~-10
> #install mingw-w64-headers11 wget
> http://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v3.1.0.tar.bz2/download
> -O - | tar -xj12 cd mingw-w64-v3.1.0/mingw-w64-headers13 mkdir build; cd
> $_14 ../configure --prefix=$HOME/cross/i686-w64-mingw3215 make install; cd
> $HOME16 17 ln -s $HOME/cross/i686-w64-mingw32 $HOME/cross/mingw18
> #build static gcc19 wget
> http://www.netgull.com/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2 -O - | tar
> -xj20 cd gcc-4.8.221 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-dwarf223 make -j $threads all-gcc; make install-gcc24 25 export
> PATH=$HOME/cross/bin:$PATH26
> #build mingw-w64-crt27 cd $HOME/mingw-w64-v3.1.0/mingw-w64-crt28 mkdir
> build; cd $_29 ../configure --prefix=$HOME/cross/i686-w64-mingw32
> --with-sysroot=$HOME/cross --host=i686-w64-mingw3230 make -j $threads; make
> install-strip31
> #build winpthreads32 cd
> $HOME/mingw-w64-v3.1.0/mingw-w64-libraries/winpthreads33 mkdir build; cd $_34
> ../configure --prefix=$HOME/cross/i686-w64-mingw32 --with-sysroot=$HOME/cross
> --host=i686-w64-mingw32 --enable-shared=no35 make -j $threads; make
> install-strip36
> #build full gcc37 cd $HOME/gcc-4.8.2/build38 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?
>
If you feel like not doing much work, you can checkout my "cross" project,
which can currently build GCC 4.8.2/4.7.3/4.6.4 (disable ada if you're not
running/building GCC 4.8.2, just remove it from this
line<https://github.com/rubenvb/cross/blob/master/scripts/build_mingw_toolchain.sh#L64>
)
The repo is located here:
https://github.com/rubenvb/cross
In any case, you can checkout the "scripts/build_mingw_toolchain.sh" script
which contains all the necessary steps to build a MinGW-w64 compiler.
The current problem you're having is not building the winpthreads DLL.
Cheers,
Ruben
> 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
>
>
------------------------------------------------------------------------------
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