LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 07-25-2012, 06:55 AM   #1
Refractor
Member
 
Registered: Oct 2008
Location: Rousse, Bulgaria
Distribution: Slackware64
Posts: 86

Rep: Reputation: 22
Question 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?

Last edited by Refractor; 07-25-2012 at 07:01 AM.
 
Old 07-25-2012, 04:32 PM   #2
Refractor
Member
 
Registered: Oct 2008
Location: Rousse, Bulgaria
Distribution: Slackware64
Posts: 86

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error building cross gcc-3.3.2 for i386-mingw32msvc target ugenn Linux - Software 2 10-05-2012 02:33 AM
LXer: Android/Linux Not a Security Concern, Windows Definitely and Demonstrably Remains #1 Target LXer Syndicated Linux News 0 11-30-2011 05:30 AM
Building the simple module fails. -No rule to make target `−C'. Stop wallwaters Programming 4 10-30-2011 01:51 PM
Make target problem building ffmpeg ordealbyfire83 Linux - Software 1 01-14-2009 11:28 AM
make menuconfig/config/xconfig problems when try building for ARM target kondrara Linux - Software 0 11-28-2007 04:58 AM


All times are GMT -5. The time now is 09:46 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration