AdaCore / gnat-llvm

LLVM based GNAT compiler
179 stars 18 forks source link

GNAT-LLVM fails to compile gnatlib with LLVM 15 (MSYS2, Windows) #31

Closed Glacia closed 1 year ago

Glacia commented 1 year ago

Hello!

So I've noticed that GNAT-LLVM is not experimental anymore, so i tried to build it on windows with msys2. I decided to build with LLVM 15, hoping that it would work... And it didn't.

So what happens is this: GNAT-LLVM compiles fine (I have all the binaries in Bin directory), but the compiler segfaults when you try to compile gnatlib (or anything, really). After some debugging I've figured out that the segfault happens in LLVM dll, in function LLVMGetElementType. Ada function that calls it is https://github.com/AdaCore/gnat-llvm/blob/613626a8cabebdabd581759f42f5121a0e99d075/llvm-interface/gnatllvm-glvalue.adb#L1778

The issue seems to be with LLVM, since i downgraded to LLVM 14 and it works fine.

I did some googling and found this change in mesa that may be related: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18226

ArnaudCharlet commented 1 year ago

Thanks for your report. As documented in README.md, GNAT LLVM is currently compatible with LLVM 14.x, so it's not too surprising that 15.x doesn't work out of the box.

Note also that under Windows, there is no support for Windows exception handling (SEH), but the rest of the build and cross targets should work (with LLVM 14).

Glacia commented 1 year ago

Thanks for your report. As documented in README.md, GNAT LLVM is currently compatible with LLVM 14.x, so it's not too surprising that 15.x doesn't work out of the box.

Yeah, i know. Since i already spent time debugging this issue i decided i should at least report it. The reason why i tried LLVM 15 first is because that's the version msys2 have right know.

Note also that under Windows, there is no support for Windows exception handling (SEH), but the rest of the build and cross targets should work (with LLVM 14).

I had linking errors like in this https://github.com/AdaCore/gnat-llvm/issues/5 issue, the solution in the comments helped and it seems everything is ok now.

ArnaudCharlet commented 1 year ago

Indeed, #5 is the issue I was referring to for native windows exception handling.

ArnaudCharlet commented 1 year ago

The current GNAT LLVM has been upgraded to LLVM 15.0.x by the way