[OLSR-users] Cross compiling issue with ARM cross compiler

Roar Bjørgum Rotvik (spam-protected)
Tue Jun 15 14:41:55 CEST 2004

Roar Bjørgum Rotvik wrote:
> Claudio Lavecchia wrote:

[ text deleted ]

>> I am compiling on Redhat Linux 7.3, linux kernel version 2.14.18-3
>> The errors seem to be due to something in toolchain header files 
>> conflicting with something else, but I cannot understand how to fix 
>> the problem.

[ text deleted ]

>> [(spam-protected) unik-olsrd-0.4.3]# make 
>> CC=/usr/local/arm/arm-linux/bin/gcc
>> /usr/local/arm/arm-linux/bin/gcc -Wall -DDEBUG   -c -o src/interface.o 
>> src/interface.c
>> In file included from 
>> /usr/local/arm/arm-linux/lib/gcc-lib/../../arm-linux/sys-include/net/route.h:28, 
>>                  from src/defs.h:28,
>>                  from src/interface.c:23:
>> /usr/local/arm/arm-linux/lib/gcc-lib/../../arm-linux/sys-include/net/dst.h:30: 
>> parse error before "atomic_t"

I now tried to compile unik-olsrd on a different toolset with gcc-3.3.3 
and got the same problems as you did.

The problem seems to be that that the cross compile versjon of GCC is 
configured to look in <whatever>/sys-include before <whatever>/include.
To see the include file search path, add the flag -v to GCC when it 
compiles a file (for example you may add -v to CFLAGS).

The difference is that sys-include is kernel header files, and should 
not be included directly by an userspace app.
<whatever>/include is the headerfiles from glibc that should be used.

I worked around the problem by using the following flags to gcc:
-nostdinc -I<whatever>/include -I<whatever>/sys-include
You can for instance add these flags to CFLAGS in a Makefile or edit the 
specs-file for GCC.

These flags tell GCC to not use standard include paths and then define 
the path to glibc-header files first before the path to kernel headers.

Roar B. Rotvik

More information about the Olsr-users mailing list