Open moverby44 opened 1 year ago
I eventually get this message as well: The project was loaded, but no Ada runtime found. Please check the installation of the Ada compiler.
I should reinforce, from a VS code terminal window, I can gprbuild the file as well as execute the resulting binary.
Yes I have. VS Code works properly for other language servers (C++ as an example). I even just tested this on a fresh laptop with a new WSL2 install of ada. I walked through the steps in the linked page.
I also, walked through the steps here: https://github.com/AdaCore/ada_language_server/wiki/Getting-Started
After several minutes it complains about no ada toolchain. A gprbuild from the command line succeeds (from a VS code terminal even).
Screen shots attached.
Just to make sure this wasn't a specific WSL2 problem. I also spun up an x86_64 EC2 instance clean and installed everything and did a remote SSH connection through code to the EC2 instance and I'm getting basically the same error (although it happens much faster).
This is likely due to a version mismatch between the GNAT and GCC versions you have installed. I had pretty much the same problem recently on Ubuntu. By default, sudo apt install gnat
will install gnat-10. GCC defaults to gcc-11 on Ubuntu 22.04. ALS can't find the run-time when you have a mismatched GNAT/GCC installation like this. Try installing gnat-11, or whatever version matches your GCC installation (i.e., gcc --version
).
Could you try to install gnat_native
and gprbuild
with Alire and try with them?
I will try both suggestions. I'm not sure about the gcc version, I thought on my clean install gnat forced a load of a matching gcc, but I'll check.
I'll also try Alire, but unfortunately on WSL2 anyway when I tried Alire before I gave up as the performance was horrible. A hello world app took 4 minutes to build. The same code with gprbuild took a second. But I will try the combination as well.
Bingo. I think we have a winner. @brownts nailed it. apt removed everything and did gcc with gnat-11 and it works on ec2. I'll try WSL2 next.
Also verified that it fixes WSL2.
Should this get added to the Ada language server front page?
We have added more diagnostic messages in the extension 23.0.18. While we seek to better support Debian/Ubuntu Ada toolchains, I think, it worth to mention this bug on Ada language server front page, indeed.
Environment is WSL2 on Windows 11 2H22. Distro is Ubuntu Jammy. I did a sudo apt install gnat gprbuild Both completed with success. I have the ALS installed with version 23.0.17.
I can manually compile with gprbuild the hello_world example from the ALS tutorial. However, I'm getting no language server behavior and it is complaining that it cannot find a toolchain. If I open a terminal from VS Code and do gnatls, I see the expected output. I can also do a gprbuild for the .gpr file from the hello_world example and it compiles correctly and the program runs normally. However, the language server insists that there is no tool chain.
Suggestions? Or is this a bug?