RTEMS + g++ + #include <netinet/in.h>

Ralf Corsepius corsepiu at faw.uni-ulm.de
Tue Dec 19 11:23:46 UTC 2000

Chris Johns wrote:
> Hi,
> The simple test program :
> ------ 8< - tst.cpp ------
> #include <sys/types.h>
> #include <netinet/in.h>
> ------ 8< ----------------
> gives :
> $ m68k-rtems-g++ -c -I /opt/rtems/rtems/bare-5200/lib/include tst.cpp
> In file included from tst.cpp:2:
> /opt/rtems/rtems/bare-5200/lib/include/netinet/in.h:282: ANSI C++
> forbids data member `ip_opts' with same name as enclosing class

Try m68k-rtems-g++ -isystem /opt/rtems/rtems/bare-5200/lib/include
-c tst.cpp

or (preferred)
m68k-rtems-g++ -B/opt/rtems/rtems/bare-5200/lib/ -c tst.cpp

[Note: This implies using
 CXX=m68k-rtems-g++ -B/opt/rtems/rtems/bare-5200/lib/ 

> So GCC knows a file is included from a system directory. The result is
> <netinet/in.h> compiles on FreeBSD, but fails under RTEMS as we do not
> place <netinet/in.h> in a path which GCC sees as a system directory.
> Looking at the m68k-rtems-gcc I have, the system include is listed as :
>  /opt/rtems/lib/gcc-lib/m68k-rtems/2.95.2/../../../../m68k-rtems/include

= /opt/rtems/m68k-rtems/include
= ${prefix)/$target/include
= $(tooldir)/include

> Should the RTEMS install put this file in the correct spot ?
This in fact would be the correct spot for bsp-independent,
target-only dependent header files.

However, RTEMS currently is built per BSP, so a bsp-independent
installation directory can not be used (yet).

Actually, your observation is an indication for yet another hidden
general structural weakness in RTEMS.

> Comments, 
Joel, Eric N. and I already have an ongoing discussion on PM on a
related subject. 

I am already working on part of this subject as part of the bsp
split out effort, however I currently do not have much time left for
working on RTEMS (almost none), so progress is very slow. 

> solutions welcome.
For now, all RTEMS headers (=RTEMS system headers) have to be
installed to $(prefix)/<BSP>/lib/include.
I.e. -isystem $(prefix)/<BSP>/lib/include or -B$(prefix)/<BSP>/lib/
has to be _prepended_ to the compile command if using gcc. 
If using 3rd party compilers, you will probably have a hard time
getting this working at all.

Ralf Corsepius 
Forschungsinstitut fuer Anwendungsorientierte Wissensverarbeitung
Helmholtzstr. 16, 89081 Ulm, Germany     Tel: +49/731/501-8690
mailto:corsepiu at faw.uni-ulm.de           FAX: +49/731/501-999  

More information about the users mailing list