linkeradagnat-gpsgnatcoll

gprbuild fails to include a file needed for gnatcoll


I tried to build something with GnatColl from GPS Community 2021 on Fedora 35. The linker failed, saying

ld: /path/to/common/Ada/Quoter/obj/gnatcoll-refcount.o: in function `gnatcoll__refcount__sync_bool_compare_and_swap':
gnatcoll-refcount.adb:(.text+0x622): undefined reference to `gnatcoll_sync_bool_compare_and_swap_access'
collect2: error: ld returned 1 exit status

This also fails if I try to run the project using gprbuild -P Quoter.gpr.

I can fix this from the command line by copying the failed command (gcc ...) and adding ~/opt/GNAT/2021/include/gnatcoll/gnatcoll_support.c to the list of files to compile, as that's the included file with the desired function. That's awfully inconvenient, though.

I guess I have something configured slightly wrong. Might anyone here have an idea?


Solution

  • I found the answer, and it's a bit embarrassing, but looking in the gnatcoll examples would have done it: add with "gnatcoll"; to the beginning of the gpr file.