AdaCore / ada_language_server

Server implementing the Microsoft Language Protocol for Ada and SPARK
GNU General Public License v3.0
226 stars 54 forks source link

Building ALS via Alire on aarch64-apple-darwin #1190

Open simonjwright opened 3 months ago

simonjwright commented 3 months ago

The first problem arises because ALS’s ALire dependency on libadalang_tools is to ^23.0.0, with which this occurs:

   [Ada]          tagada_marshalling_lib.adb
tagada_marshalling_lib.adb:633:19: warning: types for unchecked conversion have different sizes [-gnatwz]
tagada_marshalling_lib.adb:738:19: warning: types for unchecked conversion have different sizes [-gnatwz]

   compilation of tagada_marshalling_lib.adb failed

The failing code is

                  function To_Bits is new Ada.Unchecked_Conversion
                    (Source => Long_Long_Float, Target => Unsigned_128);

(in the second case, From_Bits). On aarch64, Long_Long_Float is only 64 bits.

The "fix" (that at least doesn’t use -gnatwe, & so gets a build) is to alter lal_tools_common.gpr so that the default for Build_Mode is prod.


The second problem (may not be a problem?) is this:

Running post-fetch actions for ada_language_server=23.0.0...
sed: 1: "gnat/lsp_server.gpr": extra characters at the end of g command
error: Command ["sed", "-i", "-e/gpr2/s/^/--  /", "gnat/lsp_server.gpr"] exited with code 1
simonjwright commented 3 months ago
error: Command ["sed", "-i", "-e/gpr2/s/^/--  /", "gnat/lsp_server.gpr"] exited with code 1

This stopped the build.

I wondered whether it was the two spaces in "-e/gpr2/s/^/-- /" - this has caused trouble with Alire in the past - but the only solution I could see was to do the edit by hand.

Now I have a build!

cdouty commented 3 months ago

The sed command in the alire.toml post-fetch action expects to see GNU sed, while macOS has a BSD version. I have a patch that also makes the sed command idempotent. I will upload it when I figure out how to make a PR. Should it go here or the crate?

reznikmm commented 2 months ago

Replacing "sed", "-i" with "sed", "-i.bak" should fix the issue. I hope we will have 24.0.0 in alire eventually.