AdaCore / gprbuild

GPRbuild is an advanced build system designed to help automate the construction of multi-language systems.
Other
64 stars 21 forks source link

Gprinstall --uninstall can’t find manifest #37

Closed simonjwright closed 6 years ago

simonjwright commented 6 years ago

With this Install package

   package Install is
      for Prefix use "arm-eabi/lib/gnat/stm32f4";
      for Sources_Subdir use "adainclude";
      for Ali_Subdir use "adalib";
      for Lib_Subdir use "adalib";
      for Required_Artifacts (".") use ("runtime.xml");
      for Required_Artifacts ("adalib") use ("adalib/stm32f407-flash.ld");
      for Install_Project use "false";
   end Install;

and a compiler prefix of /opt/gcc-8.0.1, I get

$ gprinstall -p -P build_runtime.gpr
Install project Build_Runtime
$ gprinstall --uninstall -P build_runtime.gpr
gprinstall: Project /opt/gcc-8.0.1/share/gpr/manifests/build_runtime not found.

but

$ ls -l /opt/gcc-8.0.1/share/gpr/manifests/build_runtime
ls: /opt/gcc-8.0.1/share/gpr/manifests/build_runtime: No such file or directory

which isn’t surprising, because --uninstall has ignored Install’Prefix. The manifest is in fact here:

$ ls -l /opt/gcc-8.0.1/arm-eabi/lib/gnat/stm32f4/share/gpr/manifests/
total 56
-rw-r--r--  1 simon  staff  26710 13 Apr 12:04 build_runtime

Incidentally, I found the error message a bit confusing: perhaps it should say "Project manifest ... not found."

TurboGit commented 6 years ago

Thanks for the detailed analysis.

TurboGit commented 6 years ago

Indeed when uninstalling the parameter is a manifest file and not a project. This is because multiple instance of the same project (with different scenario variable) can be installed under the same name (the manifest file. And moreover, one do not need to have the project around to uninstall. Of course specifying manifest instead of project in the error message would be less confusing.

simonjwright commented 6 years ago

Indeed when uninstalling the parameter is a manifest file and not a project

That doesn’t seem to be the case? Or, it only works if the manifest is in the expected place ($prefix/share/gpr/manifests). Or, if the parameter actually is a GPR (even if signalled by -P), the contents are ignored and only the bare filename is used.

$ ls -l /opt/gcc-8.0.1/arm-eabi/lib/gnat/stm32f429i/share/gpr/manifests/
total 56
-rw-r--r--  1 simon  staff  27264 12 Apr 21:58 build_runtime
$ gprinstall --uninstall /opt/gcc-8.0.1/arm-eabi/lib/gnat/stm32f429i/share/gpr/manifests/build_runtime 
gprinstall: Project /opt/gcc-8.0.1/share/gpr/manifests/build_runtime not found.

The documentation says

At a minimum, to invoke GPRinstall you must specify a main project file in a command such as gprinstall proj.gpr or gprinstall -P proj.gpr.

which appears to be untrue for --uninstall.

By the way, I’m using it to install an RTS, so I can’t use --install-name; the files have to be in adainclude/, not adainclude/install-name/! (would be glad to be corrected on this)

TurboGit commented 6 years ago

It is now possible to uninstall using a manifest file. So in your case the two following options should be working:

$ gprinstall --uninstall --prefix=/opt/gcc-8.0.1/arm-eabi/lib/gnat/stm32f4 build_runtime

or

$ gprinstall --uninstall /opt/gcc-8.0.1/arm-eabi/lib/gnat/stm32f4/share/gpr/build_runtime

simonjwright commented 6 years ago

Can confirm that both options work.