building gcc-3.2.3 as a cross compiler to make cygwin programs

bertrand marquis bertrand_marquis@yahoo.fr
Fri Apr 2 10:27:00 GMT 2004


it seems that you have forgotten to add the include and lib files from 
cygwin

you must take the file needed in the cygwin installed files or find a 
developpement tree that add those files, here stdio.h and put them into 
$PREFIX/i686-pc-cygwin/include and $PREFIX/i686-pc-cygwin/lib

i also made a patch because it seems that under windows 2000 we must by 
default add the -align-double option to have running program
unless you won't be able to play with memory

here si my gcc-3.2.3 patch:

<begin of file>

diff -Naur gcc-3.2.3/gcc/config/i386/cygwin.h 
gcc-3.2.3.cyg/gcc/config/i386/cygwin.h
--- gcc-3.2.3/gcc/config/i386/cygwin.h  2002-12-05 21:30:30.000000000 +0100
+++ gcc-3.2.3.cyg/gcc/config/i386/cygwin.h      2004-03-24 
09:17:06.000000000 +0100
@@ -354,7 +354,7 @@
 #undef TARGET_SUBTARGET_DEFAULT
 
 #define TARGET_SUBTARGET_DEFAULT \
-   (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE)
+   (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE | 
MASK_ALIGN_DOUBLE)
 
 /* This is how to output an assembler line
    that says to advance the location counter
diff -Naur gcc-3.2.3/gcc/fixinc/gnu-regex.c 
gcc-3.2.3.cyg/gcc/fixinc/gnu-regex.c
--- gcc-3.2.3/gcc/fixinc/gnu-regex.c    2002-02-27 01:23:56.000000000 +0100
+++ gcc-3.2.3.cyg/gcc/fixinc/gnu-regex.c        2004-03-23 
13:43:41.000000000 +0100
@@ -5720,7 +5720,7 @@
       if (msg_size > errbuf_size)
         {
 #if defined HAVE_MEMPCPY || defined _LIBC
-         *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
+         *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
 #else
           memcpy (errbuf, msg, errbuf_size - 1);
           errbuf[errbuf_size - 1] = 0;
diff -Naur gcc-3.2.3/libiberty/getopt.c gcc-3.2.3.cyg/libiberty/getopt.c
--- gcc-3.2.3/libiberty/getopt.c        2001-11-13 04:46:00.000000000 +0100
+++ gcc-3.2.3.cyg/libiberty/getopt.c    2004-03-23 13:43:34.000000000 +0100
@@ -333,7 +333,7 @@
        nonoption_flags_len = nonoption_flags_max_len = 0;
       else
        {
-         memset (__mempcpy (new_str, __getopt_nonoption_flags,
+         memset (mempcpy (new_str, __getopt_nonoption_flags,
                             nonoption_flags_max_len),
                  '\0', top + 1 - nonoption_flags_max_len);
          nonoption_flags_max_len = top + 1;
diff -Naur gcc-3.2.3/libiberty/regex.c gcc-3.2.3.cyg/libiberty/regex.c
--- gcc-3.2.3/libiberty/regex.c 2001-11-16 22:54:17.000000000 +0100
+++ gcc-3.2.3.cyg/libiberty/regex.c     2004-03-23 13:43:49.000000000 +0100
@@ -8256,7 +8256,7 @@
       if (msg_size > errbuf_size)
         {
 #if defined HAVE_MEMPCPY || defined _LIBC
-         *((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
+         *((char *) mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
 #else
           memcpy (errbuf, msg, errbuf_size - 1);
           errbuf[errbuf_size - 1] = 0;

<end of file>

Rainer Hochreiter a écrit:

>hello bertrand,
>
>i've found your posting in the crossgcc mailing list regarding building
>gcc as a cross compiler to make cygwin programs under linux. i'm also
>trying this, but after successfully building binutils, making the cross
>gcc failes with the error listed below!
>
>have you experienced such a problem also,
>or can you give any hints how to solve this?
>
>another point is, whether you know where to get a binary distribution of
>such a cross compiler?
>
>thanks for your help in advance!
>
>the environment i use is as follows:
>
>export PREFIX="/opt/cygwin-cross-gcc"
>export TARGET="i686-pc-cygwin"
>export HOST="i686-pc-linux"
>
>[raho@pcraho build-gcc-3.2.3]$ ../gcc-3.2.3/configure --prefix=$PREFIX
>--target=$TARGET --host=$HOST --enable-languages=c --enable-haifa
>
>[raho@pcraho build-gcc-3.2.3]$ make
>...
>/home/raho/disk/cygwin-cross-gcc/gcc/build-gcc-3.2.3/gcc/xgcc
>-B/home/raho/disk/cygwin-cross-gcc/gcc/build-gcc-3.2.3/gcc/
>-B/opt/cygwin-cross-gcc/i686-pc-cygwin/bin/
>-B/opt/cygwin-cross-gcc/i686-pc-cygwin/lib/ -isystem
>/opt/cygwin-cross-gcc/i686-pc-cygwin/include
>-O2 -I../../gcc-3.2.3/gcc/../winsup/include
>-I../../gcc-3.2.3/gcc/../winsup/cygwin/include
>-I../../gcc-3.2.3/gcc/../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../../gcc-3.2.3/gcc -I../../gcc-3.2.3/gcc/.
>-I../../gcc-3.2.3/gcc/config -I../../gcc-3.2.3/gcc/../include  -DL_muldi3
>-c ../../gcc-3.2.3/gcc/libgcc2.c -o libgcc/./_muldi3.o
>In file included from tconfig.h:16,
>                 from ../../gcc-3.2.3/gcc/libgcc2.c:36:
>../../gcc-3.2.3/gcc/config/i386/cygwin.h:31:19: stdio.h: No such file or
>directory
>In file included from tconfig.h:16,
>                 from ../../gcc-3.2.3/gcc/libgcc2.c:36:
>../../gcc-3.2.3/gcc/config/i386/cygwin.h:447: syntax error before '*' token
>../../gcc-3.2.3/gcc/config/i386/cygwin.h:447: warning: function
>declaration isn't a prototype
>../../gcc-3.2.3/gcc/config/i386/cygwin.h:449: syntax error before '*' token
>../../gcc-3.2.3/gcc/config/i386/cygwin.h:449: warning: function
>declaration isn't a prototype
>make[2]: *** [libgcc/./_muldi3.o] Error 1
>make[2]: Leaving directory
>`/disk/raho/cygwin-cross-gcc/gcc/build-gcc-3.2.3/gcc'
>make[1]: *** [libgcc.a] Error 2
>make[1]: Leaving directory
>`/disk/raho/cygwin-cross-gcc/gcc/build-gcc-3.2.3/gcc'
>make: *** [all-gcc] Error 2
>[raho@pcraho build-gcc-3.2.3]$
>
>greeetings,
>rainer
>
>  
>



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list