Linux Build/Host Cross-Compiler For Cygwin Target

Ramadass, Ramanathan Ramanathan.Ramadass@spirentcom.com
Wed Dec 3 19:36:00 GMT 2003


Lee,

It seems like you have gotten the ENTIRE GCC suite of compilers(it is trying to build gnat which is the GNU ADA compiler). If you are interested only in C and C++ then you dont need to build anything else. You can use the 
--enable-languages=c,c++ option to the configure script or download only the core GCC and the g++ tar files(they will be named something like gcc-core-3.3.2.tar.gz and gcc-g++-3.3.2.tar.gz. You can get them at ftp.gnu.org). Read the installation notes at; http://gcc.gnu.org/install/. They are very important. Particularly note where to create the build directory(you are building in the source directory itself which is wrong). Also i see that you are not using the --prefix option to specify the destination directory. Until you get a working version, dont use the default target directory which is /usr/local. So your directory structure should be something like;

<your homedir>/gnu
			/gcc-3.3.2		<=== untar'ed sources
			/gccbuild		<=== build directory
			/gcc			<=== destination directory

You would then fire the configure script FROM WITHIN gccbuild directory like so;

../gcc-3.3.2/configure --target=i686-pc-cygwin --prefix=<your homedir>/gnu/gcc --enable-languages=c,c++

There are 3 steps to building and installing;
1) configure
2) make all
3) make install

First do all steps for "binutils" with the same --prefix option then GCC. Everything should then be installed in <your homedir>/gnu/gcc which you can then test out.

Thanks
Ram

-----Original Message-----
From: Lee, Preston [mailto:Preston.Lee@specastro.com]
Sent: Wednesday, December 03, 2003 11:28 AM
To: gcc-help@gcc.gnu.org
Subject: RE: Linux Build/Host Cross-Compiler For Cygwin Target


I was missing the libraries from the target system. (Thanks Ram) I've copied the include and lib directories on the cygwin machine (/usr/include, /usr/lib, and /lib) into /usr/local/i686-pc-cygwin on my Linux machine per the instructions, and recompiled and installed binutils (using the '--target=i686-pc-cygwin' option during the ./configure ). On to the next problem...

I now get a different error during the GCC make,

--BEGIN ERROR--
cp ada/xgnatug.adb ada/doctools
cd ada/doctools && gnatmake -q xgnatug
gnatbind: Cannot find: s-stalib.ali
gnatmake: *** bind failed.
make[1]: *** [ada/doctools/xgnatug] Error 4
make[1]: Leaving directory `/home/preston/bin/cross-compiler-cygwin/gcc-3.3.1/gcc'
make: *** [all-gcc] Error 2
--END ERROR--

I tried issuing the gnatmake command manually in that directory, and it fails every time with the same message. All I've been able to gather is to make sure the gnatbind and gnatmake programs are accessable, which they are.

I don't use ada so I can live without it if necessary. (I took a wild guess at disabling ada support with '--disable-ada', but it still bombed with the same error.)

Thanks for your help,

Preston





-----Original Message-----
From:	Lee, Preston
Sent:	Tue 12/2/2003 1:01 PM
To:	gcc-help@gcc.gnu.org
Cc:	
Subject:	Linux Build/Host Cross-Compiler For Cygwin Target
I'm trying to build a cross-compiler on i686-pc-linux-gnu, that will run on i686-pc-linux-gnu, and generate code for i686-pc-cygwin. I haven't successfully done this before so bare with me.

I have tried to build three different verisions of GCC: 3.1, 3.3.1, and 3.3.2. The version I really *need* is 3.3.1, so I'll focus on that one. As I understand it, the only additional option I want to give the configure script is '--target=i686-pc-cygwin', so I configure it with...


----BEGIN----
./configure --enable-threads=posix --target=i686-pc-cygwin
----END----


...and then 'make'. It churns for a while and then barfs with the following,


----BEGIN BARF----
make[2]: Entering directory `/home/preston/bin/cross-compiler-cygwin/gcc-3.3.1/gcc'
for d in libgcc; do \
  if [ -d $d ]; then true; else /bin/sh ./mkinstalldirs $d; fi; \
done
if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi
/home/preston/bin/cross-compiler-cygwin/gcc-3.3.1/gcc/xgcc -B/home/preston/bin/cross-compiler-cygwin/gcc-3.3.1/gcc/ -B/usr/local/i686-pc-cygwin/bin/ -B/usr/local/i686-pc-cygwin/lib/ -isystem /usr/local/i686-pc-cygwin/include -O2 -I./../winsup/include -I./../winsup/cygwin/include -I./../winsup/w32api/include -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include   -g  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I. -I./. -I./config -I./../include  -DL_muldi3 -c ./libgcc2.c -o libgcc/./_muldi3.o
In file included from tconfig.h:17,
                 from libgcc2.c:36:
config/i386/cygwin.h:30:19: stdio.h: No such file or directory
In file included from tconfig.h:17,
                 from libgcc2.c:36:
config/i386/cygwin.h:415: error: parse error before '*' token
config/i386/cygwin.h:415: warning: function declaration isn't a prototype
config/i386/cygwin.h:417: error: parse error before '*' token
config/i386/cygwin.h:417: warning: function declaration isn't a prototype
make[2]: *** [libgcc/./_muldi3.o] Error 1
make[2]: Leaving directory `/home/preston/bin/cross-compiler-cygwin/gcc-3.3.1/gcc'
make[1]: *** [libgcc.a] Error 2
make[1]: Leaving directory `/home/preston/bin/cross-compiler-cygwin/gcc-3.3.1/gcc'
make: *** [all-gcc] Error 2
----END BARF----

Am I doing something wrong here? Looking at the error, it seems that it just can't find stdio.h, which doesn't make sense to me because it's a standard library in /usr/include. But then maybe it needs it's own version or whatnot..I don't know. It's hard to know what's going on because I'm not familiar with it's internal build process.

I found a document (http://sources.redhat.com/ml/crossgcc/2001-06/msg00039/cross-compiler-HOWTO.pdf) that details building a cross-compiler for a few other systems on Linux, but it is over 3 years old so maybe something has changed. I haven't been able to find a solution to this on the web, usenet or GCC documentation. I don't really want to delve into the GCC source code. TIA,

Preston





More information about the Gcc-help mailing list