From fa172f41af87510d48b508ea880c2828d2eaf2c4 Mon Sep 17 00:00:00 2001 From: mahxn0 <1262384588@qq.com> Date: Tue, 8 Oct 2024 14:58:32 +0800 Subject: [PATCH] [Feature](mlu-ops):fix sample compile. (#1093) --- CMakeLists.txt | 3 +++ samples/mlu-ops/build.sh | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 81fd4caf3..c7d1909b2 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,6 +192,9 @@ bang_add_library(mluops SHARED ${src_files} ${src_helper_files}) if(${MLUOP_BUILD_STATIC} MATCHES "ON") message("-- Build MLUOP static") bang_add_library(mluops_static STATIC ${src_files} ${src_helper_files} ${core_src_files}) + if (TARGET fmt::fmt-header-only) + target_link_libraries(mluops_static fmt::fmt-header-only) + endif() endif() target_link_libraries(mluops diff --git a/samples/mlu-ops/build.sh b/samples/mlu-ops/build.sh index eaf7d210e..8b0987113 100755 --- a/samples/mlu-ops/build.sh +++ b/samples/mlu-ops/build.sh @@ -2,17 +2,17 @@ #check compiler version and consider activate devtoolset for CentOS 7 if [ "$OS_RELEASE_ID" = "centos" -a "$OS_RELEASE_VERSION_ID" = "7" ]; then - if [ ! -f "/opt/rh/devtoolset-7/enable" ]; then - echo "You are using CentOS 7 but without 'devtoolset-7' installed." + if [ ! -f "/opt/rh/devtoolset-8/enable" ]; then + echo "You are using CentOS 8 but without 'devtoolset-7' installed." echo "You should use docker image, or prepare devtoolset-7 by yourself." sleep 1 # I hope user will see it fi fi if [[ "$(g++ --version | head -n1 | awk '{ print $3 }' | cut -d '.' -f1)" < "5" ]]; then - echo "we do not support g++<5, try to activate devtoolset-7 env" - source /opt/rh/devtoolset-7/enable && echo "devtoolset-7 activated" \ - || ( echo "source devtoolset-7 failed, ignore this info if you have set env TOOLCHAIN_ROOT, TARGET_C_COMPILER, TARGET_CXX_COMPILER properly (see more details in README.md)" && sleep 4 ) # I hope user will see it + echo "we do not support g++<5, try to activate devtoolset-8 env" + source /opt/rh/devtoolset-8/enable && echo "devtoolset-8 activated" \ + || ( echo "source devtoolset-8 failed, ignore this info if you have set env TOOLCHAIN_ROOT, TARGET_C_COMPILER, TARGET_CXX_COMPILER properly (see more details in README.md)" && sleep 4 ) # I hope user will see it fi SCRIPT_DIR=`dirname $0`