Cannot build on Fedora 41 with Alire

I use Alire on my Windows machine and it works as expected.

I wanted to try and build one of my projects on a VPS which runs Fedora 41.
I’ve downloaded the Alire release for Linux, set the PATH.
I selected the latest gnat_native.
I used Alire to create a test program but I can’t seem to build it:

[frederic@gc test]$ alr build
ⓘ Building test=0.1.0-dev/test.gpr...
Setup
   [mkdir]        object directory for project Test
   [mkdir]        exec directory for project Test
Compile
   [Ada]          test.adb
Bind
   [gprbind]      test.bexch
   [Ada]          test.ali
Link
   [link]         test.adb
/home/frederic/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/bin/../lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find crt1.o: No such file or directory
/home/frederic/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/bin/../lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/home/frederic/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/bin/../lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -ldl: No such file or directory
/home/frederic/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/bin/../lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lc: No such file or directory
/home/frederic/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/bin/../lib/gcc/x86_64-pc-linux-gnu/14.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
gprbuild: link of test.adb failed
gprbuild: failed command was: /home/frederic/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/bin/gcc test.o b__test.o -L/home/frederic/ada/test/obj/development/ -L/home/frederic/ada/test/obj/development/ -L/home/frederic/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/lib/gcc/x86_64-pc-linux-gnu/14.2.0/adalib/ -static-libgcc /home/frederic/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/lib/gcc/x86_64-pc-linux-gnu/14.2.0/adalib/libgnat.a -ldl -Wl,-rpath-link,/home/frederic/.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/lib/gcc/x86_64-pc-linux-gnu/14.2.0//adalib -Wl,-z,origin,-rpath,$ORIGIN/..//obj/development:$ORIGIN/../../..//.local/share/alire/toolchains/gnat_native_14.2.1_06bb3def/lib/gcc/x86_64-pc-linux-gnu/14.2.0/adalib -o /home/frederic/ada/test/bin//test
error: Command ["gprbuild", "-s", "-j0", "-p", "-P", "/home/frederic/ada/test/test.gpr"] exited with code 4
error: Compilation failed.

The Alire manual only says to unzip the archive and change the path. But it does not look like it’s working out of the box.

It must be something dumb I’m not doing right :thinking:

EDIT: it works after installing the package glibc-devel via the distribution’s package manager.

1 Like

Watch out for gnatclean on Fedora, if you use it. It will delete necessary ada infrastructure.

I don’t have the output handy right now, but if you create a hello_world or something very simple, compile it with gnatmake and then run gnatclean, it will delete stuff not pertinent to the compile and necessary to use gnat. Trying to run gnatmake again will fail. Then the gnat packages wll have to be deleted and re-installed.

I do not know if this has any bearing with Alire or not.

FYI…

RBE

If you’re running into the error on macOS (Apple Silicon) with GNAT/Alire, where it says ld returned 1 exit status or ld: library not found for -lSystem, it’s because GNAT isn’t picking up the correct paths to system libraries in the Xcode SDK.

To fix this, you need to tell the linker the right path.

alr build -- -largs "-L$(xcrun --show-sdk-path)/usr/lib"

This tells the linker exactly where to look for the missing system libraries.

2 Likes