From 72de6eb0046fd86d95426db8e35e76ca62b7b648 Mon Sep 17 00:00:00 2001 From: gongsu832 Date: Thu, 16 Apr 2020 02:38:52 -0400 Subject: [PATCH] Fix check-onnx-backend build on x86 Linux. (#91) --- MLIR.cmake | 2 +- src/Runtime/CMakeLists.txt | 4 +++- test/backend/CMakeLists.txt | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/MLIR.cmake b/MLIR.cmake index c9c5198..873c480 100644 --- a/MLIR.cmake +++ b/MLIR.cmake @@ -62,7 +62,7 @@ function(find_mlir_lib lib) PATHS ${LLVM_PROJECT_LIB} NO_DEFAULT_PATH) if(${${lib}} STREQUAL ${lib}-NOTFOUND) - message(FATAL_ERROR "${lib} not found") + message(FATAL_ERROR "${lib} not found, did you forget to build llvm-project?") endif() endfunction(find_mlir_lib) diff --git a/src/Runtime/CMakeLists.txt b/src/Runtime/CMakeLists.txt index 7cc2a91..d091d70 100644 --- a/src/Runtime/CMakeLists.txt +++ b/src/Runtime/CMakeLists.txt @@ -1,4 +1,6 @@ -add_library(cruntime +# Create shared libcruntime.so since model.so linkage for backend tests +# will fail on x86 Linux if cruntime is statically linked. +add_library(cruntime SHARED DynMemRef.cpp DynMemRef.h DataType.h) diff --git a/test/backend/CMakeLists.txt b/test/backend/CMakeLists.txt index a370170..39075b3 100644 --- a/test/backend/CMakeLists.txt +++ b/test/backend/CMakeLists.txt @@ -3,7 +3,7 @@ configure_file(test_config.py.in test_config.py) find_package(PythonInterp 3 REQUIRED) add_custom_target(check-onnx-backend - COMMAND ${PYTHON_EXECUTABLE} + COMMAND LD_PRELOAD=${CMAKE_BINARY_DIR}/lib/libcruntime.so ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/test.py) add_dependencies(check-onnx-backend onnx-mlir)