Problems with RTEMS toolchain build 4.12 & 5 incl. Ada support

Chris Johns chrisj at rtems.org
Fri Nov 30 00:49:03 UTC 2018


On 30/11/2018 10:09, chris at kluge-rocks.de wrote:
> Hi community,

Hi and welcome.

> I'm struggling with building a GCC toolchain for RTEMS including Ada language
> support. 

A critical issue with Ada is needing a suitable host Ada compiler installed to
build an RTEMS Ada compiler. I have not been building Ada as a tool set, I think
Joel and Sebastian have from time to time but I am not sure. I can take a look
but it is currently not high on my list of things I need to do.

> After trying everything I found at Github or in the web, the RTEMS
> documentation or RTEMS source builder, I finally decided to use TASTE's virtual
> machine which I hoped to find a consistent and correct environment, esp.
> regarding the GCC toolchain installed on this system (GCC 6.3.0 with Ada support).
> 
> To additionally avoid any problems caused by mistakes made in build scripts, I
> fetched the existing build scripts found at:
> https://gitrepos.estec.esa.int/taste/taste-setup/tree/master/misc/HW_experiments/GR740_SPW/contrib

Interesting. I was not aware of this web site or these scripts so thank you. To
the creators of these script the RTEMS 5 script has a hack to play with the RSB
configs. This is unfortunate because a ticket on the issue would have drawn my
attention to it and the possibility of a resolution in the RSB. Without feedback
these tools and RTEMS cannot be improved so I encourage you all to provide feedback.

These scripts were last updated 8 months ago, a lot has happened since then on
the RTEMS 5 master.

> The scripts should build toolchains for RTEMS 4.11 and 5.1. 

I can see scripts for RTEMS 4.12 which is a dead end because it became RTEMS 5
and I see an RTEMS 5 script this is old.

> The RTEMS GCC
> toolchain installed in the VM is obviously built with one of the scripts, at
> least according to the comments and readme files. So I was pretty optimistic to
> be successful after days and weeks of disappointed attempts.

Lets hope we can get you what you need.

> Unfortunately, I once again ran into trouble and couldn't build the toolchain.
> This time the process stopped when during build of GCC because of an undefined
> symbol: 'Restricted_Tasking':
> 
> gcc-7.1.0-newlib-2.5.0.20170623-x86_64-linux-gnu-1/gcc-7.1.0/gcc/ada -O2 -pipe
> -I/root/development/rtems/src/rtems-source-builder-2018.11.29/rtems/build/tmp/sb-root/4.12/rtems-sparc/opt/rtems-4.12-2018.11.29/include
> -g -O2 -W -Wall -gnatpg -gnata -I-
> /root/development/rtems/src/rtems-source-builder-2018.11.29/rtems/build/sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170623-x86_64-linux-gnu-1/gcc-7.1.0/gcc/ada/restrict.adb
> restrict.adb:1198:33: "Restricted_Tasking" is undefined (more references follow)
> gnatmake:
> "/root/development/rtems/src/rtems-source-builder-2018.11.29/rtems/build/sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170623-x86_64-linux-gnu-1/gcc-7.1.0/gcc/ada/restrict.adb"
> compilation error
> ../gcc-interface/Makefile:2640: recipe for target 'gnatmake-re' failed
> make[3]: Leaving directory
> '/root/development/rtems/src/rtems-source-builder-2018.11.29/rtems/build/sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170623-x86_64-linux-gnu-1/build/gcc/ada/tools'
> make[3]: *** [gnatmake-re] Error 4
> make[2]: *** [gnattools-cross] Error 2
> Makefile:215: recipe for target 'gnattools-cross' failed
> make[2]: Leaving directory
> '/root/development/rtems/src/rtems-source-builder-2018.11.29/rtems/build/sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170623-x86_64-linux-gnu-1/build/gnattools'
> make[1]: *** [all-gnattools] Error 2
> Makefile:10575: recipe for target 'all-gnattools' failed
> make[1]: Leaving directory
> '/root/development/rtems/src/rtems-source-builder-2018.11.29/rtems/build/sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170623-x86_64-linux-gnu-1/build'
> make: *** [all] Error 2
> Makefile:897: recipe for target 'all' failed
> shell cmd failed: /bin/sh -ex
> /root/development/rtems/src/rtems-source-builder-2018.11.29/rtems/build/sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170623-x86_64-linux-gnu-1/doit
> error: building sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170623-x86_64-linux-gnu-1
> 
> I then tried to find anything in the web and found this bug report:
> https://gcc.gnu.org/ml/gcc-bugs/2017-07/msg01306.html which describes a workaround:
> - don't build GCC in the source tree (which is already ensured by RSB)

Yeap.

> - add C & C++ to the supported languages
> - use absolute paths for GCC configuration (I guessed this means: don't use
> ../configure)

This is something new I did not know about. I always recommend configuring RTEMS
with an absolute path when you are building it because the debugger will always
find the source without horrible debugger tricks but I have not done this for
GNU tools. The reason is the build and source tree are wiped out and if you use
a pre-built tool set from someone deploying RTEMS for you absolute paths become
an issue when debugging.

I wonder if this is still required for an RSB master build of Ada?

> I edited gcc-common-1.cfg of RSB accordingly to avoid use of relative paths for
> the GCC configuration, but this didn't help. The build process still fails with
> the same issue, independent from RTEMS 4.11 or 5 or if there's an abs path or not.

Did you try the master version from git.rtems.org?

