Skip to content

#15, gpr2.gpr: Missing units in the relocatable Library_Interface attribute definition#16

Open
dsauvage wants to merge 1 commit intoAdaCore:mainfrom
AdaLabs:main-issue-15
Open

#15, gpr2.gpr: Missing units in the relocatable Library_Interface attribute definition#16
dsauvage wants to merge 1 commit intoAdaCore:mainfrom
AdaLabs:main-issue-15

Conversation

@dsauvage
Copy link
Copy Markdown

@dsauvage dsauvage commented Feb 3, 2026

The missing units below have been added to the relocatable Library_Interface attribute definition

GPR2.Build.Jobserver_Protocol.Pipe
GPR_Parser.Private_Converters
GPR2.Build.View_Tables.Update_Sources_List
GPR2.Tree_Internal.Load_Autoconf

Above fix is for instance required to successfully build libadalang (26.0.0), which depends on gpr2 (26.0..0)

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 3, 2026

CLA assistant check
All committers have signed the CLA.

@Jicquel
Copy link
Copy Markdown
Collaborator

Jicquel commented Feb 3, 2026

Hi, I did not manage to reproduce the libadalang build issue. Could you please provide a reproducer?

@dsauvage
Copy link
Copy Markdown
Author

dsauvage commented Feb 3, 2026

Apologize i can not send you an automated reproducer
I can reproduce using the steps below;

  1. using the gnat_native 15.2.1 compiler from alire
  2. build gpr2 using its alire crate (libgpr2_26.0.0_99e9d2cd) both in static and relocatable mode
  3. install it
  4. build libadalang using its alire crate (libadalang_26.0.0_75276b8d) both in static and relocatable mode
    the first errors pop up during the call to gprclean before the build, but more errors to follow during the build on other units once you fix them
cd FOLDER/alire/crates/libadalang_26.0.0_75276b8d
gprclean -p -P libadalang.gpr -XLIBRARY_TYPE=static -XBUILD_MODE=prod
gprclean -p -P libadalang.gpr -XLIBRARY_TYPE=relocatable  -XGNATCOLL_ICONV_BUILD=relocatable -XLANGKIT_SUPPORT_BUILD=relocatable -XGNATCOLL_GMP_BUILD=relocatable -XBUILD_MODE=prod
gpr2.gpr:25:1111: "gpr2.build.view_tables.update_sources_list" is not a unit of this project
gpr2.gpr:25:2862: "gpr2.tree_internal.load_autoconf" is not a unit of this project
gprclean: "libadalang.gpr" processing failed

@Jicquel
Copy link
Copy Markdown
Collaborator

Jicquel commented Feb 5, 2026

Thank you for the reproducer!

First, I tried building libadalang with alire in relocatable mode, using the same versions, and alr build worked correctly from the libadalang crate.

If I understand correctly, you are not using the alr build / alr install commands, but invoking the GPR tools directly instead—correct?

Could you please elaborate a bit on the commands you ran? I tried using the GPR tools directly as in your comment, but I wasn’t able to reproduce the issue.

@dsauvage
Copy link
Copy Markdown
Author

dsauvage commented Feb 20, 2026

Hi,
I have been able to create a systematic reproducer, it install libgpr2 from alire crate, then get libadalang crate, and make sure libadalang crate uses the libgpr2 installed component.

#
# 1. Init the build env
#

export DEV_PATH=/home/user/dev/reproducers
mkdir -p $DEV_PATH/settings
export ALIRE_SETTINGS_DIR=$DEV_PATH/settings
mkdir $DEV_PATH/crates
cd $DEV_PATH/crates

alr toolchain --select
# select gnat_native and gprbuild, both at index 1

#
# 2. get libgpr2 and install it
#

alr get libgpr2
alr build

alr exec -- make prefix=/tmp/gnat/ ENABLE_SHARED=yes GPR2_BUILD=release setup
alr exec -- make
alr exec -- make install


#
# 2. get libadalang and pin the installed libgpr2 component as its dependency
#

alr get libadalang
cd libadalang_26.0.0_75276b8d/

alr pin libgpr2 --use /tmp/gnat/share/gpr/

#
# 3. run gprclean in relocatable mode, that is a simple way to reproduce the issue 
#

alr exec --  gprclean -p -P libadalang.gpr -XLIBRARY_TYPE=relocatable  -XGNATCOLL_ICONV_BUILD=relocatable -XLANGKIT_SUPPORT_BUILD=relocatable -XGNATCOLL_GMP_BUILD=relocatable -XBUILD_MODE=prod

The gprclean call returns the errors below, which are fixed by our pull request:

gpr2.gpr:23:1111: "gpr2.build.view_tables.update_sources_list" is not a unit of this project
gpr2.gpr:23:2862: "gpr2.tree_internal.load_autoconf" is not a unit of this project
gprclean: "libadalang.gpr" processing failed
error: Command ["gprclean", "-p", "-P", "libadalang.gpr", "-XLIBRARY_TYPE=relocatable", "-XGNATCOLL_ICONV_BUILD=relocatable", "-XLANGKIT_SUPPORT_BUILD=relocatable", "-XGNATCOLL_GMP_BUILD=relocatable", "-XBUILD_MODE=prod"] exited with code 7

