From b64bf6d616e6346e2d0151750003d82d72706ec3 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 30 Jul 2015 13:30:07 +0200 Subject: [PATCH 1/2] Temporarily use llvm3.8-dev in Ubuntu Ubuntu 14.04 replaced llvm3.7-dev with llvm3.8-dev in anticipation of llvm 3.7 release. We are forced to use the 3.8-dev package until llvm 3.7 release. --- evmjit/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/evmjit/CMakeLists.txt b/evmjit/CMakeLists.txt index 5b34acdf8..1547e6bd3 100644 --- a/evmjit/CMakeLists.txt +++ b/evmjit/CMakeLists.txt @@ -27,12 +27,14 @@ endif() # LLVM if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT LLVM_DIR) # Workaround for Ubuntu broken LLVM package - message(STATUS "Using llvm-3.7-dev package from Ubuntu. If does not work, build LLVM and set -DLLVM_DIR=llvm-build/share/llvm/cmake") - execute_process(COMMAND llvm-config-3.7 --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE) + # Ubuntu 14.04 replaced llvm3.7-dev with llvm3.8-dev in anticipation of llvm 3.7 release. + # We are forced to use the 3.8-dev package until llvm 3.7 release. TODO: Fix when 3.7 is released. + message(STATUS "Using llvm-3.8-dev package from Ubuntu. If does not work, build LLVM and set -DLLVM_DIR=llvm-build/share/llvm/cmake") + execute_process(COMMAND llvm-config-3.8 --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE) message(STATUS "LLVM include dirs: ${LLVM_INCLUDE_DIRS}") set(LLVM_LIBS "-lLLVMipo -lLLVMVectorize -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMProfileData -lLLVMInstCombine -lLLVMInstrumentation -lLLVMTransformUtils -lLLVMipa -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMTarget -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMCore -lLLVMSupport -lz -lpthread -lffi -ltinfo -ldl -lm") set(LLVM_DEFINITIONS "-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS") - link_directories(/usr/lib/llvm-3.7/lib) + link_directories(/usr/lib/llvm-3.8/lib) else() find_package(LLVM REQUIRED CONFIG) if (${LLVM_VERSION} VERSION_LESS 3.7) From 0ff32f771098e08a3ed2f696f57ea86f14977c95 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 30 Jul 2015 14:18:49 +0200 Subject: [PATCH 2/2] Detect existence of llvm 3.7 or 3.8 dev package Determine if the user has llvm3.7-dev or llvm3.8-dev package in Ubuntu and configure cmake accordingly --- evmjit/CMakeLists.txt | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/evmjit/CMakeLists.txt b/evmjit/CMakeLists.txt index 1547e6bd3..ca73c5150 100644 --- a/evmjit/CMakeLists.txt +++ b/evmjit/CMakeLists.txt @@ -27,14 +27,25 @@ endif() # LLVM if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT LLVM_DIR) # Workaround for Ubuntu broken LLVM package - # Ubuntu 14.04 replaced llvm3.7-dev with llvm3.8-dev in anticipation of llvm 3.7 release. - # We are forced to use the 3.8-dev package until llvm 3.7 release. TODO: Fix when 3.7 is released. - message(STATUS "Using llvm-3.8-dev package from Ubuntu. If does not work, build LLVM and set -DLLVM_DIR=llvm-build/share/llvm/cmake") - execute_process(COMMAND llvm-config-3.8 --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE) + find_program(LLVM3_7_CONFIG llvm-config-3.7) + find_program(LLVM3_8_CONFIG llvm-config-3.8) + if (LLVM3_7_CONFIG) + message(STATUS "Using llvm-3.7-dev package from Ubuntu. If does not work, build LLVM and set -DLLVM_DIR=llvm-build/share/llvm/cmake") + set(LLVM_CONFIG_EXEC llvm-config-3.7) + set(LLVM_LIB_DIR /usr/lib/llvm-3.7/lib) + elseif(LLVM3_8_CONFIG) + message(STATUS "Using llvm-3.8-dev package from Ubuntu. If does not work, build LLVM and set -DLLVM_DIR=llvm-build/share/llvm/cmake") + set(LLVM_CONFIG_EXEC llvm-config-3.8) + set(LLVM_LIB_DIR /usr/lib/llvm-3.8/lib) + else() + message(FATAL_ERROR "No LLVM package found!") + endif() + + execute_process(COMMAND ${LLVM_CONFIG_EXEC} --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE) message(STATUS "LLVM include dirs: ${LLVM_INCLUDE_DIRS}") set(LLVM_LIBS "-lLLVMipo -lLLVMVectorize -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMProfileData -lLLVMInstCombine -lLLVMInstrumentation -lLLVMTransformUtils -lLLVMipa -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMTarget -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMCore -lLLVMSupport -lz -lpthread -lffi -ltinfo -ldl -lm") set(LLVM_DEFINITIONS "-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS") - link_directories(/usr/lib/llvm-3.8/lib) + link_directories(${LLVM_LIB_DIR}) else() find_package(LLVM REQUIRED CONFIG) if (${LLVM_VERSION} VERSION_LESS 3.7)