> I know that providing an existing GNAT is mandatory when building Ada and that I
> have to build a bootstrap compiler first before resuming with build of the final
> GCC. But I didn't expect the build process to fail in the TASTE VM which should
> provide everything needed to have success.

I am sorry I do not know about this VM or what it is made from.

> Does anyone know where to find a really working build script or the required
> RTEMS source builder commit IDs to use? I guess that using the masters of both,
> RTEMS source builder and the kernel, will not work for that, but I can't find a
> tag or branch which points me to the right direction or which works.

If you use the master branches for the RSB and RTEMS kernel then we can look at
what you are doing. For me heading down the path of past commits is not a
productive use of my time.

> Addditionally, there's no information in the RTEMS source builder on how to
> build with Ada support: The description of the TASTE project describes building
> a bootstrap and a final compiler while the original RTEMS source builder
> documentation simply says that parameter --with-ada is enough in combination
> with a GNAT in the PATH. None of that worked.

I agree there is not enough information and would welcome and review an Ada
section to the User Manual.

> Is there any chance to get a GCC with Ada support for RTEMS 5?

Yes, what happens in RTEMS is driven by users and what can be done is often the
result of the efforts of users. For example I have been busy this week fixing
Windows rtems-tool issues a GCI student aged between 13 and 17 has been
uncovering and reporting. It is fantastic to have this feedback, GCI is awesome!

> Which exact version of GCC and which RTEMS source builder and kernel git
> versions/commits are supposed to work (the masters don't work for me, neither
> the commit IDs of TASTE's build.rtems.X.sh scripts work for me)?

I suggest you use master and report what you find. I also suggest you select a
host OS for example a Linux distro of your choice, FreeBSD etc and make sure it
is current. This lets us base line what you are doing. Please keep notes so you
can check to make sure our documentation is right.

I attach a script I use to build the tools and post the results to
build at rtems.org on a number of hosts. The list archive is
https://lists.rtems.org/pipermail/build/. Anyone can post build and test results
here as well as find what I, Joel Sebastian and others have building, on what
hosts, and which architectures.

> I could imagine that the GCC 6.3.0 of the TASTE VM isn't suitable to build RTEMS
> toolchain with RTEMS source builder & kernel masters but I can't find
> information which of all those config files of RSB I have to use for a
> successful build (targets: ARM, x86-64). This is pretty frustrating and very
> disappointing. There are so many variables which are not exactly documented, at
> least for the current version of RSB/kernel.

You are right it can be frustrating. I took a look in the RSB manual in the
online docs and there is no section on this topic. I have created a ticket and
cc'ed you on it ...

 https://devel.rtems.org/ticket/3629

I hope that is OK?

> Thanks in advance for every answer or hint pointing me to the right direction
> (esp. on the question how to define the correct RSB and RTEMS kernel
> versions/commit IDs for a specific native GCC installation)!

I am sure we can clear up what is needed and to get Ada better supported and
documented.

Thanks
Chris
-------------- next part --------------
#! /bin/sh
#
# RTEMS Tools Project
# Copyright 2018 Chris Johns
# All rights reserved
#
# Build the tools.
#

# Uncomment to trace
#set -x

#
# Stop on any error.
#
set -e

#
# Base of the build.
#
base=$(pwd)

#
# Defaults
#
package=tools
package_base=${base}/${package}
prefix=none
branch="5"
master=${branch}
arch="all"
mail_to="build at rtems.org"
smtp_host=
dry_run=

#
# Repositories
#
rsb_git=git://git.rtems.org/rtems-source-builder.git

#
# Local build directories
#
rsb=rtems-source-builder.git

#
# Check options.
#
while getopts p:t:A:B:S:n opt
do
 case ${opt} in
  p)
   prefix=$OPTARG
   ;;
  t)
   mail_to=$OPTARG
   ;;
  A)
   arch=$OPTARG
   ;;
  B)
   branch=$OPTARG
   ;;
  S)
   smtp_host="--smtp-host=$OPTARG"
   ;;
  n)
   dry_run="--dry-run"
   ;;
  ?)
   echo "Usage: rtems-tools-builder -p PREFIX -B BRANCH -A ARCH"
   echo " default BRANCH is 5 (master) and ARCH is 'all'"
   exit 1 ;;
 esac
done

if [ $prefix = none ]; then
 prefix=${package_base}/${branch}
fi
rtems_prefix=${prefix}

if [ ! -d ${package_base} ]; then
 echo "error: cannot find the build base: ${package_base}"
 exit 1
fi
cd ${package_base}

if [ ${branch} = ${master} ]; then
 git_branch="master"
else
 git_branch=${branch}
fi

echo "RTEMS Tools Builder: ${branch} (${git_branch})"
if [ ! -d ${rsb} ]; then
 git clone ${rsb_git} ${rsb}
else
 cd ${rsb}
 git reset --hard
 git checkout ${git_branch}
 git pull
 cd ${package_base}
fi

cd ${rsb}
 cd rtems
 rm -rf build *.txt
 echo "../source-builder/sb-set-builder --prefix=${prefix} --without-rtems --keep-going \
				  --log=${branch}-${arch}.txt \
                                  ${branch}/rtems-${arch} --mail --mail-to=${mail_to} \
				  ${smtp_host} ${dry_run}"
 ../source-builder/sb-set-builder --prefix=${prefix} --without-rtems --keep-going \
				  --log=${branch}-${arch}.txt \
                                  ${branch}/rtems-${arch} --mail --mail-to=${mail_to} \
				  ${smtp_host} ${dry_run}
  cd ..
 cd ${package_base}

exit 0


More information about the users mailing list