alire-project / alire

Command-line tool from the Alire project and supporting library
GNU General Public License v3.0
278 stars 49 forks source link

build ada_language_server 23 fails with errors about things compiled with different gnat versions #1234

Closed stephe-ada-guru closed 6 months ago

stephe-ada-guru commented 1 year ago

$ alr get ada_language_server=23 ⓘ Deploying ada_language_server=23.0.0... -=#=- # # #
... [bind SAL] langkit_support error: "a-stteou.ali" not found, "a-stteou.ads" must be compiled error: "a-stteou.ali" not found, "a-stteou.ads" must be compiled error: "s-valenu.ali" not found, "s-valenu.adb" must be compiled error: "a-stteou.ali" not found, "a-stteou.ads" must be compiled error: "a-stteou.ali" not found, "a-stteou.ads" must be compiled error: "a-stteou.ali" not found, "a-stteou.ads" must be compiled error: "a-stteou.ali" not found, "a-stteou.ads" must be compiled error: "a-stteou.ali" not found, "a-stteou.ads" must be compiled error: "a-stteou.ali" not found, "a-stteou.ads" must be compiled error: "a-stteou.ali" not found, "a-stteou.ads" must be compiled error: "s-stalib.adb" and "langkit_support-adalog-debug.adb" compiled with different GNAT versions, v12 and v11 ...

Looking in ada_language_server_23.0.0_66f2e7fb/alire/cache/dependencies/langkit_support_23.0.0_d934b966/obj/dev/*.ali, the first line is:

V "GNAT Lib v11"

So this was compiled (or at least linked?) by gnat 11.

The default toolchain is gnat 12: $ alr toolchain CRATE VERSION STATUS NOTES
gprbuild 21.0.2 Available
gprbuild 22.0.1 Available
gprbuild 2022.0.0 Available Provided by system package: gprbuild gnat_native 11.2.3 Available
gnat_native 12.1.2 Available
gnat_native 12.2.1 Default
gnat_external 11.3.0 Available Detected at /usr/bin/gnat

Earlier in the log is: COLLECT_GCC=/usr/bin/gcc-11

So perhaps it's just the linker that is from gnat 11?

Alire should ensure that a consistent toolchain is used for the entire build.

stephe-ada-guru commented 1 year ago

I left out the build command, after 'alr get':

alr build --development

stephe-ada-guru commented 1 year ago

I tried deleting the system gcc (via aptitude remove). Now alr toolchaing gives me: stephe@shevek:/Projects/alire-workspace$ alr toolchain CRATE VERSION STATUS NOTES
gprbuild 21.0.2 Available
gprbuild 22.0.1 Available
gprbuild 2022.0.0 Available Provided by system package: gprbuild gnat_native 11.2.3 Available
gnat_native 12.1.2 Available
gnat_native 12.2.1 Default

And alr get: stephe@shevek:/Projects/alire-workspace$ alr get ada_language_server=23 ⓘ Deploying ada_language_server=23.0.0... -=O=- # # # #
ⓘ Deploying libgmp=6.2.1... ⓘ Deploying vss=23.0.0... -=#=- # # #
ⓘ Deploying xmlada=23.0.0... -=#=- # # #
ⓘ Running post_fetch actions for xmlada=23.0.0... checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking whether gnat can build shared libs... no checking for a BSD-compatible install... /usr/bin/install -c checking whether ln -s works... yes configure: creating ./config.status config.status: creating xmlada_shared.gpr config.status: creating Makefile config.status: creating tests/dom/default.gpr ⓘ Deploying libgpr=23.0.0... -=#=- # # #
ⓘ Deploying markdown=23.0.0... -#O=# # #
ⓘ Deploying templates_parser=23.0.0... -=#=- # # #
ⓘ Running post_fetch actions for templates_parser=23.0.0... ⓘ Deploying gnatcoll=23.0.0... -=#=- # # #
ⓘ Deploying gnatcoll_gmp=23.0.0... -=#=- # # #
ⓘ Deploying gnatcoll_iconv=23.0.0... -#O=# # #
ⓘ Deploying langkit_support=23.0.0... ################################################################################################################# 100.0% ⓘ Deploying libadalang=23.0.0... ################################################################################################################# 100.0% ⓘ Deploying libadalang_tools=23.0.0... -=#=- # # #
ⓘ Running post_fetch actions for libadalang_tools=23.0.0... ⓘ Deploying libgnatdoc=23.0.0... -#O=# # #
ⓘ Running post_fetch actions for ada_language_server=23.0.0...

ada_language_server=23.0.0 successfully retrieved. Dependencies were solved as follows:

+♼ gnat 12.2.1 (new,installed,gnat_native,indirect)

And finally build: stephe@shevek:/Projects/alire-workspace$ cd ada_language_server_23.0.0_66f2e7fb/ stephe@shevek:/Projects/alire-workspace/ada_language_server_23.0.0_66f2e7fb$ alr build --development ⓘ Building libadalang_tools/src/lal_tools.gpr (1/2)... gprconfig: can't find a native toolchain for language 'ada' gprconfig: can't find a native toolchain for language 'ada' Setup [mkdir] object directory for project XmlAda_Sax [mkdir] library directory for project XmlAda_Sax [mkdir] object directory for project XmlAda_Schema [mkdir] object directory for project GPR [mkdir] library directory for project GPR [mkdir] object directory for project GnatColl [mkdir] library directory for project GnatColl [mkdir] object directory for project GnatColl_GMP [mkdir] library directory for project GnatColl_GMP [mkdir] object directory for project GnatColl_Iconv [mkdir] library directory for project GnatColl_Iconv [mkdir] object directory for project Langkit_Support [mkdir] library directory for project Langkit_Support [mkdir] object directory for project Libadalang [mkdir] library directory for project Libadalang [mkdir] object directory for project Templates_Parser [mkdir] library directory for project Templates_Parser [mkdir] object directory for project LAL_Tools [mkdir] library directory for project LAL_Tools lal_tools.gpr:5:17: warning: there are no sources of language "C" in this project xmlada_unicode.gpr:26:09: warning: there are no sources of language "C" in this project xmlada_sax.gpr:28:09: warning: there are no sources of language "C" in this project xmlada_input.gpr:27:09: warning: there are no sources of language "C" in this project xmlada_dom.gpr:28:09: warning: there are no sources of language "C" in this project xmlada_schema.gpr:29:09: warning: there are no sources of language "C" in this project templates_parser.gpr:22:17: warning: there are no sources of language "C" in this project langkit_support.gpr:5:17: no compiler for language "Ada", cannot compile "langkit_support-file_readers.adb" gprbuild: *** compilation phase failed error: Command ["gprbuild", "-s", "-j0", "-p", "-P", "/Projects/alire-workspace/ada_language_server_23.0.0_66f2e7fb/alire/cache/dependencies/libadalang_tools_23.0.0_75f92679/src/lal_tools.gpr"] exited with code 4 error: Compilation failed.

say what!?

stephe-ada-guru commented 1 year ago

I found a workaround: put the gnat installed by Alire in PATH :

export PATH=/home/stephe/.config/alire/cache/dependencies/gnat_native_12.1.2_66b989b5/bin:$PATH

Then 'alr build' succeeds

mosteo commented 1 year ago

This points at the environment not being properly set for the execution of the action. Thanks for the digging.

Fabien-Chouteau commented 6 months ago

Given the various problems reported I don't the problem directly comes from Alire in this case. Without more details I suggest closing this issue.

mosteo commented 6 months ago

Indeed, I cannot reproduce with 1.2.2 and many things have changed in 2.0. Feel free to reopen if the problem persist in 2.0.