# Building gnatlib

**URL:** https://forum.ada-lang.io/t/building-gnatlib/4751
**Category:** Help
**Tags:** gnat
**Created:** [September 18, 2026, 3:48pm UTC](https://forum.ada-lang.io/t/building-gnatlib/4751 "2026-09-18T15:48:20Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![PeterBB](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/peterbb/32/1089_2.png) [@PeterBB](https://forum.ada-lang.io/u/PeterBB)
#### Post date: [September 18, 2026, 3:48pm UTC](https://forum.ada-lang.io/t/building-gnatlib/4751/1 "2026-09-18T15:48:20Z")

</div>

Is there any way to do a stand alone build of  
lingnarl and libgnat without building the whole of gcc?

I’ve tried the following,

`mkdir build && cd build`  
`../gcc/configure --enable-languages=ada`  
`cd ada`  
`make gnatlib`

but it fails with

`raised raised ADA.IO_EXCEPTIONS.NAME_ERROR : s-oscons-tmplt.s: No such file or directory`

(having previously issued `rm -f rts/s-oscons-tmplt.i rts/s-oscons-tmplt.s`

---

<div class="post-metadata">

### Author: ![OneWingedShark](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/onewingedshark/32/305_2.png) [@OneWingedShark](https://forum.ada-lang.io/u/OneWingedShark)
#### Post date: [September 18, 2026, 4:09pm UTC](https://forum.ada-lang.io/t/building-gnatlib/4751/3 "2026-09-18T16:09:12Z")

</div>

That looks like a missing file or directory to me.

---

<div class="post-metadata">

### Author: ![PeterBB](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/peterbb/32/1089_2.png) [@PeterBB](https://forum.ada-lang.io/u/PeterBB)
#### Post date: [September 18, 2026, 5:12pm UTC](https://forum.ada-lang.io/t/building-gnatlib/4751/4 "2026-09-18T17:12:09Z")

</div>

Looks like the immediate cause of the first fail, is that the generated Makefile uses a variable,

$GCC\_FOR\_TARGET which is undefined when used. Hence errors such as;

`/bin/bash: line 2: -W: command not found`  
`/bin/bash: line 3: -W: command not found`

because the command should have been gcc -W etc, not just -W.

Defining GCC\_FOR\_TARGET, the build gets a bit farther,

then fails because tconfig.h is missing. I understand that file should be created

by configure, but is not.

`adaint.c:129:10: fatal error: tconfig.h: No such file or directory`

---

<div class="post-metadata">

### Author: ![AdaOrbit](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/adaorbit/32/879_2.png) [@AdaOrbit](https://forum.ada-lang.io/u/AdaOrbit)
#### Post date: [September 18, 2026, 5:13pm UTC](https://forum.ada-lang.io/t/building-gnatlib/4751/5 "2026-09-18T17:13:18Z")

</div>

run `gnatls -v`  
under “source path” is where your systems rts is. For me it’s `/usr/lib/gcc/x86_64-pc-linux-gnu/15/adainclude`. If you don’t have gnat but gcc with Ada support you can also run `gcc -print-file-name=adainclude` to get the path.

You can now build it yourself using by compiling it using `-gnatg` but I’m not sure if that will work on your system.

If you have the gcc source code you can just use libada.gpr. I haven’t tried that tho. See:

> **[Rebuilding the GNAT Run-Time Library (GNAT User’s Guide for Native Platforms)](https://gcc.gnu.org/onlinedocs/gcc-15.3.0/gnat_ugn/Rebuilding-the-GNAT-Run-Time-Library.html)**
>
> Rebuilding the GNAT Run-Time Library (GNAT User’s Guide for Native Platforms)

`https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/ada/libgnat/libada.gpr;h=2848c566ee10cdf5844786fd433d75175510726d;hb=refs/heads/master`

---

<div class="post-metadata">

### Author: ![PeterBB](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/peterbb/32/1089_2.png) [@PeterBB](https://forum.ada-lang.io/u/PeterBB)
#### Post date: [September 18, 2026, 7:26pm UTC](https://forum.ada-lang.io/t/building-gnatlib/4751/6 "2026-09-18T19:26:51Z")

</div>

Success, Thanks!! 😀

I’m building using gcc source. After the configure step I described above,

this is what I did.

```ada

cd ada/rts

mkdir rts-debug

cp rts-debug

cp -a gprls -v | grep adainclude .

cp -a -v ../../*.c .

cp -a -v ../../*.h .

```

(Copied in unwind-pe.h from libgcc)

`gprbuild -p -Plibada -j0 -XCFLAGS="-O2 -g" -XADAFLAGS="-gnatn"`

I think the key bit I was missing, was all the gprbuild switches.

---

<div class="post-metadata">

### Author: ![system](https://forum.ada-lang.io/uploads/default/original/1X/e625e7957e269cbf6d3128dab48a9e54fe3a9bdc.png) [@system](https://forum.ada-lang.io/u/system)
#### Post date: [September 19, 2026, 7:27pm UTC](https://forum.ada-lang.io/t/building-gnatlib/4751/7 "2026-09-19T19:27:13Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
