New user, so I may be missing some obvious solutions. I am on ubuntu 24.04, and I prefer using emacs. I have installed alire 2.1.0 from alire.ada.dev.
I would like at least a basic ada mode for emacs. At least syntax highlighting and formatting defaults, but a way to search for names, definitions, etc. would of course be very nice also.
I got the toolchain installed without a lot of trouble, but it initially only showed me the 13.x versions, and 15.x is available. I ran some command to update the index and now I’m on gnat_native 15.2.1 and gprbuild 25.0.1, which I think means I have full 2022 support, right? I was also able to get gnatprove, which I’m happy about, because this is the first time I’ve been able to try that.
(I still have some lingering confusion about the GCC based toolchain and the adacore community edition. If I install through Alire, then I get the GCC one, right? The community edition is standalone?)
In emacs, I tried M-x package-install RET ada-mode RET. That installs ada-mode, but then there’s a warning:
Ada parser exec 'ada_mode_wisi_lr1_parse' not found; install it, or set ada-*-backend to eglot.
Then I tried alr install emacs_ada_mode. That installs some dependencies:
Dependencies (solution):
emacs_ada_mode=8.1.0
emacs_wisi=4.3.2
gnat=15.2.1 (gnat_native)
gnatcoll=22.0.0
libgpr=22.0.0
re2c=3.1.0
stephes_ada_library=3.7.3
wisitoken=4.2.1
xmlada=22.0.0
and emacs_wisi fails with:
Building emacs_wisi=4.3.2/wisi_alire.gpr...
gnatcoll.gpr:254:07: warning: value "windows" is not used as label
Compile
[Ada] wisi.adb
wisi.adb:1031:19: error: ambiguous left-hand side in assignment
compilation of wisi.adb failed
gprbuild: *** compilation phase failed
I thought I’d try installing the dependencies individually to see which ones would succeed. gnat, gnatcoll, xmlada, libgpr seem fine. re2c said something about a system install, and I said “no”, and installed it from ubuntu, which I think is OK.
stephes_ada_library fails with:
sal-time_conversions.ads:263:51: warning: instance uses predefined, not primitive, operator "mod" at line 97
sal-time_conversions-config.ads:35:74: warning: instance uses predefined, not primitive, operator "mod" at sal-time_conversions.ads:97
sal-time_conversions-config.ads:36:83: warning: instance uses predefined, not primitive, operator "mod" at sal-time_conversions.ads:97
sal-time_conversions-config.ads:38:77: warning: instance uses predefined, not primitive, operator "mod" at sal-time_conversions.ads:97
compilation of sal-time_conversions.adb failed
compilation of sal-time_conversions-config.ads failed
gprbuild: *** compilation phase failed
I only see warnings there, so maybe I’m using the wrong flags somehow?
and wisitoken fails with:
wisitoken-lexer-regexp.ads:61:15: error: instantiation error at wisitoken-lexer.ads:142
wisitoken-lexer-regexp.ads:61:15: error: expected an access type with designated type "Instance" defined at wisitoken-lexer.ads:116
wisitoken-lexer-regexp.ads:61:15: error: found an access type with designated type "Instance" defined at line 188
wisitoken-lexer-regexp.ads:61:15: error: ==> in call to "Has_Source" at wisitoken-lexer.ads:128
compilation of wisitoken-lexer-regexp.adb failed
gprbuild: *** compilation phase failed
(Aside: This process clones the same repo 3+ times. Unfortuantely, when I first tried, that repo took about an hour to clone for some reason, which was very frustrating and wasteful. It only needs a single tag for each package, I assume. It would also be nice if I could just download the repo myself and point it to that, because each time the compilation failed it started over and re-cloned the repo. Now the repo clones in seconds so it’s not a big deal, but still seems like it could be better.)
So, dead end. Not sure why the packages would fail to compile… wouldn’t they fail for everyone? Or do I have too new of a toolchain and the package maintainers haven’t updated? Or maybe the packages are just unmaintained or something? Or something about my configuration, like compiler flags, or my index is out of date (I did alr index --update-all)? Or maybe it’s getting confused because of some missing ubuntu packages, or packages that are installed but not the right version or getting in the way somehow?
Then I tried installing the language server with alr install ada_language_server, which worked after a long compile. But when I configured emacs to use it, it was incredibly slow to load a file, like 3+ seconds. I suppose there are ways to autoload it or something, but got a bit fatigued on the whole process, and couldn’t find docs for how to actually use the language server from emacs (some tutorial on useful commands, etc.), so I thought I’d post here.
Also, along the way, I tried a bunch of stuff in alire and probably installed stuff I don’t need. How do I list what I installed globally (not part of an actual alire crate) to see if I should remove some stuff?
Any advice appreciated. Am I on the right track?