Installing gnat llvm

Hello,

Some troubles installing gnat llvm
I’m on Ubuntu 24
Installed llvm-16, clang16
Doing what is said on the read

Error : command opt not found
If I install llvm-dev llvm 18 is installed and opt is found

gprbuild : c++ compiler not found
I install clag , clang 18 installed

Now :
compile llvm_wrapper.cc llvm/Support/AArch64TargetParser.h file not found

Where do I have to search?

Thanks

Hi @gcalliet!

First things first, welcome to the forum!

And you are quite lucky! I just compiled GNAT-LLVM for the first time myself over the weekend, so I think I can help you.

GNAT-LLVM currently requires on LLVM version 16. No other version is expected to work (LLVM has breaking changes between major releases). You can use the package manager binaries. That is recommended as it is the quickest and simplest way to get started. You will need both llvm-16, clang16 and their -dev versions. The -dev versions also have to match the version of llvm/clang, so it needs to be 16.

You will also need to have gnat/gcc installed as well as GPRBuild, which seems to be your case.

Once you have everything correctly setup, you can proceed as the README says, which it seems that you have already done. However, as you are getting a compilation error and it seems related to LLVM sources, this may be related to you having version 18 also installed, which may be the one being selected as the base LLVM.

In order to solve this issue, the GNAT-LLVM repo has a failback mechanism: to compile a local copy of LLVM-16 directly as part of the GNAT-LLVM build process. This is time consuming and requires a somewhat powerful machine or it will take a while. To do this, follow the README instruction: run make llvm on the root folder and it will build the local copy. Afterwards, you can run a simple make and it should work.

If you have enough RAM and quite a few cores, I would suggest using parallel compilation of LLVM by using make llvm -j and then just issue a simple make (do not add the -j flag to the normal make, as it already uses it internally).

If you get further issues, please, let me know. Also, if your GCC/GNAT compiler is version 14, you will need to use the patches indicated here adawebpack/patches at master · godunko/adawebpack · GitHub

Best regards and happy Ada hacking!
Fer

1 Like

Hello,

Very happy not been alone :slight_smile:
I’ll go back to you next week, I have just some urgent business issues to work for these days.
I have a long term project with Gnat LLVM. I’ll told you.

Best regards,
gcalliet

1 Like