On Thu, Jun 20, 2013 at 12:25 PM, Christer Solskogen <christer.solsko...@gmail.com> wrote: > > On 20.06.2013 05:20, Dongsheng Song wrote: > > On Thu, Jun 20, 2013 at 12:35 AM, Christer Solskogen > > <christer.solsko...@gmail.com> wrote: > >> On 19.06.2013 11:37, Dongsheng Song wrote: > >>> I can build i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc under > >>> Linux, but when I use this compiler to compile native Windows > >>> compiler, gcc 4.7 success, gcc 4.8 failed with same build script like > >>> this: > >>> > >>> make[2]: Entering directory > >>> `/home/cauchy/obj/native/gcc-4.8-win32/gcc/gcc' > >>> g++ -c -g -O2 -DIN_GCC -fno-exceptions -fno-rtti > >> > >> ^^^^^^ > >> > >> Should not be there. What you should see is x86_64-w64-mingw32-g++. And > >> tells me that you probably have the wrong --host setting for configure. > >> Gcc needs something like --target=x86_64-w64-mingw32 > >> --host=x86_64-w64-mingw32 --build=x86_64-unknown-linux-gnu > >> > >> -- > >> chs > >> > > > > This is gcc 4.8 wrong, since I have passed the correct settings: > > > > $ echo ${GCC_SRC_ROOT}/configure \ > >> --prefix=${SYS_ROOT} \ > >> --with-sysroot=${SYS_ROOT} \ > >> --build=${BUILD_TRIPLET} --host=${TARGET_TRIPLET} > >> --target=${TARGET_TRIPLET} \ > >> --disable-multilib --disable-nls --disable-win32-registry \ > >> --enable-checking=release --enable-languages=c,c++,fortran \ > >> --with-fpmath=sse \ > >> --with-gmp=${SYS_3RD_ROOT} --with-mpfr=${SYS_3RD_ROOT} > >> --with-mpc=${SYS_3RD_ROOT} > > /home/cauchy/vcs/svn/gcc/branches/gcc-4_8-branch/configure > > --prefix=/home/cauchy/native/gcc-4.8-win32 > > --with-sysroot=/home/cauchy/native/gcc-4.8-win32 > > --build=x86_64-unknown-linux-gnu --host=i686-w64-mingw32 > > --target=i686-w64-mingw32 --disable-multilib --disable-nls > > --disable-win32-registry --enable-checking=release > > --enable-languages=c,c++,fortran --with-fpmath=sse > > --with-gmp=/home/cauchy/native/gcc-4.8-win32-3rd > > --with-mpfr=/home/cauchy/native/gcc-4.8-win32-3rd > > --with-mpc=/home/cauchy/native/gcc-4.8-win32-3rd > > > > Could you post $CC, $CFLAGS and/or $CXXFLAGS? Also the output of gcc -v > and i686-w64-mingw32-gcc -v?
Not set any $CC, $CFLAGS and/or $CXXFLAGS. cauchy@dre-syslog:~/src$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.2 (Debian 4.7.2-5) cauchy@dre-syslog:~/src$ i686-w64-mingw32-gcc -v Using built-in specs. COLLECT_GCC=i686-w64-mingw32-gcc COLLECT_LTO_WRAPPER=/home/cauchy/cross/i686-windows-gcc48/libexec/gcc/i686-w64-mingw32/4.8.2/lto-wrapper Target: i686-w64-mingw32 Configured with: /home/cauchy/vcs/svn/gcc/branches/gcc-4_8-branch/configure --prefix=/home/cauchy/cross/i686-windows-gcc48 --with-sysroot=/home/cauchy/cross/i686-windows-gcc48 --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=i686-w64-mingw32 --disable-multilib --disable-nls --enable-checking=release --enable-languages=c,c++,fortran --with-arch=x86-64 --with-tune=generic --with-fpmath=sse Thread model: win32 gcc version 4.8.2 20130617 (prerelease) (GCC) Here is my building script, just change $PATH, $GCC_SRC_ROOT and $MINGW_W64_SRC_ROOT, gcc 4.7 is fine. cauchy@dre-syslog:~/src$ cat cross-native-win32-thin.sh export GCC_SRC_ROOT=${HOME}/vcs/svn/gcc/branches/gcc-4_8-branch export MINGW_W64_SRC_ROOT=${HOME}/vcs/svn/mingw-w64/trunk export GCC_DATE_STR=`cat ${GCC_SRC_ROOT}/gcc/DATESTAMP` export GCC_BASE_VER=`cat ${GCC_SRC_ROOT}/gcc/BASE-VER` export ZLIB_SRC_ROOT=${HOME}/src/zlib-1.2.8 export EXPAT_SRC_ROOT=${HOME}/src/expat-2.1.0 export GMP_SRC_ROOT=${HOME}/src/gmp-5.1.2 export MPFR_SRC_ROOT=${HOME}/src/mpfr-3.1.2 export MPC_SRC_ROOT=${HOME}/src/mpc-1.0.1 export BINUTILS_SRC_ROOT=${HOME}/src/binutils-2.23.2 export GDB_SRC_ROOT=${HOME}/src/gdb-7.6 export MAKE_SRC_ROOT=${HOME}/src/make-3.82 export NR_JOBS=`cat /proc/cpuinfo | grep '^processor\s*:' | wc -l` export BUILD_TRIPLET=`/usr/share/misc/config.guess` export TARGET_TRIPLET=i686-w64-mingw32 export LOGGER_TAG=native-win32-gcc48 export SYS_ROOT=${HOME}/native/gcc-4.8-win32 export SYS_3RD_ROOT=${HOME}/native/gcc-4.8-win32-3rd export OBJ_ROOT=${HOME}/obj/native/gcc-4.8-win32 export PATH=${HOME}/cross/i686-windows-gcc48/bin:/usr/sbin:/usr/bin:/sbin:/bin logger -t ${LOGGER_TAG} -s "Build started" ################ cleanup ################ rm -fr ${SYS_ROOT} ${OBJ_ROOT} ${SYS_3RD_ROOT} mkdir -p ${SYS_ROOT}/bin ${SYS_ROOT}/${TARGET_TRIPLET} ${SYS_3RD_ROOT}/lib ${SYS_3RD_ROOT}/include cd ${SYS_ROOT} ; ln -s ${TARGET_TRIPLET} mingw ################ zlib ################ cd ${ZLIB_SRC_ROOT} ${TARGET_TRIPLET}-windres --define GCC_WINDRES -o zlibrc.o win32/zlib1.rc ${TARGET_TRIPLET}-gcc -O2 -Ofast -shared -Wl,--out-implib,libz.dll.a \ -o zlib1.dll win32/zlib.def zlibrc.o adler32.c compress.c crc32.c deflate.c gzclose.c gzlib.c gzread.c gzwrite.c infback.c inffast.c inflate.c inftrees.c trees.c uncompr.c zutil.c ${TARGET_TRIPLET}-strip zlib1.dll install -m 0755 -t ${SYS_ROOT}/bin zlib1.dll install -m 0644 -t ${SYS_3RD_ROOT}/include zconf.h zlib.h install -m 0644 -T zlib1.dll ${SYS_3RD_ROOT}/lib/libz.dll.a logger -t ${LOGGER_TAG} -s "Build zlib success" ################ expat ################ cd ${EXPAT_SRC_ROOT}/lib # add expat.rc files, add 2 exports to libexpat.def ${TARGET_TRIPLET}-windres --define GCC_WINDRES -o expat.rc.o expat.rc ${TARGET_TRIPLET}-gcc -DCOMPILED_FROM_DSP -DXML_ATTR_INFO -O2 -flto -s -shared -o expat.dll -Wl,--out-implib,libexpat.dll.a \ libexpat.def expat.rc.o \ xmlparse.c xmlrole.c xmltok.c xmltok_impl.c xmltok_ns.c # ${TARGET_TRIPLET}-objdump -p expat.dll | less install -m 0755 -t ${SYS_ROOT}/bin expat.dll install -m 0644 -t ${SYS_3RD_ROOT}/include expat_external.h expat.h install -m 0644 -T expat.dll ${SYS_3RD_ROOT}/lib/libexpat.dll.a logger -t ${LOGGER_TAG} -s "Build expat success" ################ gmp ################ rm -fr ${OBJ_ROOT}/gmp mkdir -p ${OBJ_ROOT}/gmp cd ${OBJ_ROOT}/gmp ${GMP_SRC_ROOT}/configure --prefix=${SYS_3RD_ROOT} \ --build=${BUILD_TRIPLET} --host=${TARGET_TRIPLET} \ --enable-cxx --disable-static --enable-shared make -j${NR_JOBS} ; make install-strip if [ $? -ne 0 ]; then logger -t ${LOGGER_TAG} -s "Build gmp failed" exit 1 fi logger -t ${LOGGER_TAG} -s "Build gmp success" ################ mpfr ################ rm -fr ${OBJ_ROOT}/mpfr mkdir -p ${OBJ_ROOT}/mpfr cd ${OBJ_ROOT}/mpfr ${MPFR_SRC_ROOT}/configure --prefix=${SYS_3RD_ROOT} \ --build=${BUILD_TRIPLET} --host=${TARGET_TRIPLET} \ --disable-static --enable-shared \ --with-gmp=${SYS_3RD_ROOT} make -j${NR_JOBS} ; make install-strip if [ $? -ne 0 ]; then logger -t ${LOGGER_TAG} -s "Build mpfr failed" exit 1 fi logger -t ${LOGGER_TAG} -s "Build mpfr success" ################ mpc ################ rm -fr ${OBJ_ROOT}/mpc mkdir -p ${OBJ_ROOT}/mpc cd ${OBJ_ROOT}/mpc ${MPC_SRC_ROOT}/configure --prefix=${SYS_3RD_ROOT} \ --build=${BUILD_TRIPLET} --host=${TARGET_TRIPLET} \ --disable-static --enable-shared \ --with-gmp=${SYS_3RD_ROOT} \ --with-mpfr=${SYS_3RD_ROOT} make -j${NR_JOBS} ; make install-strip if [ $? -ne 0 ]; then logger -t ${LOGGER_TAG} -s "Build mpc failed" exit 1 fi logger -t ${LOGGER_TAG} -s "Build mpc success" ################ make ################ rm -fr ${OBJ_ROOT}/make mkdir -p ${OBJ_ROOT}/make cd ${OBJ_ROOT}/make ${MAKE_SRC_ROOT}/configure --prefix=${SYS_ROOT} \ --build=${BUILD_TRIPLET} --host=${TARGET_TRIPLET} \ --disable-nls make -j${NR_JOBS} ; make install-strip if [ $? -ne 0 ]; then logger -t ${LOGGER_TAG} -s "Build make failed" exit 1 fi logger -t ${LOGGER_TAG} -s "Build make success" ################ gdb ################ rm -fr ${OBJ_ROOT}/gdb mkdir -p ${OBJ_ROOT}/gdb cd ${OBJ_ROOT}/gdb CFLAGS="-I${SYS_3RD_ROOT}/include" \ LDFLAGS="-L${SYS_3RD_ROOT}/lib" \ ${GDB_SRC_ROOT}/configure --prefix=${SYS_ROOT} \ --build=${BUILD_TRIPLET} --host=${TARGET_TRIPLET} \ --disable-nls make -j${NR_JOBS} ; make install if [ $? -ne 0 ]; then logger -t ${LOGGER_TAG} -s "Build gdb failed" exit 1 fi logger -t ${LOGGER_TAG} -s "Build gdb success" ################ binutils ################ rm -fr ${OBJ_ROOT}/binutils mkdir -p ${OBJ_ROOT}/binutils cd ${OBJ_ROOT}/binutils # zlibVersion CFLAGS="-I${SYS_3RD_ROOT}/include" \ LDFLAGS="-L${SYS_3RD_ROOT}/lib" \ ${BINUTILS_SRC_ROOT}/configure --prefix=${SYS_ROOT} --with-sysroot=${SYS_ROOT} \ --build=${BUILD_TRIPLET} --host=${TARGET_TRIPLET} --target=${TARGET_TRIPLET} \ --disable-multilib --disable-nls make -j${NR_JOBS} ; make install-strip if [ $? -ne 0 ]; then logger -t ${LOGGER_TAG} -s "Build binutils failed" exit 1 fi logger -t ${LOGGER_TAG} -s "Build binutils success" # ################ mingw-w64-headers ################ rm -fr ${OBJ_ROOT}/mingw-w64-header mkdir -p ${OBJ_ROOT}/mingw-w64-header cd ${OBJ_ROOT}/mingw-w64-header ${MINGW_W64_SRC_ROOT}/mingw-w64-headers/configure --prefix=${SYS_ROOT} \ --host=${TARGET_TRIPLET} --enable-sdk=all make install logger -t ${LOGGER_TAG} -s "Build mingw-w64 (header) success" # ################ mingw-w64 CRT ################ rm -fr ${OBJ_ROOT}/mingw-w64-crt mkdir -p ${OBJ_ROOT}/mingw-w64-crt cd ${OBJ_ROOT}/mingw-w64-crt ${MINGW_W64_SRC_ROOT}/mingw-w64-crt/configure --prefix=${SYS_ROOT} \ --build=${BUILD_TRIPLET} --host=${TARGET_TRIPLET} --disable-lib64 --enable-wildcard make -j${NR_JOBS}; make install if [ $? -ne 0 ]; then logger -t ${LOGGER_TAG} -s "Build mingw-w64 (CRT) failed" exit 1 fi logger -t ${LOGGER_TAG} -s "Build mingw-w64 (CRT) success" ################ gcc ################ rm -fr ${OBJ_ROOT}/gcc mkdir -p ${OBJ_ROOT}/gcc cd ${OBJ_ROOT}/gcc ${GCC_SRC_ROOT}/configure \ --prefix=${SYS_ROOT} \ --with-sysroot=${SYS_ROOT} \ --build=${BUILD_TRIPLET} --host=${TARGET_TRIPLET} --target=${TARGET_TRIPLET} \ --disable-multilib --disable-nls --disable-win32-registry \ --enable-checking=release --enable-languages=c,c++,fortran \ --with-fpmath=sse \ --with-gmp=${SYS_3RD_ROOT} --with-mpfr=${SYS_3RD_ROOT} --with-mpc=${SYS_3RD_ROOT} make -j${NR_JOBS} ; make install-strip if [ $? -ne 0 ]; then logger -t ${LOGGER_TAG} -s "Build gcc failed" exit 1 fi logger -t ${LOGGER_TAG} -s "Build gcc success" logger -t ${LOGGER_TAG} -s "Build finished" ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public