How to specify Ada runtime with GPRbuild

I have a runtime installed at this location:

$ ls -1 ${HOME:?}/bare_runtime
adainclude
adalib

I can build object files if I invoke GCC cross-compiler directly and specify the path to runtime:

$ ${HOME:?}/gcc-15.2.0_sparc64-unknown-elf/bin/sparc64-unknown-elf-gcc -c bit_ops.adb --RTS=${HOME:?}/bare_runtime
$ file bit_ops.o
bit_ops.o: ELF 64-bit MSB relocatable, SPARC V9, relaxed memory ordering, version 1 (SYSV), not stripped

However this does not work when using GPRbuild with a specific config file:

$ PATH="${HOME:?}/gcc-15.2.0_native/bin:${HOME:?}/gcc-15.2.0_sparc64-unknown-elf/bin" gprbuild -P libdsa.gpr --config=sparc64-unknown-elf.cgpr --RTS=${HOME:?}/bare_runtime
warning: runtimes are taken into account only in auto-configuration
libdsa.gpr:7:17: warning: there are no sources of language "C" in this project
Compile
   [Ada]          bit_ops.adb
fatal error, run-time library not installed correctly
cannot locate file system.ads
compilation abandoned
gprbuild: *** compilation phase failed

I suspect the warning is telling me if I use --config= option, then --RTS= option is ignored. I tried setting for Runtime_Dir (“Ada”) use “<path_to_runtime>” in .cgpr file but that did not seem to help.

Any ideas how to tell GPRbuild where to find this runtime?

Why do you need --config=sparc64-unknown-elf.cgpr?

Because it tells GPRbuild where and how to locate my bare metal cross-compiler. Without it GPRbuild produces these errors:

$ PATH="${HOME:?}/gcc-15.2.0_native/bin:${HOME:?}/gcc-15.2.0_sparc64-unknown-elf/bin" gprbuild -P libdsa.gpr --target=sparc64-unknown-elf --RTS=${HOME:?}/bare_runtime
gprconfig: can't find a toolchain for the following configuration:
gprconfig: language 'ada', target 'sparc64-unknown-elf', runtime '/home/user/bare_runtime'
libdsa.gpr:7:17: warning: there are no sources of language "C" in this project
libdsa.gpr:9:33: warning: libraries are not supported on this platform
libdsa.gpr:7:17: no compiler for language "Ada", cannot compile "bit_ops.ads"
gprbuild: *** compilation phase failed

The only way I managed to work around it is by copying runtime files to:

${HOME}/gcc-15.2.0_sparc64-unknown-elf/lib/gcc/sparc64-unknown-elf/15.2.0/adainclude
${HOME}/gcc-15.2.0_sparc64-unknown-elf/lib/gcc/sparc64-unknown-elf/15.2.0/adalib

these paths seem to be hardcoded to default locations when looking for a runtime. Ideally I want to find a way to specify the runtime explicitly in a different location, as I want to experiment with different runtimes.

Am I missing something or GPRbuild is just not flexible enough to locate the runtime via --RTS= command line option or the equivalent Runtime project option?

The --RTS= should be working… However, pointing the linker to the appropriate rts (libgnat.a) is also okay as seen in the Ironclad kernel build script: First filename). Third.

I hope it helps,
Fer

Anyone knows the rationale for why GPRbuild ignores --RTS= option when used with --config= option? Because if the alternative is to use Runtime_Dir in *.cgpr file, well that option also seems to be ignored.