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

Chris Johns chrisj at
Sun Mar 24 04:18:52 UTC 2019

On 24/3/19 3:28 am, Michel Macena wrote:
> 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. 

Great and well done.

> 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 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.

Did you run 'make install' after building RTEMS?

> 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, also I have created the variable
> RTEMS_MAKEFILE_PATH based in older versions instructions. I found that
> 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 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 ?

I would start by taking a look at the Executables section in the User Manual ..

Section 7.2 has a detailed figure that shows the pieces that need to be brought
together to build an RTEMS application. The compiler (cc) needs to be told where
the various pieces can be found.

RTEMS supports a wide range of architectures and BSPs and each of these can vary
the start up files so we have to tell the compiler a bunch of things using a
'specs' file. This lets us correctly link a BSP executable.

> Also if you have a working environment could you copy your
> project tree for me ?

I would have a look at examples-v2. This is collection of example programs in a
separate repo ...

I see README.Makefile and README.waf. The first is for using a Makefile and the
second is using the waf build system. Looking the compiler command lines should
provide the details you need for a specific BSP.

I hope this helps.


More information about the users mailing list