Usinging alire installs outside of alire?

Hi!
I have a largish system running today on intel Linux and Windows.
It has a history of running on Vax_VMS and AIX as well, but well,
there is not much interest in those platforms anymore.

So I want to run it on a Raspberry pi.
It is database heavy, and we support Oracle and sql-server.
Until recently, neither Oracle nor Microsoft released
any drivers for ARM. But now Microsoft has released
ODBC drivers for Linux on ARM Linux.

So, port it should be easy. However
Needing AWS turned difficult.
Ubuntu 22.04 has no matching packages.
You can’t use AWS with the compiler they are shipping.

OK, so I compiled it, but depends on xml/ada.
Fine, cloned that and build/installed OK.
AWS depends on gnatcoll as well, and that I
have not yet managed to install.

So - tried the alire thing.
did not work. Started well, I made a very simple webserver
and said alire run. Broke when it wanted some x64 code. (not aarm64)
Simon Wright spotted something for Mac on Arm

alr build -- -XTARGET=$(gcc -dumpmachine)

and that went well. I now got a simple web server working on the pi.
Alire did all the heavy lifting. Nice.

However, is there a way for me to use what alire built - outside of the Alire world?

the code/build system is not adapted to alire and I am not sure it ever will be.
Still, the libraries and the specs and the gpr-files are there.

A first attempt to include AWS and Xml/ada gpr file directories into ADA_PROJECT_PATH
failed, and I’m not sure to use release or build parts.
AWS seems OK in release, but I’m not so sure with Xml/ada.
But - it does not work with AWS out-of-the-box either.

I’m getting errors like

zlib.gpr:19:06: imported project file "../../.build/projects/aws_config" not found
zlib.gpr:19:06: imported by "/home/sattmate/.cache/alire/releases/aws_23.0.0_6c406859/include/zlib/zlib.gpr"
zlib.gpr:19:06: imported by "/home/sattmate/.cache/alire/releases/aws_23.0.0_6c406859/aws.gpr"
zlib.gpr:19:06: imported by "/usr2/wcs/test/config/gpr/global.gpr"
zlib.gpr:19:06: imported by "/usr2/wcs/test/config/gpr/utility.gpr"
zlib.gpr:41:10: warning: no when others for this case construction
zlib.gpr:41:15: unknown package or project "Aws_Config"
zlib.gpr:41:15: variable "zlib_exists" is not a single string
gprbuild: "utility" processing failed

where utility and global are my gprs, global ‘withs’ aws.

So, the question is - is it just a bad idea or do I miss something obvious?
The ADA_PROJECT_PATH looks like

