AdaCore / gnatcoll-core

GNAT Components Collection – Core packages
Other
44 stars 29 forks source link

gnatcoll_23.0.0_29478a20 make can't find gpr project file #70

Closed rogermc2 closed 1 year ago

rogermc2 commented 1 year ago

OSX Ventura GNAT 12.2.0 make fails with:

Roger@Rogers-Mac-mini gnatcoll_23.0.0_29478a20 % make
gprbuild -p -m --target=x86_64-darwin  -j0 -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=osx -XBUILD=PROD  -XLIBRARY_TYPE=static -XXMLADA_BUILD=static -XGPR_BUILD=static \
        -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=osx -XBUILD=PROD gnatcoll.gpr
gnatcoll.gpr:24:06: imported project file "gpr" not found
gprbuild: "gnatcoll.gpr" processing failed
t-14 commented 1 year ago

Sounds like you did not install libgpr like README.md says you should have?

rogermc2 commented 1 year ago

I did alr get for xmlada and libgpr but didn't realise that I needed to then build them. I've now built and installed xmlada but when I tried to follow the instructions for configuring and building libgpr I ran into problems. make setup OK but make all fails with: imported project file "xmlada" not found

t-14 commented 1 year ago

It's basically the same issue but with xmlada this time. you need to make sure your dependencies are correct... This is not a project to provide alr support, but (1) as you are using alr anyway why don't you let alr build libgpr for you too rather than do it by hand; and (2) look at alr printenv to see how dependencies are managed.

rogermc2 commented 1 year ago

Thanks Vasiliy. I don't use alr enough to be sufficiently familiar with it. I had wrongly assumed that get would also do the building. Definitely better if I can get alr to build libgpr so, I'd best get back to the alr documentation. After reading the documentation: xmlada, libgpr and gnatcoll successfully built using alr. However, one hiccupp, I needed to use sudo alr get --build or sudo alr run as appropriate.

t-14 commented 1 year ago

I am not sure how alr is set up on your system, but I don't think you want to run it as root rather than as user...

rogermc2 commented 1 year ago

The trouble is Roger@Rogers-Mac-mini libgpr_23.0.0_34e332b9 % alr build produces:

error: creation of new directory "alire/tmp" failed
error: alr encountered an unexpected error, re-run with -d for details.

or other errors, usually more complicated. This one is unusually simple enough that I could probably fix it by setting permissions.

I'm also assuming that once I've built a crate I need to install it by sudo make install as alr does not have an install function yet?

rogermc2 commented 1 year ago

I'm stuck trying to install libgpr. libgpr_23.0.0_34e332b9 % sudo make install fails with:

gprinstall -p -f --target=x86_64-apple-darwin19.6.0  "--prefix=/opt/GNAT/gnat-x86_64-darwin-12.2.0-1/bin/.." -XBUILD=production --mode=usage --install-name=gprbuild \
        -XINSTALL_MODE=nointernal gprbuild.gpr
gprbuild.gpr:19:06: imported project file "xmlada.gpr" not found
gpr.gpr:19:06: imported project file "xmlada" not found
gpr.gpr:19:06: imported by "/opt/alire/libgpr_23.0.0_34e332b9/gpr/gpr.gpr"
gpr.gpr:19:06: imported by "/opt/alire/libgpr_23.0.0_34e332b9/gprbuild.gpr"
gprinstall: "gprbuild.gpr" processing failed

xmlada.gpr is in /usr/local/share/gpr

 ls -l /usr/local/share/gpr/xmlada.gpr
-rw-r--r--  1 root  wheel  347 28 Sep 16:33 /usr/local/share/gpr/xmlada.gpr 

My .profile includes:

GPR_PROJECT_PATH=/usr/local/share/gpr:/opt/GNAT/gnat-x86_64-darwin-12.2.0-1/share/:/usr/local/share:/System/Volumes/Data/Ada_Source/OpenGLAda:/System/Volumes/Data/Ada_Source/OpenGLAda-examples:/usr/local/lib/gnat
export GPR_PROJECT_PATH

alr printenv shows that /usr/local/share/gpr is in GPR_PROJECT_PATH:

export ALIRE="True"
export GNAT_EXTERNAL_ALIRE_PREFIX="/Users/Roger/.config/alire/cache/dependencies/gnat_external_12.2.0_external"
export GPR_PROJECT_PATH="/opt/alire/libgpr_23.0.0_34e332b9/alire/cache/dependencies/xmlada_23.0.0_70494123/distrib:/opt/alire/libgpr_23.0.0_34e332b9/alire/cache/dependencies/xmlada_23.0.0_70494123/dom:/opt/alire/libgpr_23.0.0_34e332b9/alire/cache/dependencies/xmlada_23.0.0_70494123/input_sources:/opt/alire/libgpr_23.0.0_34e332b9/alire/cache/dependencies/xmlada_23.0.0_70494123/sax:/opt/alire/libgpr_23.0.0_34e332b9/alire/cache/dependencies/xmlada_23.0.0_70494123/schema:/opt/alire/libgpr_23.0.0_34e332b9/alire/cache/dependencies/xmlada_23.0.0_70494123/unicode:/opt/alire/libgpr_23.0.0_34e332b9/gpr:/usr/local/share/gpr:/opt/GNAT/gnat-x86_64-darwin-12.2.0-1/share/:/usr/local/share:/System/Volumes/Data/Ada_Source/OpenGLAda:/System/Volumes/Data/Ada_Source/OpenGLAda-examples:/usr/local/lib/gnat"
export LIBGPR_ALIRE_PREFIX="/opt/alire/libgpr_23.0.0_34e332b9"
export XMLADA_ALIRE_PREFIX="/opt/alire/libgpr_23.0.0_34e332b9/alire/cache/dependencies/xmlada_23.0.0_70494123"
t-14 commented 1 year ago

I fear this is turning into your build environment's debugging session :( May I just post the sequence of actions that should work, out of the box: "alr get libgpr; cd libgpr_*; alr build; eval `alr printenv`; gprinstall -p -Pgpr/gpr --prefix=..."

rogermc2 commented 1 year ago

This is the error I get if I don't run alr build as root:

error: Command ["gprbuild", "-s", "-j0", "-p", "-P", "/opt/alire/libgpr_23.0.0_34e332b9/gpr/gpr.gpr"] exited with code -1

Using sudo alr build and otherwise following your instructions, build completed successfully but gprinstall produced:

Roger@Rogers-Mac-mini libgpr_23.0.0_34e332b9 % sudo gprinstall -p -Pgpr/gpr 
gpr.gpr:19:06: imported project file "xmlada" not found
gprinstall: "gpr/gpr" processing failed

Thanks for your much appreciated assistance. As you said, there seems to be something wrong with my (OSX Ventura) build environment. So I think I'll abandon this effort with Ventura for a while. I still have a working system on my other computer which is restricted to OSX High Sierra.

t-14 commented 1 year ago

I think you are being hampered by this having to go through root business. Try setting everything in your home dir...

rogermc2 commented 1 year ago

Your comment didn't complete:

"I think you are being hampered by this having to go through root business. Try setting everything in your home dir..."

Set everything to what?

Fabien-Chouteau commented 1 year ago

@rogermc2 you are in between two workflows and you get the worst of both. If you want to use Alire, use it all the way. That means you don't have to install dependencies yourself just add them to your project. For instance:

$ alr init --bin my_application
$ cd my_application
$ alr with gnatcoll
$ alr build

This should work out of the box, let us know if it doesn't.

Now if you want to install compiled versions of the libraries like gnatcoll to use outside of an Alire workflow, which looks like it is what you are doing, then don't use Alire.

For instance for XMLada:

$ wget https://github.com/AdaCore/xmlada/archive/v23.0.0/xmlada-23.0.0.zip
$ unzip xmlada-23.0.0.zip
$ cd xmlada-23.0.0/
$ ./configure --prefix=/tmp/xmlada_install
$ make
$ make install -j1
rogermc2 commented 1 year ago

I'd prefer to install compiled versions of the libraries I used wget to obtain xmlada but I can't find the relevant github urls for libgpr and gnatcoll.

Fabien-Chouteau commented 1 year ago

Look at the release pages on GitHub repos: https://github.com/AdaCore/gnatcoll-core/releases

rogermc2 commented 1 year ago

I only see releases forgnatcoll-core on GitHub repos: https://github.com/AdaCore/gnatcoll-core/releases Not for libgpr and gnatcoll. Should I try and build gnatcoll-core according to its build instructions? I think I've tried before without success.

Fabien-Chouteau commented 1 year ago

Each project has its own repository with releases, e.g. https://github.com/AdaCore/xmlada/releases

rogermc2 commented 1 year ago

https://github.com/AdaCore/libgpr/releases results in page not found https://github.com/AdaCore/gnatcoll/releases results in There aren’t any releases here

Going to the gnatcoll Code tag produces

The current GNATCOLL project has been discontinued. It is replaced by three separate GitHub projects:

So I can't see how to follow your advice to:

ii. Download, build and install libgpr
iii. Download, build and install gnatcoll

I'll try and build gnatcoll-core

rogermc2 commented 1 year ago

My attempt to build resulted in:

Roger@Rogers-Mac-mini gnatcoll-core-23.0.0 % make setup
Roger@Rogers-Mac-mini gnatcoll-core-23.0.0 % make
gprbuild -p -m --target=x86_64-darwin  -j0 -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=osx -XBUILD=PROD  -XLIBRARY_TYPE=static -XXMLADA_BUILD=static -XGPR_BUILD=static \
        -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=osx -XBUILD=PROD gnatcoll.gpr
gnatcoll.gpr:24:06: imported project file "gpr" not found
gprbuild: "gnatcoll.gpr" processing failed
make: *** [build-static] Error 4
rogermc2 commented 1 year ago

I also attempted to build and install gprbuild-23.0.0 which built OK but install failed with the usual problem:

gprinstall -p -f --target=x86_64-apple-darwin19.6.0  "--prefix=/opt/GNAT/gnat-x86_64-darwin-12.2.0-1/bin/.." -XBUILD=production --mode=usage --install-name=gprbuild \
        -XINSTALL_MODE=nointernal gprbuild.gpr
gprbuild.gpr:19:06: imported project file "xmlada.gpr" not found
gpr.gpr:19:06: imported project file "xmlada" not found
gpr.gpr:19:06: imported by "/opt/GNAT/gprbuild-23.0.0/gpr/gpr.gpr"
gpr.gpr:19:06: imported by "/opt/GNAT/gprbuild-23.0.0/gprbuild.gpr"
gprinstall: "gprbuild.gpr" processing failed
make: *** [install] Error 4

What is most frustrating is that I've never previously had problems with make install. Is this possibly something to do with OSX Ventura permissions restrictions?

rogermc2 commented 1 year ago

I tried a minimal test to use XMLAda which failed with the usual imported project file "xmlada" not found. sudo gprbuild -P xmlada_test.gpr. As usual I had to use sudo. I'm now pretty sure that the problem is with my OSX Ventura environment that requires gnat-x86_64-darwin-12.2.0:

Roger@Rogers-Mac-mini Test % which gcc
gcc: aliased to gcc-12
Roger@Rogers-Mac-mini Test % which gnat
/opt/GNAT/gnat-x86_64-darwin-12.2.0-1/bin/gnat

Even gprbuild --version requires running as root otherwise failure to find libgcc_s.1.dylib.

 sudo gprbuild --version
GPRBUILD 22.0.0 (2021-11-09) (x86_64-apple-darwin19.6.0)
Copyright (C) 2004-2021, AdaCore

which most probably incompatible with x86_64-apple-darwin12. So, it seems I need to somehow build gprbuild with x86_64-apple-darwin12.

rogermc2 commented 1 year ago

I tried building using the ALR documentation instructions at 1: Using Alire GPR project file. Same problem

Synchronizing workspace...
◷ Solving dependencies... Looking for external crate: gprbuild... dyld[98107]: Library not loaded: /Users/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-darwin/gcc/install/lib/libgcc_s.1.dylib
  Referenced from: <EFD2269A-591A-39E4-B1FD-4A3D9F16796D> /usr/local/bin/gprbuild
  Reason: tried: '/Users/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-darwin/gcc/install/lib/libgcc_s.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-darwin/gcc/install/lib/libgcc_s.1.dylib' (no such file), '/Users/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-darwin/gcc/install/lib/libgcc_s.1.dylib' (no such file), '/usr/X11/lib/libgcc_s.1.dylib' (no such file)
Nothing to update.                                                  

ⓘ Building xml_test/xml_test.gpr...
dyld[98108]: Library not loaded: /Users/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-darwin/gcc/install/lib/libgcc_s.1.dylib
  Referenced from: <EFD2269A-591A-39E4-B1FD-4A3D9F16796D> /usr/local/bin/gprbuild
  Reason: tried: '/Users/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-darwin/gcc/install/lib/libgcc_s.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-darwin/gcc/install/lib/libgcc_s.1.dylib' (no such file), '/Users/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-darwin/gcc/install/lib/libgcc_s.1.dylib' (no such file), '/usr/X11/lib/libgcc_s.1.dylib' (no such file)
error: Command ["gprbuild", "-s", "-j0", "-p", "-P", "/System/Volumes/Data/Ada_Projects/Test/xml_test.gpr"] exited with code -1
error: Compilation failed.

Again, incompatible gprbuild (GPRBUILD 22.0.0 (2021-11-09) (x86_64-apple-darwin19.6.0))?

rogermc2 commented 1 year ago

Simple gnatmake test failed`

with XMLAda;
procedure Xmlada_Test is
begin
   null;
end Xmlada_Test;
gnatmake xml_test.adb
gcc -c xml_test.adb
xml_test.adb:1:06: error: file "xmlada.ads" not found
gnatmake: "xml_test.adb" compilation error

I now suspect that this is a known bug in Mac Ventura involving full disk access.