zaskar9 / oberon-lang

An LLVM frontend for the Oberon programming language
MIT License
17 stars 2 forks source link

Build report ArchLinux #43

Open tenko opened 4 months ago

tenko commented 4 months ago

Successfully built on latest ArchLinux distribution.

Version:

oberon-lang version 0.1.0 Target: x86_64-pc-linux-gnu Includes: Boost 1.83.0, LLVM 17.0.6

Small fixes performed on src/global.h due to missing include:

#include <sstream>
#include <string>
+#include <cstdint>

Small fixes performed on src/data/ast/ASTContext.h due to missing include:

#include <string>
#include <vector>
+#include <algorithm>

Small fixes performed on src/CMakeLists.txt due to different LLVM library structure:

-    target_link_libraries(${OBERON_LANG} PRIVATE ${llvm_libs})
+    target_link_libraries(${OBERON_LANG} PRIVATE "LLVM-17")

On ArchLinux LLVM is build to a single dynamic library LLVM-17.so. Not sure how to reliable detect this.

Small fix performed on liboberon/Makefile to proceed with the build:

-   O7CFLAGS = -q -O3 --reloc=pic -fenable-extern -fenable-varargs # --target $(TGT)
+   O7CFLAGS = -q -I. -O3 --reloc=pic -fenable-extern -fenable-varargs # --target $(TGT)
-install : dist Oberon.smb Out.smb Random.smb Math.smb Reals.smb Texts.smb
+install : dist Oberon.smb Reals.smb Texts.smb Out.smb Random.smb Math.smb

These changes are probably generic and could be added to the main repository.

Output summary from make test:

 Failed Tests (4):
   Oberon :: codegen/arithmetic_12.mod
   Oberon :: codegen/array_5.mod
   Oberon :: codegen/case_1.mod
   Oberon :: codegen/loop_2.mod

 Unexpectedly Passed Tests (7):
   Oberon :: codegen/arithmetic_11.mod
   Oberon :: codegen/arithmetic_15.mod
   Oberon :: codegen/arithmetic_3.mod
   Oberon :: codegen/arithmetic_5.mod
   Oberon :: codegen/arithmetic_6.mod
   Oberon :: codegen/arithmetic_9.mod
   Oberon :: codegen/procedure_4.mod

 Total Discovered Tests: 92
   Unsupported        :  2 (2.17%)
   Passed             : 70 (76.09%)
   Expectedly Failed  :  9 (9.78%)
   Failed             :  4 (4.35%)
   Unexpectedly Passed:  7 (7.61%)
JohannBo commented 4 months ago

~The llvm_map_components_to_libnames function seems to be deprecated.~ The changes in src/CMakeLists.txt can be made more robust like this:

-    llvm_map_components_to_libnames(llvm_libs core executionengine jitlink orcjit nativecodegen support passes ${LLVM_TARGETS_TO_BUILD})
+    execute_process(COMMAND llvm-config --libs core executionengine jitlink orcjit nativecodegen support passes ${LLVM_TARGETS_TO_BUILD} OUTPUT_VARIABLE llvm_libs)
+    string(STRIP ${llvm_libs} llvm_libs)

This should work™ on all systems. However, I have only tested it on Archlinux.

zaskar9 commented 4 months ago

The llvm_map_components_to_libnames function seems to be deprecated.

Citation needed!

Otherwise, this looks like a platform independent solution! Thanks, @JohannBo!

zaskar9 commented 4 months ago

Output summary from make test:

 Failed Tests (4):
   Oberon :: codegen/arithmetic_12.mod
   Oberon :: codegen/array_5.mod
   Oberon :: codegen/case_1.mod
   Oberon :: codegen/loop_2.mod

 Unexpectedly Passed Tests (7):
   Oberon :: codegen/arithmetic_11.mod
   Oberon :: codegen/arithmetic_15.mod
   Oberon :: codegen/arithmetic_3.mod
   Oberon :: codegen/arithmetic_5.mod
   Oberon :: codegen/arithmetic_6.mod
   Oberon :: codegen/arithmetic_9.mod
   Oberon :: codegen/procedure_4.mod

 Total Discovered Tests: 92
   Unsupported        :  2 (2.17%)
   Passed             : 70 (76.09%)
   Expectedly Failed  :  9 (9.78%)
   Failed             :  4 (4.35%)
   Unexpectedly Passed:  7 (7.61%)

Just to confirm: this is the expected (current) outcome of the unit tests on an x86_64 platform.

JohannBo commented 4 months ago

The llvm_map_components_to_libnames function seems to be deprecated.

Citation needed!

Good point. I read it here, but without further source.

However, I found an old report for a bug which might be the cause of this issue.