bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66017: Cannot install Ada mode


From: Stephen Leake
Subject: bug#66017: Cannot install Ada mode
Date: Thu, 28 Sep 2023 10:25:25 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (windows-nt)

Left Right <olegsivokon@gmail.com> writes:

>> Run "alr toolchain", select the internal Ada compiler.
>
> Only the external compiler had ever been installed. If I run (I never
> ran this before):
>
> ❯ alr toolchain
> CRATE         VERSION STATUS  NOTES
> gnat_external 13.2.1  Default Detected at /usr/bin/gnat
>
> This is what I get.
>
> Here's what I did afterwards:
>
> 1. Installed "gnat_native".
> 2. Ran `alr toolchain --select` and interactively selected a version
> of "gnat_native" and "gprbuild" so that it looks like this:
>
> ❯ alr toolchain
> CRATE         VERSION STATUS    NOTES
> gprbuild      22.0.1  Default
> gnat_native   13.1.0  Default
> gnat_external 13.2.1  Available Detected at /usr/bin/gnat

Ok.

Apparently the version of gnat in alr has been updated since my last
release.

I've updated my Alire index, and have now reproduced this error.

If the --select list has gnat 12, selecting that would be the simplest
workaround. You can change it back to external or internal 13 after
finishing ada-mode install.

> Afterwards, I re-ran build.sh, and I get the same (?) error:
>
> wisitoken-followed_by.adb:222:07: warning: "Generate_Data" is not
> modified, could be declared constant [-gnatwk]
> gnatcoll-projects.adb:38:09: warning: unit "Ada.Unchecked_Conversion"
> is not referenced [-gnatwu]

As Simon pointed out, if the compilation options allowed ignoring
warnings, this would not be a problem. I'll do that in the next release.

One workaround is to edit the release options in your alire workspace for
ada-mode:

edit 
~/.emacs.d/elpa/ada-mode-8.0.5/emacs_ada_mode_8.0.5_ecfdcfb4/alire/cache/dependencies/stephes_ada_library_3.7.2_2b6a88f9/build/standard_common_alire.gpr

    (note that is a _very_ long file name!)
    
delete "e" from Common_Switches; it's currently in "-gnatwaBCeJL". Full
patch for that file attached below.

rerun build.sh

That worked for me.

Another workaround is to edit the code to eliminate the warning; see the
patches below. This will be in the next release.

> And if I re-run the failed command:
>
> ❯ gprbuild -s "-j0" "-p" "-P"
> "/home/olegs/.emacs.d/elpa/ada-mode-8.0.5/emacs_ada_mode_8.0.5_ecfdcfb4/alire/cache/dependencies/wisitoken_4.1.0_f9cd282e/build/wisitoken_alire.gpr"
> wisitoken_alire.gpr:8:06: imported project file
> "standard_common_alire" not found
> wisitoken_alire.gpr:28:43: unknown package or project "Standard_Common_Alire"
> wisitoken_alire.gpr:28:43: wrong expression kind for attribute
> "default_switches"
> wisitoken_alire.gpr:28:84: unknown package or project "Standard_Common_Alire"
> wisitoken_alire.gpr:31:43: unknown package or project "Standard_Common_Alire"
> wisitoken_alire.gpr:31:43: wrong expression kind for attribute
> "default_switches"
> wisitoken_alire.gpr:31:82: unknown package or project "Standard_Common_Alire"
> wisitoken_alire.gpr:35:41: unknown package or project "Standard_Common_Alire"
> wisitoken_config.gpr:3:06: imported project file
> "stephes_ada_library.gpr" not found

> So, it looks like maybe the version I selected through Alire is
> ignored?

This fails because it doesn't have the environment variables defined by
alire to point to the toolchain and dependencies. You can use "alr exec"
to try this, but I've not had much success with that.

> Should I perhaps uninstall distribution-installed Ada-related packages
> and re-try with only Alire-installed ones?

No need to uninstall anything.

--
-- Stephe

