Alire: cannot find crtend.o

Hi, alire is failing me again, saying “/home/drm/.local/share/alire/toolchains/gnat_native_14.1.3_965c1e0e/bin/ld: cannot find crtend.o: no file or folder of tish name”
gprbuild/gnatmake work, just not alire.
I tried purging gnat and gprbuild folders and reinstall them, no change.
I’ve already raised a github issue… But if you see somethingo obvious, don’t hesitate to tell me.

details error message

[link] test.adb
/home/drm/.local/share/alire/toolchains/gnat_native_14.1.3_965c1e0e/bin/ld: cannot find crtend.o: Aucun fichier ou dossier de ce nom
collect2: error: ld returned 1 exit status
gprbuild: link of test.adb failed
gprbuild: failed command was: /home/drm/.local/share/alire/toolchains/gnat_native_14.1.3_965c1e0e/bin/gcc test.o b__test.o /home/drm/.local/share/alire/builds/gnatcoll_24.0.0_11c512d1/1972d1797d761d493f1d7fa409cf2d7a7a27429279d468c28e9fabbd97d926f9/lib/gnatcoll/static/libgnatcoll.a /home/drm/.local/share/alire/builds/libgpr_24.0.0_d9c96bda/ab5a8449e50442ee1b11507d1b8b42bcb41f62b0c668a4289f1dc897e911f994/gpr/lib/production/static/libgpr.a /home/drm/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/schema/lib/static/libxmlada_schema.a /home/drm/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/dom/lib/static/libxmlada_dom.a /home/drm/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/sax/lib/static/libxmlada_sax.a /home/drm/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/input_sources/lib/static/libxmlada_input_sources.a /home/drm/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/unicode/lib/static/libxmlada_unicode.a -ldl -L/home/drm/test/obj/development/ -L/home/drm/test/obj/development/ -L/home/drm/.local/share/alire/builds/gnatcoll_24.0.0_11c512d1/1972d1797d761d493f1d7fa409cf2d7a7a27429279d468c28e9fabbd97d926f9/lib/gnatcoll/static/ -L/home/drm/.local/share/alire/builds/libgpr_24.0.0_d9c96bda/ab5a8449e50442ee1b11507d1b8b42bcb41f62b0c668a4289f1dc897e911f994/gpr/lib/production/static/ -L/home/drm/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/unicode/lib/static/ -L/home/drm/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/sax/lib/static/ -L/home/drm/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/input_sources/lib/static/ -L/home/drm/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/dom/lib/static/ -L/home/drm/.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/schema/lib/static/ -L/home/drm/.local/share/alire/toolchains/gnat_native_14.1.3_965c1e0e/lib/gcc/x86_64-pc-linux-gnu/14.1.0/adalib/ -static-libgcc /home/drm/.local/share/alire/toolchains/gnat_native_14.1.3_965c1e0e/lib/gcc/x86_64-pc-linux-gnu/14.1.0/adalib/libgnat.a -ldl -Wl,-rpath-link,/home/drm/.local/share/alire/toolchains/gnat_native_14.1.3_965c1e0e/lib/gcc/x86_64-pc-linux-gnu/14.1.0//adalib -Wl,-z,origin,-rpath,$ORIGIN/…//obj/development:$ORIGIN/…/…//.local/share/alire/builds/gnatcoll_24.0.0_11c512d1/1972d1797d761d493f1d7fa409cf2d7a7a27429279d468c28e9fabbd97d926f9/lib/gnatcoll/static:$ORIGIN/…/…//.local/share/alire/builds/libgpr_24.0.0_d9c96bda/ab5a8449e50442ee1b11507d1b8b42bcb41f62b0c668a4289f1dc897e911f994/gpr/lib/production/static:$ORIGIN/…/…//.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/unicode/lib/static:$ORIGIN/…/…//.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/sax/lib/static:$ORIGIN/…/…//.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/input_sources/lib/static:$ORIGIN/…/…//.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/dom/lib/static:$ORIGIN/…/…//.local/share/alire/builds/xmlada_24.0.0_ae5a015b/491f4fc1c53e9962115b4d147015304630bb0fe17452e174cc1c07e3972f8d1e/schema/lib/static:$ORIGIN/…/…//.local/share/alire/toolchains/gnat_native_14.1.3_965c1e0e/lib/gcc/x86_64-pc-linux-gnu/14.1.0/adalib -o /home/drm/test/bin//test
error: Command [“gprbuild”, “-s”, “-j0”, “-p”, “-P”, “/home/drm/test/test.gpr”] exited with code 4
error: Build failed

