AdaCore / gnatstudio

GNAT Studio is a powerful and lightweight IDE for Ada and SPARK.
399 stars 52 forks source link

Please provide more detailed build instructions #95

Open caloo opened 4 years ago

caloo commented 4 years ago

Hello, I'm trying to build GNAT Studio on Ubuntu 19.10 and it seems like different dependencies are split into several repositories which themselves are not always trivial to compile. E. g. gps needs gnatcoll_db2ada, which seems to require gnatcoll_sql/gnatcoll_sqlite which requires gnatcoll_core and somewhere in between I had to build/get gnatcoll-bindings-python, ada_language_server, libadalang. Besides that I received missing dependency errors (lal_tools).

Would it be possible to give more build instructions on a clean Linux distribution to build all dependencies and finally GNAT Studio?

Best regards caloo

steve-cs commented 4 years ago

The good news is that building the development version (and/or 19.2) of gps is relatively straight forward under Ubuntu 19.10. The bad news is that as you've found out it is not documented and is not trivial. You'd likely find it much easier starting with the AdaCore Gnat Community Edition 2019. But if you insist on starting from a clean Ubuntu installation and use only Ubuntu binaries and Adacore source, then the path in general is as follows.

Build and install the following programs/libraries/modules in the following order following the instructions in each README and/or build instructions for each:

  1. gcc (c, c++, ada)
  2. gprbuild-bootstrap
  3. xmlada
  4. gprbuild
  5. gnatcoll-core
  6. gnatcoll-bindings
  7. gnatcoll-sql
  8. gnatcoll-gnatcoll_db2ada
  9. gnatcoll-sqlite
  10. gnatcoll-xref
  11. gnatcoll-gnatinspect
  12. libadalang (stable branch)
  13. gtkada
  14. gps
  15. spark2014 (fsf branch)

A few are not strictly needed. I'd recommend avoiding use of any of the ada related binaries from Ubuntu (with the exception of gnat-9 to build a new gcc compiler) as you will run into version related problems. Building the gnatcoll-db submodules in the order above will avoid the dependency problems you are fighting above. You will also have to add libadalang-tools and ada_language_server source to gps source before building gps. spark2014 is still dependent on compiler source so you'll gave to extract it from gcc source and add it to spark2014 source before building it. spark2014 (e.g. gnatprove and friends) is not strictly required for gps so you can skip that if you want.

You will of course need to add a significant number of Ubuntu packages to resolve some non ada specific dependencies beyond the default desktop install.

If you post more specific questions, I likely can provide more detailed more specific answers.

Summary: it really is much simpler to just use the community edition binaries unless you've got a good reason.

caloo commented 4 years ago

Thanks for your answer. Today I tried it again (master and 20.2 branches) and it started to make problems when doing make in gprbuild:

user@host: make
./gprbuild -p -m   -j0 -XBUILD=production  gprbuild.gpr -XLIBRARY_TYPE=static -XXMLADA_BUILD=static
shared.gpr:35:04: value "production" is illegal for typed string "mode"
gprbuild: "gprbuild.gpr" processing failed
make: *** [Makefile:95: build] Fehler 4

It looks like that the BUILD strings are not aligned. shared.gpr expects "Production" while gpr.gpr expects "production". I have also seen project file which are expecting "PROD":

user@host: make BUILD=production
./gprbuild -p -m   -j0 -XBUILD=production  gprbuild.gpr -XLIBRARY_TYPE=static -XXMLADA_BUILD=static
shared.gpr:35:04: value "production" is illegal for typed string "mode"
gprbuild: "gprbuild.gpr" processing failed
make: *** [Makefile:95: build] Fehler 4

Best regards caloo

Edit: The reason why I don't want to use the community version is to test the latest GNAT Studio version to give feedback on the current project status without risking to give feedback on already resolved issues.

steve-cs commented 4 years ago

Have you first built and installed a gcc compiler, done a gprbuild bootstrap, then built and installed xmlada with the bootstrapped gprbuild before trying to build a real gprbuild?

I suspect that you may have started with step 4 from my list above rather than step 1. Trying to build gprbuild with the versions of xmlada, gpr, gprbuild that are delivered with Ubuntu often (always?) throw up these kind of compatibility issues.

Directions for the initial bootstrap and the final configure, build, and install of gprbuild are in the grpbuild README: https://github.com/AdaCore/gprbuild

caloo commented 4 years ago

Yes, I just verified it again by deleting gprbuild, cleaning the directories and adding the bootstrapping-gprbuild to the PATH variable.

I also had to add the XML directory to the GPR project path to succeed: GPR_PROJECT_PATH=../xmlada make all

Still receiving this: shared.gpr:35:04: value "production" is illegal for typed string "mode"

I've already progressed this step before by editing the gpr files but ran into other problems which I've already forgotten (afair gnatcoll-core related). I just thought there must be another clean way to build GNAT Studio without editing source and project files.

Best regards caloo

steve-cs commented 4 years ago

It shouldn't be needed to edit sources or project files to build on Ubuntu 19.10. Unless I've made some mistake the following should build and install gcc, gprbuild-bootstrap, xmlada, and gprbuild in /usr/local; i.e. the first four steps above. If you compare this with what you are doing you might be able to find your issue.

git clone --depth=1 \
https://github.com/gcc-mirror/gcc -b master gcc-src
mkdir -p gcc-build
cd gcc-src && ./contrib/download_prerequisites && cd ..
cd gcc-build && ../gcc-src/configure \
    --prefix=/usr/local \
    --host=x86_64-linux-gnu --build=x86_64-linux-gnu --target=x86_64-linux-gnu \
    --enable-languages=c,c++,ada \
     && cd ..
make -C gcc-build -j4
sudo make -C gcc-build install

git clone --depth=1 \
https://github.com/adacore/gprbuild -b master gprbuild-src
git clone --depth=1 \
https://github.com/adacore/xmlada -b master xmlada-src
mkdir -p gprbuild-bootstrap-build
cp -a gprbuild-src/* gprbuild-bootstrap-build
cd gprbuild-bootstrap-build && sudo bash bootstrap.sh \
    --with-xmlada=../xmlada-src --prefix=/usr/local \
    && cd ..

mkdir -p xmlada-build
cp -a xmlada-src/* xmlada-build
cd xmlada-build && ./configure --prefix=/usr/local && cd ..
make -C xmlada-build all
sudo make -C xmlada-build install

mkdir -p gprbuild-build
cp -a gprbuild-src/* gprbuild-build
make -C gprbuild-build prefix=/usr/local  setup
make -C gprbuild-build all
make -C gprbuild-build libgpr.build
sudo make -C gprbuild-build install
sudo make -C gprbuild-build libgpr.install
rogermc2 commented 5 months ago

Gprbuild can now be built using alire alr get --build gprbuild