stcarrez / ada-util

Ada Utility Library - Composing streams, processes, logs, serialization, encoders and more
Apache License 2.0
69 stars 14 forks source link

aws-client-ext__2.adb fails to compile #29

Closed rogermc2 closed 2 years ago

rogermc2 commented 2 years ago

Mac OSX 10.13.6 Xcode 10.1 These are the latest OS versions that can be installed on my MacBook Air. As I am getting messages when trying to build one of my projects that ada-utils sources were compiled with a different compiler version to my project files, I tried to rebuild ada-utils with ./configure make but the build failed at:

gprbuild -m -q -p -Putilada_aws.gpr -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=4 -XUTIL_LIBRARY_TYPE=static
aws-client-ext__2.adb:37:09: warning: unit "AWS.Utils" is not referenced [-gnatwu]
aws-client-ext__2.adb:239:23: error: "Open_Set_Common_Header" not declared in "HTTP_Utils"
aws-client-ext__2.adb:245:26: error: "Set_Header" not declared in "HTTP_Utils"
aws-client-ext__2.adb:252:49: error: no selector "F_Headers" for type "HTTP_Connection" defined at aws-client.ads:604
aws-client-ext.ads:33:06: warning: unnecessary with of ancestor [-gnatwr]

   compilation of aws-client-ext__2.adb failed

I also tried gprbuild -aP.alire -Putilada_aws -p which produced the same errors.

I have previously used ada-utils successfully but recently installed a new gcc complier (gcc-12.1.0)

stcarrez commented 2 years ago

Which version of AWS are you using?

It seems either that AWS version is not detected correctly, or, you are using some recent AWS version and the implementation must be updated.

rogermc2 commented 2 years ago

I reinstalled both AWS and ada-utils but the problem remains. According to its 'readme' file AWS version is

A W S - Ada Web Server
20.0 release

I checked aws-client-http_utils.ads; it definitely declares:

procedure Open_Set_Common_Header
     (Connection : in out HTTP_Connection;
      Method     : String;
      URI        : String;
      Headers    : Header_List := Empty_Header_List);
rogermc2 commented 2 years ago

Fixed by changing gcc to: `gcc version 8.4.1 20200430 (for GNAT Community 2020 20200818) (GCC) '

Problem occurs with gnat-ce-2021 and gcc-12.1.0

Any suggestions as to finding out why?

However, I am now stuck with build failure messages: compiled with different GNAT versions, v2020 and v12 So far no success fixing this.

stcarrez commented 2 years ago

Thanks for the information.

There is something strange with your AWS installation and it's hard to tell what is wrong. Ada Util has 3 different setup to build the support for AWS. This is necessary to support several versions of AWS. I suspect you are trying to build with implementation version 3 but it is not compatible and your AWS is probably compatible with implementation version 2.

I'm build Ada Util on FreeBSD with gcc 12.1 and the latest AWS version from git. According to the error, it looks like the configure script detected the wrong AWS version.

I'm also building for MacOS but with some older gcc and AWS.

With your original compiler setup (GCC 12), may be you can try the following:

make -n GPRFLAGS=-XUTIL_AWS_IMPL=2

You can have a look at the default implementation version by looking at the AWS_Impl variable in the utilada_conf.gpr project file.

rogermc2 commented 2 years ago

Thanks, I've reverted to gcc-12.1.0.

rogermc2 commented 2 years ago

After a lot of messing about, ada-utils now builds and installs OK. I think what fixed it was to make sure gnatcoll that comes with gcc-12.1.0 is used. However, I still have other issues involved with building projects such as

utilada_http.gpr:1:06: imported project file "utilada_sys" not found
rogermc2 commented 2 years ago

Indications are that I am not installing ada-utils properly as indicated by, for example:

utilada_aws.gpr:21:31: "../../include/utilada_aws.static" is not a valid directory
utilada_aws.gpr:22:30: library directory "/usr/local/lib/utilada_aws.static/" does not exist

Any advice greatly appreciated. Thanks, Roger

stcarrez commented 2 years ago

After a lot of messing about, ada-utils now builds and installs OK. I think what fixed it was to make sure gnatcoll that comes with gcc-12.1.0 is used. However, I still have other issues involved with building projects such as

utilada_http.gpr:1:06: imported project file "utilada_sys" not found

Yes, some versions of AWS depend on gnatcoll.

It looks like the GNAT project files are not installed correctly. This may have to do with the gprinstall that you are using.

Indications are that I am not installing ada-utils properly as indicated by, for example:

utilada_aws.gpr:21:31: "../../include/utilada_aws.static" is not a valid directory
utilada_aws.gpr:22:30: library directory "/usr/local/lib/utilada_aws.static/" does not exist

Any advice greatly appreciated. Thanks, Roger

Can you check that your AWS installed version is provided with static libraries?

It looks like the static version of utilada_aws was not installed, and this happens if AWS is not available with static libraries.

Can you try to build with -XUTILADA_AWS_BUILD=relocatable?

rogermc2 commented 2 years ago
which gprbuild
/opt/gcc-12.1.0/bin/gprbuild
gprbuild --version
GPRBUILD 22.0 (20220312) (x86_64-apple-darwin15)

Can you check that your AWS installed version is provided with static libraries?

/opt/gcc-12.1.0/lib/aws.static

I'm wondering if aws should be installed in /usr/local? A problem seems to be that while all of the ada-util static libraries have been generated in ada-util/lib, none of them seem to have been installed.

stcarrez commented 2 years ago

This could explain your problem. You can try two different things:

  1. setup the ADA_PROJECT_PATH environment variable and check if it solves your problem. I suspect you may try to set it to point to /usr/local/share/gpr.
  2. configure Ada Util by using --prefix=/opt/gcc-12.1.0, then build and install again (no need to clean, a re-configure, followed by a build and install should work)

I'm not sure for the 1) but trying does not bless.

rogermc2 commented 2 years ago

Thanks for your help. ADA_PROJECT_PATH was already set to /usr/local/share/gpr. I've added /opt/gcc-12.1.0/share/gpr to it. I rebuilt Ada Util per your advice. The Ada Util static libraries are being installed in /opt/gcc-12.1.0/lib. However I need them to be in /usr/local/lib for consistency with my other computer with which I share my projects via git. This also applies to the include files which need to be in /usr/local/include I am also still getting

utilada_aws.gpr:21:31: "../../include/utilada_aws.static" is not a valid directory

but ada-utils does not seem to have a utilada_aws directory.

stcarrez commented 2 years ago

May be the utilada_aws.gpr project comes from a past installation but the new build failed?

Can you check the file Makefile.conf and check the HAVE_AWS variable? You should have:

HAVE_AWS=yes
rogermc2 commented 2 years ago

Thanks:

HAVE_XML_ADA=yes
HAVE_CURL=yes
HAVE_AWS=no
HAVE_LZMA=no
HAVE_PANDOC=
HAVE_DYNAMO=
HAVE_UTILGEN=no

Rebuilt AWS When I run ada-utils, ./ configure I get

checking whether aws project exists... no

I'll have a go at fixing that. aws put aws.gpr into /opt/gcc-12.1.0/share/gpr so I copied it into usr/local/share/gpr. It replaced an older version in usr/local/share/gpr. ./configure then produced 'checking AWS support is enabled... yes`

rogermc2 commented 2 years ago

Still too many problems so abandoning gcc-12.1.0 and reverting to previous system. Thanks for your assistance.