From b2345134e3afb5e5b78c717602b2ec3a9867b275 Mon Sep 17 00:00:00 2001 From: Nikita Mikhaylov Date: Mon, 7 Mar 2022 19:36:33 +0100 Subject: [PATCH 1/3] Try --- contrib/llvm-cmake/CMakeLists.txt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/contrib/llvm-cmake/CMakeLists.txt b/contrib/llvm-cmake/CMakeLists.txt index e859df65b6f..f8fe57a1705 100644 --- a/contrib/llvm-cmake/CMakeLists.txt +++ b/contrib/llvm-cmake/CMakeLists.txt @@ -1,8 +1,8 @@ -if (APPLE OR NOT ARCH_AMD64 OR SANITIZE STREQUAL "undefined") - set (ENABLE_EMBEDDED_COMPILER_DEFAULT OFF) -else() - set (ENABLE_EMBEDDED_COMPILER_DEFAULT ON) -endif() +#if (APPLE OR NOT ARCH_AMD64 OR SANITIZE STREQUAL "undefined") +# set (ENABLE_EMBEDDED_COMPILER_DEFAULT OFF) +#else() +# set (ENABLE_EMBEDDED_COMPILER_DEFAULT ON) +#endif() option (ENABLE_EMBEDDED_COMPILER "Enable support for 'compile_expressions' option for query execution" ${ENABLE_EMBEDDED_COMPILER_DEFAULT}) if (NOT ENABLE_EMBEDDED_COMPILER) @@ -25,6 +25,9 @@ set (REQUIRED_LLVM_LIBRARIES LLVMX86CodeGen LLVMX86Desc LLVMX86Info + LLVMAArch64CodeGen + LLVMAArch64Desc + LLVMAArch64Info LLVMAsmPrinter LLVMDebugInfoDWARF LLVMGlobalISel From 3b97f5f5c3e905a5375d2ac1ff4190f492656675 Mon Sep 17 00:00:00 2001 From: Nikita Mikhaylov Date: Mon, 7 Mar 2022 23:33:48 +0100 Subject: [PATCH 2/3] Better --- contrib/llvm-cmake/CMakeLists.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/contrib/llvm-cmake/CMakeLists.txt b/contrib/llvm-cmake/CMakeLists.txt index f8fe57a1705..ff46447488f 100644 --- a/contrib/llvm-cmake/CMakeLists.txt +++ b/contrib/llvm-cmake/CMakeLists.txt @@ -1,8 +1,8 @@ -#if (APPLE OR NOT ARCH_AMD64 OR SANITIZE STREQUAL "undefined") -# set (ENABLE_EMBEDDED_COMPILER_DEFAULT OFF) -#else() -# set (ENABLE_EMBEDDED_COMPILER_DEFAULT ON) -#endif() +if (CMAKE_CROSSCOMPILING OR SANITIZE STREQUAL "undefined") + set (ENABLE_EMBEDDED_COMPILER_DEFAULT OFF) +else() + set (ENABLE_EMBEDDED_COMPILER_DEFAULT ON) +endif() option (ENABLE_EMBEDDED_COMPILER "Enable support for 'compile_expressions' option for query execution" ${ENABLE_EMBEDDED_COMPILER_DEFAULT}) if (NOT ENABLE_EMBEDDED_COMPILER) @@ -22,12 +22,6 @@ set (LLVM_LIBRARY_DIRS "${ClickHouse_BINARY_DIR}/contrib/llvm/llvm") set (REQUIRED_LLVM_LIBRARIES LLVMExecutionEngine LLVMRuntimeDyld - LLVMX86CodeGen - LLVMX86Desc - LLVMX86Info - LLVMAArch64CodeGen - LLVMAArch64Desc - LLVMAArch64Info LLVMAsmPrinter LLVMDebugInfoDWARF LLVMGlobalISel @@ -59,6 +53,12 @@ set (REQUIRED_LLVM_LIBRARIES LLVMDemangle ) +if (ARCH_AMD64) + list(APPEND REQUIRED_LLVM_LIBRARIES LLVMX86Info LLVMX86Desc LLVMX86CodeGen) +elseif (ARCH_AARCH64) + list(APPEND REQUIRED_LLVM_LIBRARIES LLVMAArch64Info LLVMAArch64Desc LLVMAArch64CodeGen) +endif () + #function(llvm_libs_all REQUIRED_LLVM_LIBRARIES) # llvm_map_components_to_libnames (result all) # if (USE_STATIC_LIBRARIES OR NOT "LLVM" IN_LIST result) From af71df6054d1c5d0e867dfc35ec06292234e89d0 Mon Sep 17 00:00:00 2001 From: Nikita Mikhaylov Date: Wed, 9 Mar 2022 16:51:44 +0100 Subject: [PATCH 3/3] Added comment --- contrib/llvm-cmake/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/llvm-cmake/CMakeLists.txt b/contrib/llvm-cmake/CMakeLists.txt index ff46447488f..6ff07f0e016 100644 --- a/contrib/llvm-cmake/CMakeLists.txt +++ b/contrib/llvm-cmake/CMakeLists.txt @@ -1,3 +1,7 @@ +# During cross-compilation in our CI we have to use llvm-tblgen and other building tools +# tools to be build for host architecture and everything else for target architecture (e.g. AArch64) +# Possible workaround is to use llvm-tblgen from some package... +# But lets just enable LLVM for native builds if (CMAKE_CROSSCOMPILING OR SANITIZE STREQUAL "undefined") set (ENABLE_EMBEDDED_COMPILER_DEFAULT OFF) else()