Oh and something else unrelated. Is it possible to bundle the ads and adb files together in one ? I mean, and have it recognized by the compiler one way or the other.

Thanks.

Have you tried to name your source file .ada ?

Language-wise, you can absolutely have a file containing both the body and spec… for multiple compilation units, even!

That said… GNAT has an implementation-limitation where it cannot have more than one spec or body within the same file.

On Linux such messages usually means that libc’s development package is not installed.

It is a bit strange that it doesn’t complain about crt0.o, however, lets check that package is installed and install it if not.

libc6 is already the newest version (2.39-7).

Same version for libc6-dev.

I did try a .ada and indeed it complains that there is more than one compilation unit. what a bummer. I just thought maybe there was some command-line option or preprocessing with gnatchop or what not but no. For small projects it can be annoying to always need several files… As Jean Ichibiah said, a smart compiler should be able to tell what has been updated or not. why not just let people manage their project how they want ?

GNAT has an implementation limitation, you cannot have more than one specification or body within a file.

TBH, it’s the legacy of C and UNIX—
Unstructured text is honestly terrible for code:

  1. it forces processing, and re-processing,
  2. this processing doesn’t necessarily need to happen,
  3. but if it’s recorded somewhere and comes out of sync , it blows everything up.

Files are a terrible medium for source:

  1. if there is bookkeeping, then sometimes the bookkeeping info becomes out of sync-
  2. the dependencies upon system attributes (e.g. CASE-INSENSITIVE vs Case-Sensitive)
  3. the dependency on possibly fragile state (e.g. ownership, permissions)
  4. the dependency on locations within the file-system.

IOW, Ichibiah’s “smart compiler” really ought to be one where the source is under far more care and control: say stored as structures in a database — this is to say, an actual integrated-development environment.

That’s not what I understand when reading this : 3. The GNAT Compilation Model — GNAT User's Guide for Native Platforms 25.0w documentation

The paragraph before 3.2 says:

Each file contains a single Ada compilation unit, including any pragmas associated with the unit. For example, this means you must place a package declaration (a package spec ) and the corresponding body in separate files. An Ada compilation (which is a sequence of compilation units) is represented using a sequence of files. Similarly, you will place each subunit or child unit in a separate file.

Notice that the example used in 3.3.2 has "myutilst_a.ada" and "myutilst.ada", this is to work around that limitation I spoke of.

That’s right.
I thought one could use the same filename for both pragma like in the following.
However, this might not be accepted by the compiler

pragma Source_File_Name (My_Utilities.Stacks, Spec_File_Name => "myutilst.ada");
pragma Source_File_name (My_Utilities.Stacks, Body_File_Name => "myutilst.ada");

Not might, will not be accepted by GNAT: this is an implication of how GNAT implemented Ada83’s “library” feature using the file-system.
Other compilers do not have this limitation.

Did you ever use DEC’s VAX/VMS compiler? It kept an 'Ada Library`, and when it got out of step (not a rare event) you (we) had to wipe the lot and reinsert all the components (as I remember, by hand). I would resist this approach.

1 Like

You can use gnatname to generate the required pragmas,

pragma Source_File_Name
  (List,
   Spec_File_Name => "list.ada", Index => 1);
pragma Source_File_Name
  (List,
   Body_File_Name => "list.ada", Index => 2);

(Index => n means “the nth unit in the file”).

You can get it to generate a .adc file, but I don’t see how to use it (-gnatec=list.adc didn’t work). However, it works fine in a .gpr; see e.g. ACATS-grading/tools.gpr, which I think was created using gnatname though I don’t seem to have a record of the process :slightly_frowning_face:

1 Like

I did not.
But was that compiler/toolchain built on a database, or was the library/database “in addition to” or “bolted onto” the filesystem?

DEC Ada had a separate library manager command that the compiler used to store/load objects. Sort of like an interactive linker. The library database was managed in user space on top of the file system.

There’s some documentation here:

I had an account on the Living Computer Museum’s VAX before they shut down. I believe sdf.org inherited that hardware and plans to put it back online. DEC Ada was available on that machine.

Not sure of your point here. All databases are built on a filesystem in somebody’s computer (back in the day Ferranti had/had designed a database engine based on an embedded 68020, AFAICR, but that was/would have been an outlier)

The point is that many systems “bolt on” functionality by “tracking” files within the system, rather than holding the actual-data within the database. The former is prevalent because it’s “easy” and programmers “can use vi/nano/notepad” to edit files. — If you were to have an database which actually contained the data, it would essentially force an IDE to interact with the stored data. (Although I suppose you could have a document database to try to “do both”… but I’ve not heard of that track being taken in any IDE system.)