Closed Alex-Gamper closed 4 years ago
Thank you for you report. I'll add the bits about MINGW in the Makefile. As for the error during the runtime build, it doesn't ring a bell at first sight, never seen this one and we are currently not building under Windows, so can't immediately duplicate or investigate. You could try to do a "make -k" to see how many files are impacted (i.e. is this specific to this file or a more general issue impacting many files).
Hi Arnaud
Thanks for the quick reply! I have run make again with -k option, and the same error as above appears in a number of files,I also see a different error as well, See below
Please let me know if their is any more information that you need, Happy to assist/learn
Thanks Alex
make[3]: *** [/home/alexg/Software/gnat-llvm/llvm-interface/Makefile:201: a-ssizti.o] Error 1 /home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-stboha.adb /home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-stfiha.ads /home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-stmaco.ads /home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-storio.adb /home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-strbou.adb /home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-stream.adb +===========================GNAT BUG DETECTED==============================+ | 1.0 (llvm) Constraint_Error gnatllvm-debuginfo.adb:342 range check failed| | No source file position information available | | Please submit a bug report; see https://gcc.gnu.org/bugs/ . | | Use a subject line meaningful to you and us to track the bug. | | Include the entire contents of this bug box in the report. | | Include the exact command that you entered. | | Also include sources listed below. | +==========================================================================+
Please include these source files with error report Note that list may not be accurate in some cases, so please double check that the problem can still be reproduced with the set of files listed. Consider also -gnatd.n switch (see debug.adb).
../adainclude\system.ads ../adainclude/a-stream.adb ../adainclude/a-stream.ads ../adainclude/ada.ads ../adainclude/a-ioexce.ads ../adainclude/s-stalib.ads ../adainclude/a-unccon.ads ../adainclude/s-exctab.ads ../adainclude/a-tags.ads ../adainclude/s-stoele.ads ../adainclude/s-soflin.ads ../adainclude/a-except.ads ../adainclude/s-parame.ads ../adainclude/s-traent.ads ../adainclude/s-secsta.ads ../adainclude/s-stache.ads ../adainclude/s-stoele.adb
compilation abandoned
Can you try to build GNAT LLVM with GNAT Community 2019 and tell us if this makes a difference?
Sure
Here is the gcc -v after setting up the PATH environment variable for your information
$ gcc -v Using built-in specs. COLLECT_GCC=C:\GNAT\2019\bin\gcc.exe COLLECT_LTO_WRAPPER=c:/gnat/2019/bin/../libexec/gcc/x86_64-pc-mingw32/8.3.1/lto-wrapper.exe Target: x86_64-pc-mingw32 Configured with: ../src/configure --enable-languages=ada,c,c++ --enable-threads=win32 --enable-libstdcxx-threads --enable-lto --enable-large-address-aware --with-bugurl=URL:mailto:report@adacore.com --disable-nls --without-libiconv-prefix --disable-libstdcxx-pch --disable-libada --enable-checking=release --disable-multilib --with-mpfr=/it/sbx/a2c2/x86_64-windows/mpfr_stable-c/install --with-gmp=/it/sbx/a2c2/x86_64-windows/gmp_stable-c/install --with-mpc=/it/sbx/a2c2/x86_64-windows/mpc_stable-c/install --with-build-time-tools=/it/sbx/a2c2/x86_64-windows/gcc-c/build/buildtools/bin --prefix=/it/sbx/a2c2/x86_64-windows/gcc-c/pkg --build=x86_64-pc-mingw32 Thread model: win32 gcc version 8.3.1 20190518 (for GNAT Community 2019 20190517) (GCC)
C:\GNAT\2019\libexec/gprbuild/gprbind.exe gnat1drv.bexch C:\gnat\2019\bin\gnatbind.exe -o bgnat1drv.adb C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\obj\gnat1drv.ali -x -F=C:\msys64\tmp\GNAT-TEMP-000034.TMP -O=C:\msys64\tmp\GNAT-TEMP-000036.TMP c:\gnat\2019\bin\gcc -c -x ada -gnatA -c -gnatA -gnatWb -gnatiw -gnatws -g -mtune=generic -march=x86-64 bgnat1drv.adb -o b__gnat1drv.o ar cr libgnat_llvm.a C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\obj\gcc_missing.o C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\obj\llvm_wrapper.o C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\obj\targext.o ranlib libgnat_llvm.a g++ gnat1drv.o C:\msys64\tmp\GNAT-TEMP-000036.TMP libgnat_llvm.a -LC:\msys64\mingw64/lib -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMMIRParser -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMCoverage -lLLVMMCA -lLLVMTableGen -lLLVMDlltoolDriver -lLLVMXRay -lLLVMOrcJIT -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyAsmPrinter -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyInfo -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMSP430Disassembler -lLLVMMSP430CodeGen -lLLVMMSP430AsmParser -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiAsmPrinter -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFCodeGen -lLLVMBPFAsmParser -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMBPFAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMARMUtils -lLLVMAMDGPUDisassembler -lLLVMAMDGPUCodeGen -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUInfo -lLLVMAMDGPUAsmPrinter -lLLVMAMDGPUUtils -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMObjectYAML -lLLVMLibDriver -lLLVMOption -lLLVMOptRemarks -lLLVMWindowsManifest -lLLVMTextAPI -lLLVMFuzzMutate -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMLineEditor -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMTarget -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMInstCombine -lLLVMBitWriter -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -lz -lpsapi -lshell32 -lole32 -luuid -ladvapi32 -lpthread -static-libstdc++ -Wl,--stack=0x2000000 -LC:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\obj\ -LC:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\obj\ -LC:/gnat/2019/lib/gcc/x86_64-pc-mingw32/8.3.1/adalib/ C:/gnat/2019/lib/gcc/x86_64-pc-mingw32/8.3.1/adalib/libgnat.a -shared-libgcc -o C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\bin\llvm-gnat1.exe c:/gnat/2019/bin/../libexec/gcc/x86_64-pc-mingw32/8.3.1/ld.exe: cannot find -lpthread collect2.exe: error: ld returned 1 exit status gprbuild: link of gnat1drv.adb failed make[1]: *** [Makefile:82: build] Error 4 make[1]: Leaving directory '/home/alexg/S
OK, thanks for trying. Indeed, GNAT Community won't do it to build GNAT LLVM under Windows.
Another question: if you now remove GNAT Community from your PATH (your initial config), what's the output of the following command: gcc -dumpmachine
There is a Mingw64 pthreads library you could try to compile.
Can you try with the latest commit?
$ gcc -dumpmachine x86_64-w64-mingw32
I got the latest commit, thanks :-) and the issue still remains evident for uintp-llvm.adb:171 in multiple files, However the error in gnatllvm-debuginfo.adb has been resolved
Can I send you the build log file ?
Thanks
Alex
Hi Attached is the log file for "make -k", some other errors are evident when building raise-gcc.c. I think this may be due to not passing in the correct/additional #DEFINE definitions needed for MINGW ??
FYI as a side note, "make clean" does not delete the bin directory, not sure if this is intended or not ?
Thanks Alex build.log
I suspect this is also a type size issue since I see an error in llvm/adainclude/stdint_h.ads. Can you try this patch and see if it works?
--- a/llvm-interface/gnatllvm-debuginfo.adb +++ b/llvm-interface/gnatllvm-debuginfo.adb @@ -338,10 +338,8 @@ package body GNATLLVM.DebugInfo is TE : constant Entity_Id := Full_Etype (GT); Name : constant String := Get_Name (TE); T : constant Type_T := Type_Of (GT);
--- a/llvm/adainclude/stdint_h.ads +++ b/llvm/adainclude/stdint_h.ads @@ -1,6 +1,7 @@ pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C; +with Interfaces.C.Extensions; use Interfaces.C.Extensions;
package stdint_h is
@@ -18,7 +19,7 @@ package stdint_h is
subtype uint32_t is unsigned; -- /usr/include/stdint.h:51
subtype uint64_t is Unsigned_long_long; -- /usr/include/stdint.h:55
subtype intptr_t is long; -- /usr/include/stdint.h:119
I suspect this is also a type size issue since I see an error in llvm/adainclude/stdint_h.ads in the definition of uint64_t. I wanted to include a patch to try, but I can't seem to get the formatting right.
I suspect this is also a type size issue since I see an error in llvm/adainclude/stdint_h.ads in the definition of uint64_t. I wanted to include a patch to try, but I can't seem to get the formatting right.
Ah yes, the definitions of 64bits types in stdint_h.ads are evidently wrong, I'll fix them, hang on.
Should be better now, let us know!
Hi
The original error has now been resolved, But now I get a new error when building the native runtime (same error also occurs in a-llfzti.ads) I've attached the build log. I will try to temporarily remove the two files and try and resolve the error in raise-gcc.c to see how far the rest of the build goes.
Thanks Alex
/home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-llfwti.ads LLVM ERROR: Stack empty?? make[3]: [/home/alexg/Software/gnat-llvm/llvm-interface/Makefile:190: a-llfwti.o] Error 1 make[3]: Leaving directory '/home/alexg/Software/gnat-llvm/llvm-interface/lib/rts-native/adalib' make[2]: [Makefile:203: quicklib] Error 2 make[2]: Leaving directory '/home/alexg/Software/gnat-llvm/llvm-interface' make[1]: [Makefile:198: gnatlib-automated] Error 2 make[1]: Leaving directory '/home/alexg/Software/gnat-llvm/llvm-interface' make: [Makefile:2: all] Error 2
That error is very peculiar. It's from the LLVM code generation for the X86 floating-point stack. Do you know if the LLVM 8.0.1 that you're using has been changed from their distribution?
Not sure if the msys2 project has applied any patches, I'll check their repo
MSYS have applied a number of patches to their llvm/Clang repo, (not sure if any of them apply) ? see https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-clang
I changed my copy of the two files and made them look like the Text_IO version, and the error did not appear as expected. A temp solution so I can see what the issue with raise-gcc.c is
To complicate the matter the LLVM version of Unwind.h does not support the definition of EXCEPTION_RECORD (found in winnt.h via inclusion of windows.h). The mingw64 version of Unwind.h includes windows.h if SEH is defined. I copied the mingw64 version of unwind.h to LLVM and the build succeeded
However now the ar command fails when trying the arvive/build the libgnat archive (see below)
So in summary we have 3 issues 1) LLVM error: stack empty 2) LLVM version of unwind.h needs to be replaced by the mingw version (or patched to include windows.h) 3) ar error when building libgnat (argument list to long)
Thanks Alex
clang -c -O2 -g -DIN_RTS=1 -fexceptions -DSTANDALONE -I../adainclude -I../include ../adainclude/raise-gcc.c make[3]: Leaving directory '/home/alexg/Software/gnat-llvm/llvm-interface/lib/rts-native/adalib' rm -f /home/alexg/Software/gnat-llvm/llvm-interface/lib/rts-native/adalib/libgnat.a /home/alexg/Software/gnat-llvm/llvm-interface/lib/rts-native/adalib/libgnarl.a make[2]: execvp: ar: Argument list too long make[2]: [Makefile:205: quicklib] Error 127 make[2]: Leaving directory '/home/alexg/Software/gnat-llvm/llvm-interface' make[1]: [Makefile:198: gnatlib-automated] Error 2 make[1]: Leaving directory '/home/alexg/Software/gnat-llvm/llvm-interface' make: *** [Makefile:2: all] Error 2
FYI, I have now managed to build gnat-llvm under msys2 (using the msys2 supplied clang compiler) with my local changes to address issues 1. and 2. above. I will do some more testing in the coming days, and obviously give you feedback. Note that issue 3. was resolved via the patch above, Thanks @ArnaudCharlet
I did however notice that in the latest git repo you have upgraded the LLVM bindings to version 9.0. I assume that I will need a version 9.0 llvm/clang running under msys2 ? which is not currently available via the msys2 distro. So I will try and do a clean llvm/Clang for version 9.0. I am happy to do and test this, and I will try to this later this week if possible ?
Thanks Alex
Glad to hear it. Yes, the latest sources now depend on LLVM 9.0.0. I'm sure official packages for msys2 will appear soon.
Hi AdaCore The Msys2 project have just released LLVM 9.0.0 and I have rebuilt gnat-LLVM with my local patches to address issues 1) and 2) above. So now onto the next step to build a simple Ada program !
I get the below error with building a very simple "hello world" application which seems to indicate issues with the Ada runtime (ie libgnat/libgnarl) ???. Under msys2/mingw. I seem to recall that the gnat_personality_v0 is the default exception handler under Linux, but Msyd2/Mingw uses gnat_personality_seh, which I believe is set by pre-processor directive SEH . I am not sure how exactly this should be set in the makefile ?
Any advice would be appreciated !
Thanks Alex
$ ./llvm-gnatmake.exe Hello.adb
llvm-gcc -c hello.adb
llvm-gnatbind -x hello.ali
llvm-gnatlink hello.ali
C:\msys64\mingw64\bin\ld: C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\/lib/rts-native/adalib\libgnat.a(a-except.o):a-except.adb:(.xdata+0x128): undefined reference to __gnat_personality_v0' C:\msys64\mingw64\bin\ld: C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\/lib/rts-native/adalib\libgnat.a(a-except.o):a-except.adb:(.xdata+0x240): undefined reference to
gnat_personality_v0'
C:\msys64\mingw64\bin\ld: C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\/lib/rts-native/adalib\libgnat.a(a-except.o):a-except.adb:(.xdata+0x420): undefined reference to `gnat_personality_v0'
C:\msys64\mingw64\bin\ld: C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\/lib/rts-native/adalib\libgnat.a(a-except.o):a-except.adb:(.xdata+0x45c): undefined reference to __gnat_personality_v0' C:\msys64\mingw64\bin\ld: C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\/lib/rts-native/adalib\libgnat.a(a-except.o):a-except.adb:(.xdata+0x498): undefined reference to
gnat_personality_v0'
C:\msys64\mingw64\bin\ld: C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\/lib/rts-native/adalib\libgnat.a(a-finali.o):a-finali.adb:(.xdata+0x8): more undefined references to `gnat_personality_v0' follow
clang: error: linker command failed with exit code 1 (use -v to see invocation)
llvm-gnatlink: error when calling C:\msys64\home\alexg\Software\gnat-llvm\llvm-interface\bin\llvm-gcc.exe
llvm-gnatmake: *** link failed.
Alex: since you've closed this (build) issue, would you mind opening a new one for the link error? Otherwise it will start getting difficult to track the various different issues, and that won't be possible under a single close issue, thanks!
Sure, sorry
Dear AdaCore I tried building gnat-llvm under MSYS2/mingw64 using the latest version of gcc and llvm packages as supplied by the MSYS2 project (ie gcc 9.2.0 and LLVM 8.0.1) after making minor changes to the makefile in llvm-interface directory (ie adding test for uname containing "MINGW" in the same manner as the test for "CYGWIN".
This build worked up until when trying to build the ada native-runtime. Below is the error evident in the build.
I would appreciate some guidance on how this could be resolved
Thanks Alex
make[3]: Entering directory '/home/alexg/Software/gnat-llvm/llvm-interface/lib/rts-native/adalib' /home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-assert.adb /home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-btgbso.adb /home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-calari.adb /home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-calcon.adb /home/alexg/Software/gnat-llvm/llvm-interface/bin/llvm-gcc -c -O2 -g -gnatpg -nostdinc -I../adainclude ../adainclude/a-caldel.adb +===========================GNAT BUG DETECTED==============================+ | 1.0 (llvm) Constraint_Error uintp-llvm.adb:171 range check failed | | No source file position information available | | Please submit a bug report; see https://gcc.gnu.org/bugs/ . | | Use a subject line meaningful to you and us to track the bug. | | Include the entire contents of this bug box in the report. | | Include the exact command that you entered. | | Also include sources listed below. | +==========================================================================+
Please include these source files with error report Note that list may not be accurate in some cases, so please double check that the problem can still be reproduced with the set of files listed. Consider also -gnatd.n switch (see debug.adb).
../adainclude\system.ads ../adainclude/a-caldel.adb ../adainclude/a-caldel.ads ../adainclude/a-calend.ads ../adainclude/ada.ads ../adainclude/s-osprim.ads ../adainclude/s-soflin.ads ../adainclude/a-except.ads ../adainclude/s-parame.ads ../adainclude/s-stalib.ads ../adainclude/a-unccon.ads ../adainclude/s-traent.ads ../adainclude/s-secsta.ads ../adainclude/s-stoele.ads ../adainclude/s-stache.ads ../adainclude/s-exctab.ads
compilation abandoned make[3]: [/home/alexg/Software/gnat-llvm/llvm-interface/Makefile:198: a-caldel.o] Error 1 make[3]: Leaving directory '/home/alexg/Software/gnat-llvm/llvm-interface/lib/rts-native/adalib' make[2]: [Makefile:214: quicklib] Error 2 make[2]: Leaving directory '/home/alexg/Software/gnat-llvm/llvm-interface' make[1]: [Makefile:209: gnatlib-automated] Error 2 make[1]: Leaving directory '/home/alexg/Software/gnat-llvm/llvm-interface' make: [Makefile:2: all] Error 2