This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/14666] New: Crossing from GNU/Linux to MinGW requires SEVERAL hacks
- From: "stl at caltech dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Mar 2004 03:33:54 -0000
- Subject: [Bug target/14666] New: Crossing from GNU/Linux to MinGW requires SEVERAL hacks
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When crossing from GNU/Linux to MinGW, I can successfully build cross
binutils, cross gcc, and crossed-native gcc, but doing so requires a number of
individual hacks, none of which I think should be necessary. (Building cross
binutils requires no hacks - this is not a binutils bug.)
cross.sh which I run on GNU/Linux:
#!/bin/sh
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Initializing script.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
CROSS_ROOT=/home/stl/cross
BU_SRC=$CROSS_ROOT/binutils-src
BU_BUILD=$CROSS_ROOT/binutils-build
XGCC_SRC=$CROSS_ROOT/xgcc-src
XGCC_BUILD=$CROSS_ROOT/xgcc-build
XGCC_DEST=$CROSS_ROOT/xgcc-dest
WINGCC_SRC=$CROSS_ROOT/wingcc-src
WINGCC_BUILD=$CROSS_ROOT/wingcc-build
WINGCC_DEST=$CROSS_ROOT/wingcc-dest
CONFIGURY1='--build=i686-pc-linux-gnu --target=mingw32 --enable-
languages=c,c++'
CONFIGURY2='--disable-nls --disable-debug --disable-shared --disable-win32-
registry'
CONFIGURY3='--without-newlib --enable-threads=win32 --enable-sjlj-exceptions'
CONFIGURY4='--with-gnu-as --with-gnu-ld --with-gcc'
export CC=gcc
export CXX=g++
export AS=as
export LD=ld
export AR=ar
export CFLAGS='-O3 -fomit-frame-pointer -ffast-math'
export CXXFLAGS=$CFLAGS
export LIBCFLAGS=$CFLAGS
export LIBCXXFLAGS=$CFLAGS
export BOOT_CFLAGS=$CFLAGS
export LDFLAGS='-s'
mkdir -p $BU_BUILD $XGCC_BUILD $XGCC_DEST/mingw32 $WINGCC_BUILD \
$WINGCC_DEST/mingw32 $WINGCC_DEST/include
cd $CROSS_ROOT
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Dump mingw-runtime-3.2.tar and w32api-2.5.tar into CROSS_ROOT.
echo @ They must be binaries that extract to bin, include, lib.
echo @
echo @ Dump gcc-3.3.3-truemingw.tar into CROSS_ROOT.
echo @ It must be source that extracts to gcc-3.3.3-truemingw.
echo @
echo @ Dump binutils-2.15.90-20040222-1-src.tar into CROSS_ROOT.
echo @ It must be source that extracts to binutils-2.15.90-20040222-1.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Extracting.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
tar xf mingw-runtime-3.2.tar -C $XGCC_DEST/mingw32
tar xf w32api-2.5.tar -C $XGCC_DEST/mingw32
tar xf mingw-runtime-3.2.tar -C $WINGCC_DEST/mingw32
tar xf w32api-2.5.tar -C $WINGCC_DEST/mingw32
tar xf gcc-3.3.3-truemingw.tar
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Hacking.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
mkdir -p $CROSS_ROOT/gcc-3.3.3-truemingw/libstdc++-v3/config/config/os/newlib
cp $CROSS_ROOT/gcc-3.3.3-truemingw/libstdc++-v3/config/os/mingw32/* \
$CROSS_ROOT/gcc-3.3.3-truemingw/libstdc++-v3/config/config/os/newlib
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Hacking.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
cd $CROSS_ROOT/gcc-3.3.3-truemingw
patch -p1 < $CROSS_ROOT/crossfix.patch
cd $CROSS_ROOT
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Extracting.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
cp -r gcc-3.3.3-truemingw $XGCC_SRC
mv gcc-3.3.3-truemingw $WINGCC_SRC
tar xf binutils-2.15.90-20040222-1-src.tar
mv binutils-2.15.90-20040222-1 $BU_SRC
chmod 700 $BU_SRC/configure $XGCC_SRC/configure $WINGCC_SRC/configure
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Configuring binutils.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
cd $BU_BUILD
$BU_SRC/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu \
--target=mingw32 --prefix=$XGCC_DEST --disable-nls --disable-shared \
--disable-debug --enable-threads=win32
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Making binutils.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
make
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Installing binutils.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
make install
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Configuring xgcc.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
export PATH=$XGCC_DEST/bin:$PATH
cd $XGCC_BUILD
$XGCC_SRC/configure --prefix=$XGCC_DEST --host=i686-pc-linux-gnu \
$CONFIGURY1 $CONFIGURY2 $CONFIGURY3 $CONFIGURY4
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Making xgcc.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
make
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Installing xgcc.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
make install
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Configuring wingcc.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
export CC=$XGCC_DEST/bin/mingw32-gcc
export CXX=$XGCC_DEST/bin/mingw32-g++
export AS=$XGCC_DEST/bin/mingw32-as
export LD=$XGCC_DEST/bin/mingw32-ld
export AR=$XGCC_DEST/bin/mingw32-ar
export LDFLAGS='-s -Wl,--stack=0x00800000'
cd $WINGCC_BUILD
$WINGCC_SRC/configure --prefix=$WINGCC_DEST --host=mingw32 --with-as=$AS \
--with-ld=$LD $CONFIGURY1 $CONFIGURY2 $CONFIGURY3 $CONFIGURY4
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Hacking.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
cp $WINGCC_BUILD/gcc/auto-host.h $WINGCC_BUILD/gcc/auto-build.h
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Making wingcc.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
make
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Installing wingcc.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
read dummy
make install
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
echo @ Finished! The final product is in WINGCC_DEST.
echo @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
See the notes that say "Hacking." If the first hack is not performed, building
the cross gcc fails with a complaint about missing headers. If the second
hack, which uses crossfix.patch:
diff -aur gcc-3.3.3-truemingw/libstdc++-v3/include/bits/char_traits.h gcc-
3.3.3-truemingw-new/libstdc++-v3/include/bits/char_traits.h
--- gcc-3.3.3-truemingw/libstdc++-v3/include/bits/char_traits.h 2003-10-07
18:15:05.000000000 -0700
+++ gcc-3.3.3-truemingw-new/libstdc++-v3/include/bits/char_traits.h 2004-
03-19 20:26:29.000000000 -0800
@@ -181,7 +181,7 @@
};
-#if defined (_GLIBCPP_USE_WCHAR_T) || defined (_GLIBCPP_USE_WSTRING)
+#if 0
/// 21.1.3.2 char_traits specializations
template<>
struct char_traits<wchar_t>
is not performed, building the cross gcc fails with a complaint about missing
functions. See http://gcc.gnu.org/ml/gcc/2004-03/msg01182.html , where Gabriel
Dos Reis says,
> As you probably know, in the nutshell, native builds on MinGW or
> Cygwin do not have support for wchar_t so correponding support in
> libstdc++ is disabled. It looks like when building the cross, you did
> -not- take that fact into consideration and somehow requested support
> for wchar_t while the underlying C functions are missing.
I didn't request any such support (you can see the configure lines right
there), so something in gcc is misbehaving. The later suggestion to configure
with --disable-c-mbchar did not affect the problem, only the #if 0 eliminated
it.
If the third hack is not performed, building the crossed-native fails with a
complaint about "no rule to make auto-build.h". By looking into the configure
scripts, I guessed that auto-build.h was a copy of auto-host.h.
Finally, a fourth hack:
cp $WINGCC_DEST/mingw32/lib/crt2.o $WINGCC_DEST/lib/gcc-
lib/mingw32/3.3.3/crt2.o
is necessary, otherwise crt2.o cannot be found when compiling C or C++
programs.
All of these hacks seem to work, but I'd feel a lot better if they were not
necessary.
I don't remember having to perform any of these hacks when crossing the 3.3 I
currently use (in particular I know I didn't have to do the fourth one), so
these are probably all regressions.
--
Summary: Crossing from GNU/Linux to MinGW requires SEVERAL hacks
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stl at caltech dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: mingw32
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: mingw32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14666