Build LLVM on Linux from Official Release Tarball.
For building llvm, this will download the official release tarball and verify the download.
Previously, it was just cloning the git repo at the release tag. And then proceeded without verifying the download.
did not verify, but this is the way its supposed to be done.
Also I found a simpler/faster way to build on linux with standard clang-llvm-13 binaries see here https://github.com/beefytech/Beef/issues/1738#issuecomment-1279015180
@mingodad: i modified my master branch to use distro llvm for building beef.
have only tried on arch linux tho. feel free to add build instructions for ubuntu, if this is relevant for you.
chances are, you gotta set a different CMAKE_PREFIX_PATH to have cmake find the right llvm version on ubuntu.
Hello @flying-dude I don't see that you have added any conditional macro on the source files that reference llvm private API nor have removed then from the build.
IDEHelper/LinuxDebugger.cpp
IDEHelper/Targets.cpp
IDEHelper/X64.cpp
IDEHelper/X86.cpp
Also I didn't found any mention to the missing -lffi :
------------------------------ IDE/src/IDEApp.bf ------------------------------
index ae5a0c64..e2e20b92 100644
@@ -10194,7 +10194,7 @@ namespace IDE
newString.AppendF("./{} -Wl,-rpath -Wl,@executable_path", rtName);
case .iOS:
case .Linux:
- newString.AppendF("./{} -lpthread -ldl -Wl,-rpath -Wl,$ORIGIN", rtName);
+ newString.AppendF("./{} -lpthread -ldl -lffi -Wl,-rpath -Wl,$ORIGIN", rtName);
case .Wasm:
newString.Append("\"");
newString.Append(mInstallDir);
--------------------------- IDEHelper/CMakeLists.txt ---------------------------
index dc41ea2d..8b0cd4e2 100644
@@ -294,7 +294,7 @@ endif()
if(MSVC)
target_link_libraries(${PROJECT_NAME} BeefySysLib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib LLVMX86Disassembler.lib LLVMMCDisassembler.lib LLVMSupport.lib LLVMX86Info.lib LLVMX86Desc.lib %(AdditionalDependencies) LLVMMC.lib LLVMObject.lib LLVMCore.lib LLVMBitReader.lib LLVMAsmParser.lib LLVMMCParser.lib LLVMCodeGen.lib LLVMTarget.lib LLVMX86CodeGen.lib LLVMScalarOpts.lib LLVMInstCombine.lib LLVMSelectionDAG.lib LLVMProfileData.lib LLVMTransformUtils.lib LLVMAnalysis.lib LLVMX86AsmParser.lib LLVMAsmPrinter.lib LLVMBitWriter.lib LLVMVectorize.lib LLVMipo.lib LLVMInstrumentation.lib LLVMDebugInfoDWARF.lib LLVMDebugInfoPDB.lib LLVMDebugInfoCodeView.lib LLVMGlobalISel.lib LLVMBinaryFormat.lib LLVMAggressiveInstCombine.lib libcurl_a.lib)
else()
- target_link_libraries(${PROJECT_NAME} BeefySysLib hunspell pthread dl ${TARGET_LIBS_OS}
+ target_link_libraries(${PROJECT_NAME} BeefySysLib hunspell pthread ffi dl ${TARGET_LIBS_OS}
)
endif()
--------------------------------- bin/build.sh ---------------------------------
index 3d234bed..68f8be20 100755
@@ -69,7 +69,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
LINKOPTS="-Wl,-no_compact_unwind -Wl,-rpath -Wl,@executable_path"
else
LIBEXT=so
- LINKOPTS="-ldl -lpthread -Wl,-rpath -Wl,\$ORIGIN"
+ LINKOPTS="-ldl -lpthread -lffi -Wl,-rpath -Wl,\$ORIGIN"
fi
ln -s -f $ROOTPATH/jbuild_d/Debug/bin/libBeefRT_d.a libBeefRT_d.a
i commented all the manual inclusion of llvm facilities from the cmake files. instead i use cmake feature find_package. the only two subprojects using llvm are BeefBoot and IDEHelper. the other ones don't use llvm.
for libffi i didn't do any changes. it's just done the same way how upstream does it, which is to compile manually. see here.
i did deactivate the custom backend. everything still works but it will always use llvm. the macros for deactivating the custom backend are here.