RSB Build under GCC < 5.0

Hi everyone, I hope this is the correct category to post.

I am trying to build the compiler for RTEMS 6.1 under a CentOS 7 machine (due to legacy reasons, it is still being used, it also contains RTEMS 4.10 installation and it is conencted physically to the target hardware).

I am encountering problems during gmp compilation. It requires C99 for compilation, but GCC <5 (4.8.4 in Centos7 as far as I remember) defaults to C89 to compile. The auto-generated makefile does not pass any C version command to gcc.

I could not convince the source builder to use C99 for gmp through modifications on the gmp.cfg file, using CFLAGS=‘-std=gnu99’ similarly to this post. The generated do-build, for some reason, removes all -std=gnu99 flags from the build. I tried with C11 (CFLAGS=‘-std=gnu11’) without luck too.

What I tried and worked was to manually modify the do-build script (removing the sed parts that mention -std=gnu99) but that is not really clean nor scalable.

Any tips/clues on how to force the build to use C99 for gmp? I did not find what GCC versions are required for the Source Builder to work properly, so I suppose the 4.8.4 is still good for RTEMS 6.1.

I can share the logs as desired. In any case, I think I am being dense by using the wrong flag on the gmp.cfg, so it might not even be necessary.

Thanks for your attention!

SOLVED!

As I supposed I was being dense by using CFLAGS. The CFLAGS were used before, in the %{host_build_flags} command.

To build gmp, using CC_FOR_BUILD=$(echo "${CC_FOR_BUILD} -std=gnu99") after the %{host_build_flags} line does the trick.
In any case, sparc-rtems6-gdb fails because GCC 4.8.5 (that’s the latest version available in CentOS7 normal repositories) doesn’t support C17.

Only way to build under CentOS 7 is to use some development version of GCC, that is not listed on the RTEMS 6.1 manual section about CentOS. But to avoid any issue and breaking the legacy system, I arranged to use Almalinux 8 for building and that works flawlessly.

The usual incantation I use to get newer tools on the one instance of CentOS7 I still have around is: scl enable rh-python36 devtoolset-11 bash

Make sure that you don’t try to use Python 3.8 from the SCL. While it is available, it is broken.

1 Like