bnl@pi4:/usr2/wcs/test/source/kernel/global$ echo $ADA_PROJECT_PATH
/home/bnl/.cache/alire/releases/aws_23.0.0_6c406859/.build/projects:
/home/bnl/.cache/alire/releases/aws_23.0.0_6c406859/src:
/home/bnl/.cache/alire/releases/aws_23.0.0_6c406859/win32:
/home/bnl/.cache/alire/releases/aws_23.0.0_6c406859/include/zlib:
/home/bnl/.cache/alire/releases/aws_23.0.0_6c406859/tools:
/home/bnl/.cache/alire/releases/aws_23.0.0_6c406859/.:
/home/bnl/.cache/alire/releases/aws_23.0.0_6c406859/config:
/home/bnl/.cache/alire/releases/aws_23.0.0_6c406859/gps:
/home/bnl/.cache/alire/releases/aws_23.0.0_6c406859/templates_parser/tools:
/home/bnl/.cache/alire/releases/aws_23.0.0_6c406859/workspace:
/home/bnl/.cache/alire/releases/aws_23.0.0_6c406859/ssl:
/home/bnl/.cache/alire/builds/xmlada_23.0.0_70494123_13e2c9565dacb905afb4058b9ce2e43e42e188f1cce6c3b3ea721ce397330120/input_sources:
/home/bnl/.cache/alire/builds/xmlada_23.0.0_70494123_13e2c9565dacb905afb4058b9ce2e43e42e188f1cce6c3b3ea721ce397330120/schema:
/home/bnl/.cache/alire/builds/xmlada_23.0.0_70494123_13e2c9565dacb905afb4058b9ce2e43e42e188f1cce6c3b3ea721ce397330120/unicode:
/home/bnl/.cache/alire/builds/xmlada_23.0.0_70494123_13e2c9565dacb905afb4058b9ce2e43e42e188f1cce6c3b3ea721ce397330120/unicode/importer:
/home/bnl/.cache/alire/builds/xmlada_23.0.0_70494123_13e2c9565dacb905afb4058b9ce2e43e42e188f1cce6c3b3ea721ce397330120/sax:
/home/bnl/.cache/alire/builds/xmlada_23.0.0_70494123_13e2c9565dacb905afb4058b9ce2e43e42e188f1cce6c3b3ea721ce397330120/dom:
/home/bnl/.cache/alire/builds/xmlada_23.0.0_70494123_13e2c9565dacb905afb4058b9ce2e43e42e188f1cce6c3b3ea721ce397330120/docs/cross/dom:
/home/bnl/.cache/alire/builds/xmlada_23.0.0_70494123_13e2c9565dacb905afb4058b9ce2e43e42e188f1cce6c3b3ea721ce397330120/.:
/home/bnl/.cache/alire/builds/xmlada_23.0.0_70494123_13e2c9565dacb905afb4058b9ce2e43e42e188f1cce6c3b3ea721ce397330120/distrib:
/home/bnl/.cache/alire/builds/gnatcoll_23.0.0_29478a20_453f144aacfff5ce0aa306e1d4e7fc20016efff2eb51388716e274cc0b19328c/.:
/usr2/wcs/test/config/gpr:
/usr2/wcs/test/config/gpr/unix

/Björn

1 Like

Same problem for me when building AWS, it never builds out of the box and the gnatcoll dependency has made the build even more complex. This is very sad because you now drag in your web server the GNAT project library due to gnatcoll (when compiling with shared libraries). All this stuff due to a single dependency to GNATCOLL.Refcount.

For the Alire stuff, I would suggest to try:

alr printenv

and pick the export GPR_PROJECT_PATH= to build your project (somehow).

Another way is to try building your project as before but through alr exec, this way you will get the environment variables and the configuration created by Alire.

Thanks for the ideas.
Did not workout with a quick test though, the alr printenv gave me same errors
as when picked them by hand, and running alr exec on my build system
barked at there was no x86_64 dir

bnl@pi4:~/alr_test/myproj$ alr exec /usr2/wcs/test/config/gpr/generate.bash
ⓘ Deploying make=4.3.0...                        
ⓘ Deploying openssl=3.0.2...
operating_system = Linux
2023-12-31 12:55:07 - Jenkins = 0
2023-12-31 12:55:07 - /usr2/wcs/test/config/gpr/generate.bash started
2023-12-31 12:55:07 - Generate the configuration project files
12.3.0
2023-12-31 12:55:07 - Build libraries
2023-12-31 12:55:09 - Generate code
src.gpr:39:37: "../.build/x86_64-pc-linux-gnu/setup/src" is not a valid directory
gprbuild: "utility" processing failed
error: Command ["/usr2/wcs/test/config/gpr/generate.bash"] exited with code 4

Ah, right, perhaps I need to tell it that I’m on an rpi

sattmate@pi4:~/alr_test/myproj$ alr exec -- -XTARGET=$(gcc -dumpmachine) /usr2/wcs/test/config/gpr/generate.bash
ⓘ Deploying make=4.3.0...                        
ⓘ Deploying openssl=3.0.2...
error: Command ["-XTARGET=aarch64-linux-gnu", "/usr2/wcs/test/config/gpr/generate.bash"] exited with code 1

But I’ll dig deeper into it next year, and poke around.

So, next is to install gnatcoll-core without alire. I created an issue at gnatcoll-core on github, however I see someone else had the same issue in October, but still no reply.
So, I’ll paste it here and hope that someone else has the solution.

