LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Building libstdc++ on linux for windows target (http://www.linuxquestions.org/questions/programming-9/building-libstdc-on-linux-for-windows-target-4175418571/)

Refractor 07-25-2012 07:55 AM

Building libstdc++ on linux for windows target
 
I'm updating my cross-compiler for win32 target, unfortunately I lost my cross-compiler cookbook and on my own.

What I did:
got binutils-2.22
got w32api and mingwrt from cvs (from cygwin)
got gcc-4.7.1

build binutils
./configure --prefix=$HOME/Win32 --target=i686-pc-mingw32 --disable-nls
make
make install

copy headers
cp -Rv w32api/include $HOME/Win32/
cp -Rv mingwrt/include $HOME/Win32/

gcc - pass 1, only a c compiler that can't link
Code:

../configure --prefix=$HOME/Win32 --target=i686-pc-mingw32 --with-headers=$HOME/Win32/include --disable-nls --enable-languages=c --disable-shared --enable-static --with-newlib
make all-gcc
make install-gcc

libgcc static
Code:

make all-target-libgcc
make install-target-libgcc

w32api
Code:

./configure --prefix=$HOME/Win32 --host=i686-pc-mingw32
make
make install

mingwrt
Code:

./configure --prefix=$HOME/Win32 --host=i686-pc-mingw32
make
make install

----
So far so good.

gcc pass 2
Code:

../configure --prefix=$HOME/Win32 --target=i686-pc-mingw32 --enable-languages=c,c++ --with-newlib --enable-shared
make all-gcc # C compiler
make install-gcc
make all-target-libgcc # libgcc
make install-target-libgcc
make all # make the rest

Building 2-3 minutes and crashing down with

Code:

mkdir -p ./i686-pc-mingw32/bits/stdc++.h.gch
/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/./gcc/xgcc -shared-libgcc -B/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/./gcc -nostdinc++ -L/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/src -L/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/src/.libs -L/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/winsup/mingw -L/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/winsup/w32api/lib -isystem /home/axtroz/source/MinGW-Cross/gcc-4.7.1/winsup/mingw/include -isystem /home/axtroz/source/MinGW-Cross/gcc-4.7.1/winsup/w32api/include -B/home/axtroz/Win32/i686-pc-mingw32/bin/ -B/home/axtroz/Win32/i686-pc-mingw32/lib/ -isystem /home/axtroz/Win32/i686-pc-mingw32/include -isystem /home/axtroz/Win32/i686-pc-mingw32/sys-include    -x c++-header -nostdinc++ -g -O2 -I/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/i686-pc-mingw32 -I/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include -I/home/axtroz/source/MinGW-Cross/gcc-4.7.1/libstdc++-v3/libsupc++ -O2 -g -std=gnu++0x /home/axtroz/source/MinGW-Cross/gcc-4.7.1/libstdc++-v3/include/precompiled/stdc++.h \
-o i686-pc-mingw32/bits/stdc++.h.gch/O2ggnu++0x.gch
In file included from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/bits/stl_algo.h:62:0,
                from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/algorithm:63,
                from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/libstdc++-v3/include/precompiled/stdc++.h:65:
/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/bits/algorithmfwd.h:360:41: error: macro "max" passed 3 arguments, but takes just 2
/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/bits/algorithmfwd.h:371:41: error: macro "min" passed 3 arguments, but takes just 2
/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/bits/algorithmfwd.h:394:30: error: macro "min" requires 2 arguments, but only 1 given
/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/bits/algorithmfwd.h:402:30: error: macro "max" requires 2 arguments, but only 1 given
In file included from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/random:43:0,
                from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/bits/stl_algo.h:67,
                from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/algorithm:63,
                from /home/axtroz/source/MinGW-Cross/gcc-4.7.1/libstdc++-v3/include/precompiled/stdc++.h:65:
/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/limits:309:11: error: macro "min" requires 2 arguments, but only 1 given
/home/axtroz/source/MinGW-Cross/gcc-4.7.1/bld3/i686-pc-mingw32/libstdc++-v3/include/limits:313:11: error: macro "max" requires 2 arguments, but only 1 given

The C compiler builds and links fine and programs are running fine, but it can't compile libstdc++ because windef.h has macros for min and max. There's a NOMINMAX 1 define in os_define.h in libstdc++ but it seems that it's ignored or something because macros are defined and it's garbling the source. Any thoughts?

Refractor 07-25-2012 05:32 PM

Nevermind, just built a win32/64 compiler following: http://sourceforge.net/apps/trac/min...n64%20compiler


All times are GMT -5. The time now is 02:16 AM.