diff --git a/build/standard_common_alire.gpr b/build/standard_common_alire.gpr
index daf13a3e..c9b64f7c 100644
--- a/build/standard_common_alire.gpr
+++ b/build/standard_common_alire.gpr
@@ -7,7 +7,7 @@
 --  [build-switches] in alire.toml. That is harder to maintain than
 --  this file.
 --
---  Copyright (C) 2018 - 2022 Free Software Foundation, Inc.
+--  Copyright (C) 2018 - 2023 Free Software Foundation, Inc.
 --
 --  This program is free software; you can redistribute it and/or
 --  modify it under terms of the GNU General Public License as
@@ -48,11 +48,11 @@ project Standard_Common_Alire is
       "-g",
       "-gnatfqQ", -- f = all error messages, qQ = process semantics, generate 
.ali if syntax errors
       "-gnatw.d", -- warnings about tags
-      "-gnatwaBCeJL"
+      "-gnatwaBCJL"
      -- wa = most warnings
      -- wB = no warn on bad fixed values
      -- wC = no warn on conditionals
-     -- we = error on warning
+     -- we = error on warning; only in debug, so released code still compiles 
with newer gnat
      -- wJ = no warn on obsolescent (including () for array indices!)
      -- wL = no warn on elaboration
      );
@@ -64,7 +64,7 @@ project Standard_Common_Alire is
       "-O0", --  we don't use -Og because that causes gdb to report incorrect 
results in some cases in Ada.
       "-gnatVa", -- validity checks
       "-gnateE", -- extra info in exceptions
-      "-gnatwP", -- no warn on Inline
+      "-gnatweP", -- error on warn, no warn on Inline
       "-gnata"  -- assertions, pre/post-conditions
      );


diff --git a/wisitoken-followed_by.adb b/wisitoken-followed_by.adb
index 04c9aed5..098b262f 100644
--- a/wisitoken-followed_by.adb
+++ b/wisitoken-followed_by.adb
@@ -30,7 +30,7 @@
 --  expand               : C2: simple_expression : 'new' subtype_indication + 
primary ;
 --  that's the derivation we are looking for.
 
---  Copyright (C) 2020, 2022 Stephen Leake All Rights Reserved.
+--  Copyright (C) 2020, 2022, 2023 Stephen Leake All Rights Reserved.
 --
 --  This library is free software;  you can redistribute it and/or modify it
 --  under terms of the  GNU General Public License  as published by the Free
@@ -219,7 +219,7 @@ begin
       Input_Data : aliased WisiToken_Grammar_Runtime.User_Data_Type;
       Trace : WisiToken.Text_IO_Trace.Trace;
 
-      Generate_Data : aliased WisiToken.BNF.Generate_Utils.Generate_Data :=
+      Generate_Data : aliased constant 
WisiToken.BNF.Generate_Utils.Generate_Data :=
         WisiToken.BNF.Generate_Utils.Parse_Grammar_File
           (-Grammar_File_Name, Input_Data'Unchecked_Access, BNF.LALR, 
BNF.re2c_Lexer, Trace, Ignore_Conflicts => True);
       --  Builds Generate_Data.Descriptor, Generate_Data.Grammar


diff --git a/wisitoken_grammar_runtime.adb b/wisitoken_grammar_runtime.adb
index dc2f3a72..8972f29e 100644
--- a/wisitoken_grammar_runtime.adb
+++ b/wisitoken_grammar_runtime.adb
@@ -242,7 +242,12 @@ package body WisiToken_Grammar_Runtime is
          begin
             WisiToken.Syntax_Trees.LR_Utils.Raise_Programmer_Error
               ("Get_RHS: " & Exception_Name (E) & ": " & Exception_Message 
(E), Tree, Token);
-            raise; -- WORKAROUND; GNAT pro_22.0w-20201222 ignores 'pragma 
no_return' on Raise_Programmer_Error
+
+            --  WORKAROUND; GNAT pro_22.0w-20201222 ignores 'pragma
+            --  no_return' on Raise_Programmer_Error; uncomment 'raise' for 
that
+            --  compiler.
+            --
+            --  raise;
          end;
       end if;
    end Get_RHS;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]