« Return to Thread: Problems when cross compiling GCC on mingw

Problems when cross compiling GCC on mingw

by A.P. Horst :: Rate this Message:

| View in Thread

Hello,

somewhere during version 4.6 of GCC I started to get a weird error when
I compile GCC with newlib for target arm-none-eabi, and it never went
away (now on 4.7).
I'll first start with the output of the terminal at the error:

/home/gnuarm-linaro/build/gcc-linaro-4.7-2012.05/./gcc/xgcc
-B/home/gnuarm-linar
o/build/gcc-linaro-4.7-2012.05/./gcc/ -nostdinc
-B/home/gnuarm-linaro/build/gcc-
linaro-4.7-2012.05/arm-none-eabi/newlib/ -isystem
/home/gnuarm-linaro/build/gcc-
linaro-4.7-2012.05/arm-none-eabi/newlib/targ-include -isystem
/home/gnuarm-linar
o/src/gcc-linaro-4.7-2012.05/newlib/libc/include
-B/home/gnuarm-linaro/build/gcc
-linaro-4.7-2012.05/arm-none-eabi/libgloss/arm
-L/home/gnuarm-linaro/build/gcc-l
inaro-4.7-2012.05/arm-none-eabi/libgloss/libnosys
-L/home/gnuarm-linaro/src/gcc-
linaro-4.7-2012.05/libgloss/arm
-B/home/gnuarm-linaro/install/arm-none-eabi/bin/
  -B/home/gnuarm-linaro/install/arm-none-eabi/lib/ -isystem
/home/gnuarm-linaro/i
nstall/arm-none-eabi/include -isystem
/home/gnuarm-linaro/install/arm-none-eabi/
sys-include    -g -O2 -mthumb -O2 -g -O2 -DIN_GCC
-DCROSS_DIRECTORY_STRUCTURE  -
W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes
-Wmissing-prototypes -Wo
ld-style-definition  -isystem ./include  -I. -I. -I../../.././gcc
-I../../../../
../src/gcc-linaro-4.7-2012.05/libgcc
-I../../../../../src/gcc-linaro-4.7-2012.05
/libgcc/. -I../../../../../src/gcc-linaro-4.7-2012.05/libgcc/../gcc
-I../../../.
./../src/gcc-linaro-4.7-2012.05/libgcc/../include   -g0
-finhibit-size-directive
  -fno-inline -fno-exceptions -fno-zero-initialized-in-bss
-fno-toplevel-reorder
-fno-tree-vectorize -fno-stack-protector  -I. -I. -I../../.././gcc
-I../../../..
/../src/gcc-linaro-4.7-2012.05/libgcc
-I../../../../../src/gcc-linaro-4.7-2012.0
5/libgcc/. -I../../../../../src/gcc-linaro-4.7-2012.05/libgcc/../gcc
-I../../../
../../src/gcc-linaro-4.7-2012.05/libgcc/../include  -o crtbegin.o -MT
crtbegin.o
  -MD -MP -MF crtbegin.dep  -c
../../../../../src/gcc-linaro-4.7-2012.05/libgcc/c
rtstuff.c -DCRT_BEGIN
In file included from
D:/MinGW/msys/1.0/home/gnuarm-linaro/src/gcc-linaro-4.7-20
12.05/newlib/libc/include/stdio.h:46:0,
                  from
../../../../../src/gcc-linaro-4.7-2012.05/libgcc/../gcc/ts
ystem.h:88,
                  from
../../../../../src/gcc-linaro-4.7-2012.05/libgcc/crtstuff.
c:62:
D:/MinGW/msys/1.0/home/gnuarm-linaro/src/gcc-linaro-4.7-2012.05/newlib/libc/incl
ude/sys/types.h:127:16: error: expected identifier or '(' before 'char'
make[4]: *** [crtbegin.o] Error 1
make[4]: Leaving directory
`/home/gnuarm-linaro/build/gcc-linaro-4.7-2012.05/arm
-none-eabi/thumb/libgcc'
make[3]: *** [multi-do] Error 1
make[3]: Leaving directory
`/home/gnuarm-linaro/build/gcc-linaro-4.7-2012.05/arm
-none-eabi/libgcc'
make[2]: *** [all-multi] Error 2
make[2]: Leaving directory
`/home/gnuarm-linaro/build/gcc-linaro-4.7-2012.05/arm
-none-eabi/libgcc'
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory
`/home/gnuarm-linaro/build/gcc-linaro-4.7-2012.05'
make: *** [all] Error 2

I have included the complete command for completeness, so it's a bit
long, but the interesting part is where it says:
types.h:127:16: error: expected identifier or '(' before 'char'

The source at that particular line is:
typedef    char *    caddr_t;
which is perfectly fine.

Now this error only occurs when I either do a cross compile on mingw
(from which the terminal excerpt above comes from), or a canadian cross
on linux (I do this because it is much faster than a cross compile on
mingw, and it saves me another mingw error: "couldn't commit memory for
cygwin heap, Win32 error 0" reported by make). But the error won't occur
when I do a cross-compile on linux.

My current workaround is to comment out the line where it crashes on and
then continue the build process. It will later complain it doesn't know
caddr_t, at which I uncomment the line again and continue again. I have
to repeat these steps until it completes successfully, which is a lot of
times.

These are the tools I used:
binutils-2.22
newlib-1.20.0
gcc-linaro-4.7-2012.05      (non-linaro gcc-4.7.0 will produce the same
error)
gmp, mpfr, etc I got using mingw-get

Steps to reproduce:
Make symlinks to newlib in gcc:
ln -f -s `pdw`/newlib-1.20.0/newlib gcc-linaro-4.7-2012.05
ln -f -s `pdw`/newlib-1.20.0/libgloss gcc-linaro-4.7-2012.05

binutils:
configure --target=arm-none-eabi --prefix=/home/gnuarm/install
--enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld
--disable-nls --disable-werror
make all
make install

gcc (gcc takes care of newlib):
configure --target=arm-none-eabi --prefix=/home/gnuarm/install
--with-arch=armv7-m --with-mode=thumb --with-float=soft
--enable-interwork --enable-multilib --enable-languages="c,c++"
--with-newlib --with-gnu-as --with-gnu-ld --disable-nls --disable-shared
--disable-threads --with-headers=newlib/libc/include --disable-libssp
--disable-libstdcxx-pch --disable-libmudflap --disable-libgomp
--disable-werror --with-system-zlib --disable-newlib-supplied-syscalls
make all
make install

For the canadian cross build I use i586-mingw32msvc as host

I hope I got all the info in this message and that it's clear.

Arie

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@...?subject=unsubscribe

 « Return to Thread: Problems when cross compiling GCC on mingw