bnl@pi4:~/git$  git clone --recursive https://github.com/AdaCore/gnatcoll-core.git
Cloning into 'gnatcoll-core'...
remote: Enumerating objects: 21358, done.
remote: Counting objects: 100% (1950/1950), done.
remote: Compressing objects: 100% (739/739), done.
remote: Total 21358 (delta 1215), reused 1863 (delta 1174), pack-reused 19408
Receiving objects: 100% (21358/21358), 7.58 MiB | 4.50 MiB/s, done.
Resolving deltas: 100% (15509/15509), done.

bnl@pi4:~/git$ cd gnatcoll-core/

bnl@pi4:~/git/gnatcoll-core$ make prefix=/usr2/wcs/tools/gnat/12.3.0/gnatcoll install
gprinstall -p -f --target=aarch64-linux-gnu -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_PROJECTS=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD  --sources-subdir=include/gnatcoll --prefix=/usr2/wcs/tools/gnat/12.3.0/gnatcoll -XLIBRARY_TYPE=static -XXMLADA_BUILD=static -XGPR_BUILD=static \
	--build-name=static -XGNATCOLL_MMAP=yes -XGNATCOLL_MADVISE=yes -XGNATCOLL_PROJECTS=yes -XGNATCOLL_VERSION=0.0 -XGNATCOLL_OS=unix -XBUILD=PROD \
	--build-var=LIBRARY_TYPE --build-var=GNATCOLL_BUILD \
	--build-var=GNATCOLL_CORE_BUILD gnatcoll.gpr
gnatcoll.gpr:24:06: imported project file "gpr" not found
gprinstall: "gnatcoll.gpr" processing failed
make: *** [Makefile:191: install-static] Error 4

I wonder where that gpr.gpr is supposed to be.

Happy new year to you all

/Björn

That’s the GNAT gpr library I was talking about. It is another nightmare to build it.
You’ll find it in GitHub - AdaCore/gprbuild: GPRbuild is an advanced build system designed to help automate the construction of multi-language systems.

gprbuild provides the binary of the same name but also a library gpr (or libgpr) which allows to parse and read the GNAT project file.

I didn’t realized you were cross-compiling, this brings another degree of complexity to build AWS, gnatcoll and gprbuild.

Long time ago, I was directly compiling my Ada programs on a Beaglebone black board which is very similar to the Rasperry Pi. I was using NFS so that the ARM board does not need to store files. Compilation was a little bit longer but it was easier to setup than a cross-compilation.

Ah, ok, I’ll try install that first. Hmm, it was not clear that gprbuild was a dependency (to me anyway)
Thanks.
No - It is not a cross-compile, I build on the rpi. But alire seems to NOT understand anything else than x86. Hence the explicit target. I had to add that to alr run, and then it build natively on the pi, it barks of x86 without it there as well.
/Björn

It looks like a bug in Alire then.

Alire runs the command uname -m to find the target architecture.
If you run alr -v o alr -d you might have some message that tells you uname unknown machine or something similar I guess.

One option that might work is to use Alire 2.0.0-beta and its alr install command. Take a look at alire/doc/user-changes.md at release/2.0 · alire-project/alire · GitHub

bnl@pi4:~$ uname -m
aarch64

all -v and alr-d doe not give anything like unknown, just

bnl@pi4:~$ alr -d
alr 2.0-dev+beta2

at the top

Simon Wright reported it as a bug for macOS, but I can’t find it now.

Seems like I use that already. I’ll have a look next year.
Thanks

ok, I got it to work by installing

  • xmlada
  • gprbuild
  • gnatcoll-core
    and then AWS, updating ADA_PROJECT_PATH as I installed more libs.
    The real trick was that
    make install
    in gprbuild does not install the libraries.
    The makefile says there are more targets for that
  • libgrbuild.build
  • libgrpbuild.install

I got that from an issue I opened.
Vasily Fofanov kindly enlightened me of that fact, and will make sure the README.md also states that.

So in the end, I did not make it with Alire but with installing manually.

2 Likes

I suspect that AWS’s alire.toml should include a dependency on libgpr !

(later) Turns out that AWS depends on gnatcoll, which does depend on libgpr.

1 Like