-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Advice on building newer version #49
Comments
As explained in README.md, current GNAT LLVM requires LLVM 16, the errors you are seeing are caused by using a too recent LLVM. |
I have tried all versions of llvm from 13 to 19 and none allow the head the master branch to compile for me. Here is the status of my attempts with 16: Prebuilt llvm 16 from llvm-project was built for ubuntu 18 so I attempted to build in ubuntu 18 docker. Gprbuild 24.0.0-2 won't work because ubuntu 18 has too old glibc:
Using gprbuild from ubuntu 18 repos results in a different error:
At this point I decided to give up on the prebuilt llvm-pject, switch to ubuntu22 and build llvm-project at version 16 myself (commit 08d094a). I was able to do so and I was able to build gcc but building llvm-gnat fails.
|
At this point I decided to give up on the prebuilt llvm-pject, switch to ubuntu22 and build llvm-project at version 16 myself (commit 08d094a). I was able to do so and I was able to build gcc but building llvm-gnat fails.
```
/opt/gnat/bin/ld: /gnat-llvm/llvm-interface/obj/llvm-target_machine.o: in function `llvm__target_machine__create_target_machine_with_abi':
/gnat-llvm/llvm/adainclude/llvm-target_machine.adb:219:(.text+0xd9e): undefined reference to `LLVMCreateTargetMachineWithABI'
collect2: error: ld returned 1 exit status
/opt/gnat/bin/ld: /gnat-llvm/llvm-interface/obj/llvm-target_machine.o: in function `llvm__target_machine__create_target_machine_with_abi':
/gnat-llvm/llvm/adainclude/llvm-target_machine.adb:219:(.text+0xd9e): undefined reference to `LLVMCreateTargetMachineWithABI'
collect2: error: ld returned 1 exit status
link of gcc_wrapper.adb failed
link of gnat1drv.adb failed
gprbuild: *** link phase failed
make[1]: *** [Makefile:89: build] Error 4
```
OK, you were actually close with the above which is the right combination (LLVM 16 as per the README).
The missing part is to apply the patches found at llvm/patches in particular LLVMCreateTargetMachineWithABI.diff, the others are optional. This extra step won't be needed once we upgrade to a newer LLVM (which is proving a challenge due to the switch to Opaque pointers in LLVM) since this patch has now been integrated upstream.
Arno
|
That was the missing piece. I have the HEAD of master building now, thanks! |
That was the missing piece. I have the HEAD of master building now, thanks!
Great!
|
By the way, what version of GNAT/GCC are you using? |
I used:
My build pipeline completed successfully last night. This morning, I tested a sample .adb file using my built llvm-gcc, and assembling it into bitcode with my built llvm-as. |
Interesting, GitHub doesn't like the short SHA in this case. The full SHA is: |
@sand7000 : can you give the commit of this repo you used as well? |
I am trying to build the newest commit on master but it is failing. I have been having trouble figuring out which versions of everything to use that won't result in errors. I found this guys blog that gave commits of the different tools that worked together for him:
https://forward-in-code.blogspot.com/2022/03/gnat-llvm.html
and with those commits I was able to build that rather old version by:
this gives me confidence that if I have some guidance on which versions of the different dependencies I will be able to get a new version to compile. Perhaps you could tell me what version of everything you are using in development? Also which branch of llvm-gnat you would recommend using for production?
This is what I am seeing build with:
I used alire releases because gnat-community seems to be eol. I tried gnat-community 2012 but that also failed.
This configuration results in errors. The I overcame the first but it may be causing issues later:
I just make a simlink to the correct location:
But then I get errors that I don't know how to resolve:
The text was updated successfully, but these errors were encountered: