Closed dvraaij closed 1 year ago
Yes, this is unfortunately a particularity of the gnat compilation model, object and ali file names being constructed by stripping the extension of the body file rather than using the unit name, which gprinstall doesn't properly take into account. We are currently working on a workaround for this in the new gpr rewrite, but we won't backport it here. As a workaround, have your source variants differ by extension instead:
when "variant1" => for Body ("Foo") use "foo.adb__variant1";
when "variant2" => for Body ("Foo") use "foo.adb__variant2";
Consider a library project that contains only one package
Foo
. This package has two implementation variants that can be selected with a scenario variable.One can now subsequently build and then install the project, and use the
-m
option of GPRinstall to (quote from the manual) "Install only the interface sources (minimal set of sources)":The installation will then look something like this (note in particular the name of the ALI file in
usr/lib/foo
)However, attempting to use this library
will result in an error
So, at first sight, it seems that there is an issue with using the
-m
option when installing libraries that contain packages that have multiple implementation variants (bodies): GPRinstall does not properly rename the ALI file during installation.On the other hand, it may also be an issue with the generation of the ALI files itself. As both package specs and bodies may have variants, maybe an ALI file should always be named after the compilation unit itself (e.g., the package name or the name of the subprogram) instead of being named after a source code file within the compilation unit. The filenames of the sources are already embedded in the ALI file anyway so no information is lost. The issue would then be related to the
gnatbind
program, I think.The problem was found in a build of the GPRbuild Community 23.0.0 release published on GitHub. The issue could be reproduced with both GCC 12 and 13 (prerelease):