From 2324c29dd1b618441fad37f062ae784f35906412 Mon Sep 17 00:00:00 2001 From: Jonas Krimmer <30567171+jkrimmer@users.noreply.github.com> Date: Thu, 26 Sep 2024 01:05:05 +0200 Subject: [PATCH] Add LLVM18 Bootstrap (#9415) Co-authored-by: Jonas Krimmer --- 0_RootFS/LLVMBootstrap@18/build_tarballs.jl | 16 ++++++++++ .../bundled/patches/install-prefix.patch | 31 +++++++++++++++++++ 0_RootFS/llvm_common.jl | 1 + 3 files changed, 48 insertions(+) create mode 100644 0_RootFS/LLVMBootstrap@18/build_tarballs.jl create mode 100644 0_RootFS/LLVMBootstrap@18/bundled/patches/install-prefix.patch diff --git a/0_RootFS/LLVMBootstrap@18/build_tarballs.jl b/0_RootFS/LLVMBootstrap@18/build_tarballs.jl new file mode 100644 index 00000000000..e6dc55de2d0 --- /dev/null +++ b/0_RootFS/LLVMBootstrap@18/build_tarballs.jl @@ -0,0 +1,16 @@ +# Include everything common between our LLVM versions (That's a lot) +include("../llvm_common.jl") + +# Build the tarballs, then upload to Yggdrasil releases + +name = "LLVMBootstrap" +version = v"18.1.7" +sources, script, products, dependencies = llvm_build_args(;version=version) +ndARGS, deploy_target = find_deploy_arg(ARGS) +# Earlier versions of GCC can cause Clang to fail with `error: unknown target CPU 'x86-64'` +# https://github.com/JuliaPackaging/BinaryBuilderBase.jl/pull/112#issuecomment-776940748 +build_info = build_tarballs(ndARGS, name, version, sources, script, [host_platform], products, dependencies; + skip_audit=true, preferred_gcc_version=v"8") +if deploy_target !== nothing + upload_and_insert_shards(deploy_target, name, version, build_info) +end diff --git a/0_RootFS/LLVMBootstrap@18/bundled/patches/install-prefix.patch b/0_RootFS/LLVMBootstrap@18/bundled/patches/install-prefix.patch new file mode 100644 index 00000000000..d2b0882ca42 --- /dev/null +++ b/0_RootFS/LLVMBootstrap@18/bundled/patches/install-prefix.patch @@ -0,0 +1,31 @@ +starting from llvm14 the install prefix breaks via symlinks; +/usr/lib/llvm14/lib/cmake/llvm/LLVMConfig.cmake goes up 3 directories to find +/usr/lib/llvm14/include as LLVM_INCLUDE_DIRS, but to even use this cmake folder +at all it has to be symlinked to /usr/lib/cmake/llvm .. so the directory it +instead uses is just /usr/include, which is not where the cmake includes are. +this hardcodes them to the install prefix we pass via cmake, which should +always be correct, and what cmake tries to autodetect anyway. + +also see: https://reviews.llvm.org/D29969 + +this is supposedly fixed now, but for some reason it still isn't +--- a/llvm/cmake/modules/CMakeLists.txt ++++ b/llvm/cmake/modules/CMakeLists.txt +@@ -41,6 +41,8 @@ + # + + set(LLVM_CONFIG_CODE " ++# this is wrong when automatically detected ++set(LLVM_INSTALL_PREFIX \"${CMAKE_INSTALL_PREFIX}\") + # LLVM_BUILD_* values available only from LLVM build tree. + set(LLVM_BUILD_BINARY_DIR \"${LLVM_BINARY_DIR}\") + set(LLVM_BUILD_LIBRARY_DIR \"${LLVM_LIBRARY_DIR}\") +@@ -109,8 +111,6 @@ + # + # Generate LLVMConfig.cmake for the install tree. + # +- +-find_prefix_from_config(LLVM_CONFIG_CODE LLVM_INSTALL_PREFIX "${LLVM_INSTALL_PACKAGE_DIR}") + + extend_path(LLVM_CONFIG_MAIN_INCLUDE_DIR "\${LLVM_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}") + # This is the same as the above because the handwritten and generated headers \ No newline at end of file diff --git a/0_RootFS/llvm_common.jl b/0_RootFS/llvm_common.jl index c64f48c0084..692709f6ddb 100644 --- a/0_RootFS/llvm_common.jl +++ b/0_RootFS/llvm_common.jl @@ -37,6 +37,7 @@ llvm_tags = Dict( v"15.0.7" => "8dfdcc7b7bf66834a761bd8de445840ef68e4d1a", v"16.0.6" => "7cbf1a2591520c2491aa35339f227775f4d3adf6", v"17.0.6" => "6009708b4367171ccdbf4b5905cb6a803753fe18", + v"18.1.7" => "768118d1ad38bf13c545828f67bd6b474d61fc55", ) function llvm_sources(;version = "v8.0.1", kwargs...)