AdaCore / gnatcoll-core

GNAT Components Collection – Core packages
Other
45 stars 30 forks source link

Unable to build -- apparent circular dependency #60

Closed byu9 closed 2 years ago

byu9 commented 2 years ago

Hi, There is an apparent circular dependency during build

The details are as follows

When attempting to build gnatcoll-core on Debian Linux with gnat 10.2.1 and gprbuild Pro 18.0w, dependency is not met on gpr

# ~/Downloads/gnatcoll-core-20.2
make

...
gnatcoll.gpr:24:06: imported project file "gpr" not found
gprbuild: "gnatcoll.gpr" processing failed
make: *** [Makefile:128: build-static] Error 4

However, when building gpr, a dependency is not met on gnatcoll_iconv, gnatcoll_gmp, langkit_support, and libadalang.

# ~/Downloads/gpr-20.2
make
...
gpr2.gpr:19:06: imported project file "gnatcoll_iconv" not found
gpr2.gpr:20:06: imported project file "gnatcoll_gmp" not found
gpr2.gpr:21:06: imported project file "langkit_support" not found
gpr2.gpr:22:06: imported project file "libadalang" not found
gprbuild: "gpr2.gpr" processing failed
make: *** [Makefile:104: build-static] Error 4

However, when building libadalang, a dependency is not met on gnatcoll-core

In ~/Downloads/libadalang-20.2/user_manual/building.rst:

  • Build and install the GNATcoll library (core, plus Iconv and GMP bindings). You can find its source release on AdaCore's website <https://www.adacore.com/download> or directly on GitHub's repositories for gnatcoll-core <https://github.com/AdaCore/gnatcoll-core> and gnatcoll-bindings <https://github.com/AdaCore/gnatcoll-bindings>_. Just make sure you checkout the gpl-20** branch corresponding to your GNAT Community release.
t-14 commented 2 years ago

Hi,

I think you are confusing names of gpr files with names of gh projects they come from. "gpr.gpr" is coming from project "gprbuild", not from project "gpr" (the latter provides gpr2.gpr)

byu9 commented 2 years ago

OK That makes sense. Thanks. EDIT -- For anyone seeing this post install libgnatprj8-dev (support for programs processing GNAT projects (development)) on Debian Bullseye will resolve the missing dependencies.

bib1963 commented 2 years ago

To AdaCore - please update the README.md file to tell everyone this. It is not clear at all.

tkacvins commented 8 months ago

This is not solved for me. I get this error

gprbuild -p -m --target=x86_64-linux  -j0 -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD   -XLIBRARY_TYPE=static -XXMLADA_BUILD=static -XGPR_BUILD=static \
        -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD gnatcoll.gpr -v

==============Messages for file: /home/LOCAL/vapkay/gnatcoll-core/gnatcoll.gpr

    24. with "gpr";
             |
        >>> imported project file "gpr" not found
gprbuild: "gnatcoll.gpr" processing failed

even thought I have gprbuild installed. I am using the GNAT tool chain from GCC 12.1.0 (built from source) and gprbuild and gnatcoll GitHub projects, each at tag v24.0.0.

For gprbuild, I had to bootstrap gprbuild and also install xmlada per the build instructions. I followed the build instructions (and this issue), but even though gprbuild is installed, I cannot find gpr.gpr, or at least not anything that I could use in ADA_PROJECT_PATH

bib1963 commented 8 months ago

This is not solved for me. I get this error

gprbuild -p -m --target=x86_64-linux  -j0 -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD   -XLIBRARY_TYPE=static -XXMLADA_BUILD=static -XGPR_BUILD=static \
        -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD gnatcoll.gpr -v

==============Messages for file: /home/LOCAL/vapkay/gnatcoll-core/gnatcoll.gpr

    24. with "gpr";
             |
        >>> imported project file "gpr" not found
gprbuild: "gnatcoll.gpr" processing failed

even thought I have gprbuild installed. I am using the GNAT tool chain from GCC 12.1.0 (built from source) and gprbuild and gnatcoll GitHub projects, each at tag v24.0.0.

For gprbuild, I had to bootstrap gprbuild and also install xmlada per the build instructions. I followed the build instructions (and this issue), but even though gprbuild is installed, I cannot find gpr.gpr, or at least not anything that I could use in ADA_PROJECT_PATH

If you installed gprbuild from source, then in the gprbuild directory, there is a directory called gpr , just cd into it & run gprbuild/gprinstall etc.

tkacvins commented 8 months ago

OK, so I ran gprbuild and gprinstall in the gprbuild repo's gpr subdirectory and set ADA_PROJECT_PATH to include the install location of gpr.gpr. Now I get this

gprbuild -p -m --target=x86_64-linux  -j0 -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD   -XLIBRARY_TYPE=static -XXMLADA_BUILD=static -XGPR_BUILD=static  -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD gnatcoll.gpr -v

==============Messages for file: /home/BUILD64/bin/gprbuild/share/gpr/gpr.gpr

    11.    BUILD : BUILD_KIND := external("GPR_BUILD", "default");

        >>> value "static" is illegal for typed string "build"

gprbuild: "gnatcoll.gpr" processing failed

Something is not quite right with this but I am out ideas as to where to look

bib1963 commented 8 months ago

OK, so I ran gprbuild and gprinstall in the gprbuild repo's gpr subdirectory and set ADA_PROJECT_PATH to include the install location of gpr.gpr. Now I get this

gprbuild -p -m --target=x86_64-linux  -j0 -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD   -XLIBRARY_TYPE=static -XXMLADA_BUILD=static -XGPR_BUILD=static  -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD gnatcoll.gpr -v

==============Messages for file: /home/BUILD64/bin/gprbuild/share/gpr/gpr.gpr

    11.    BUILD : BUILD_KIND := external("GPR_BUILD", "default");

        >>> value "static" is illegal for typed string "build"

gprbuild: "gnatcoll.gpr" processing failed

Something is not quite right with this but I am out ideas as to where to look

Ugh, sorry, gave wrong info. From the top level Makefile, it says to run make libgpr.build & make libgpr.install. That will build the 3 types of libs, relocatable, static & static-pic. Yup, really not well documented.

tkacvins commented 8 months ago

Ah, thank you very much. That did the trick!

bib1963 commented 8 months ago

Ah, thank you very much. That did the trick!

Horrible.... isn't it....

t-14 commented 8 months ago

FWIW, we've just added a line in the gprbuild project readme mentioning the right make targets.

bib1963 commented 8 months ago

FWIW, we've just added a line in the gprbuild project readme mentioning the right make targets.

Since that component is required and non-optional, when someone runs make, then gpr should also be automatically be built. It should not be a separate process step. The same goes with installing it.

t-14 commented 8 months ago

This statement is manifestly wrong, this component is perfectly optional and is in fact unused if all one needs to build is the executables; and it's as intended (and if you think about it can't be otherwise, given you need gprbuild to build this component, and it might not exist before you build it... chicken and egg, aka bootstrapping...)

bib1963 commented 8 months ago

This statement is manifestly wrong, this component is perfectly optional and is in fact unused if all one needs to build is the executables; and it's as intended (and if you think about it can't be otherwise, given you need gprbuild to build this component, and it might not exist before you build it... chicken and egg, aka bootstrapping...)

And yet, I've never been able to get a runnable system without it being installed due to so much additional components requiring it.

t-14 commented 8 months ago

As far as gnatcoll-core is concerned, this dependency is no longer required unless one wants to build gnatcoll.projects. Generally speaking, libgpr is being phased out in favor of https://github.com/AdaCore/gpr so dependency on it will probably decrease over time.