compiler-errorssparcrtems

SPARC-RTEMS5-GCC ignores or don't find libraries


I'm a beginner with RTEMS and I have built a RTEMS5 environment for an erc32 chip (the example in RTEMS Docs) in my computer with linux mint. The environment comes with sample applications. I'm trying to compile the sample from "hello" (init.c) using sparc-rtems5-gcc, here's the command line:

sparc-rtems5-gcc -g -O2 /home/michel/masters_project/src/rtems/testsuites/samples/hello/init.c -o /home/michel/masters_project/compile_test/hello2.exe

but it returns the following error:

fatal error: rtems.h: No such file or directory
 #include <rtems.h>
          ^~~~~~~~~
compilation terminated.

So I tried to comment rtems.h in the init.c code and leave the next library of the code, tmacros.h, so I tried to compile again and had the following error:

fatal error: tmacros.h: No such file or directory
 #include <tmacros.h>
          ^~~~~~~~~~~
compilation terminated.

I have used the locate command and found these libraries in the envinronment tree. As far as I perceived the sparc-rtems5-gcc does not find or ignore the libraries. I added the bin folder to the PATH variable. command line:

export PATH=$HOME/masters_project/rtems/5/bin:"$PATH"

Also I have created the variable RTEMS_MAKEFILE_PATH based in older versions instructions. I found that RTEMS_MAKEFILE_PATH variable should point to where the BSP files are. But I'm not sure if in the present version of RTEMS it is still necessary to create this environment variable since I have not found any instructions for this in the main docs.

command line:

export RTEMS_MAKEFILE_PATH=/home/michel/masters_project/build/b-erc32

Could someone help ? Also if you have a working environment could you copy your project tree for me ?

my uname -a command output:

Linux michel-COM 4.15.0-45-generic #48~16.04.1-Ubuntu SMP Tue Jan 29 18:03:48 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Solution

  • You need to add directory inclusion flags for header file inclusion associated with RTEMS using

    Recommended installing RTEMS in /opt/ directory.

    (Note: Directory inclusion flags are used in object file compilation stage, not in linking stage.)