@Jicquel
Copy link
Copy Markdown
Collaborator

Jicquel commented Feb 23, 2026

Thanks a lot for the reproducer! I gave a look at the installed version of gpr2.gpr, and it seems that separate units of library interface units are also added to the library interface, but their sources are not copied, which leads to this error.

Your PR fixes indeed the error, but not the bug. We will probably merge it because it is an easy workaround, but I would like to understand a bit more the bug before. I will keep you tuned!

@saper
Copy link
Copy Markdown

saper commented Mar 2, 2026

I've run into this today. Are those (and maybe some others) private interfaces that should not be listed?

@Jicquel
Copy link
Copy Markdown
Collaborator

Jicquel commented Mar 31, 2026

Hi @saper, sorry for the late answer. These private interfaces should indeed not be listed at first. This issue does not occur with the latest version of gprbuild2, so we will see what is possible to do with the alire team.
@dsauvage, I don't think we should merge this PR, as this is a gprinstall issue at the end. We will keep you updated of the solution found for alire.

@saper
Copy link
Copy Markdown

saper commented Mar 31, 2026

@Jicquel I believe this has not much to do with alire? I was running this when building the project manually without using Alire much for this.

If it is private, it shall not be used by the libadalang. If it needs to be used, it shall be public and published. Or else?

@Jicquel
Copy link
Copy Markdown
Collaborator

Jicquel commented Apr 13, 2026

@saper

If it is private, it shall not be used by the libadalang. If it needs to be used, it shall be public and published. Or else?

You're right. As we understand it, the issue here is that gprinstall was adding sources to the interfaces that were not meant to be public, while their related sources were not copied to the installed include directory. As a result, using a gpr tool on the installed project would fail with an error such as:

“gpr2.gpr:25:1111: gpr2.build.view_tables.update_sources_list is not a unit of this project,”

even though that unit is not actually used by the project importing the gpr2 library.

Regarding the Alire topic, this is not directly related to Alire itself, but rather to the version of gprinstall it provides. If you’ve encountered this issue as well, could you try building gpr2 from the GitHub repository and using the gprinstall obtained from it?

Many thanks!

@saper
Copy link
Copy Markdown

saper commented Apr 15, 2026

@Jicquel shall I install gpr2 using the gprinstall obtained from gpr2?

@Jicquel
Copy link
Copy Markdown
Collaborator

Jicquel commented Apr 15, 2026

Yes, it should install gpr2 properly

@saper
Copy link
Copy Markdown

saper commented Apr 15, 2026

Sorry, it does not even build with itself

/home/saper/install/ada/bin/gprbuild -p -j0 -XGPR2_BUILD=release_checks -XBUILD_ROOT="/usr/home/saper/src/ada/gpr2/.build"  -XPROFILER=no  -XLIBRARY_TYPE=static -XXMLADA_BUILD=static \
	./gpr2.gpr
".build/release_checks/obj-static" created
".build/release_checks/lib-static" created
error: raised PROGRAM_ERROR : gpr2-build-tree_db.adb:104 build-in-place mismatch
0x848cc7 Gpr2.Build.Tree_Db.Action_Id_To_Reference at gpr2-build-tree_db.adb:104
0x72efd3 Gpr2.Build.Process_Manager.Execute at gpr2-build-process_manager.adb:463
0x852fb0 Gpr2.Build.Tree_Db.Execute at gpr2-build-tree_db.adb:553
0x42ffda Gprbuild.Main.Execute at gprbuild-main.adb:78
0x435f14 Gprbuild.Main at gprbuild-main.adb:459
0x43be4a Main at b__gprbuild-main.adb:2448
0x826a1241d ??? at ???
0x42fe82 _start at crt1_s.S:80
0xfffffffffffffffe ??? at ???

an attempt just to install previously built gpr2 with gprinstall 2 fails with this

error: gpr2-build-tree_db.adb:104 build-in-place mismatch

@Jicquel
Copy link
Copy Markdown
Collaborator

Jicquel commented Apr 15, 2026

I don't have the issue locally. I ran the following commands, with a gprbuild already available:

make
./tools/projects/.build/release_checks/gprinstall -P gpr2.gpr  -XGPR2_BUILD=release_checks -XBUILD_ROOT=".build" -XPROFILER=no  -XLIBRARY_TYPE=relocatable -XXMLADA_BUILD=static --prefix=toto -p

What version of gprbuild did you use?

@saper
Copy link
Copy Markdown

saper commented Apr 15, 2026

> /home/saper/install/ada/bin/gprbuild --version
GPRBUILD Pro 18.0w (19940713) (x86_64-portbld-freebsd16.0)
GPRBUILD Engine 2
Copyright (C) 2022-2016, AdaCore
This is free software; see the source for copying conditions.
See your AdaCore support agreement for details of warranty and support.
If you do not have a current support agreement, then there is absolutely
no warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

It was built from 7b4bb99 which is #16 on top of 4e760cb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants