Skip to content

Commit

Permalink
[Feature](mlu-ops):fix sample compile. (#1093)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahxn0 authored Oct 8, 2024
1 parent 2a7f8a1 commit fa172f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions samples/mlu-ops/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit fa172f4

Please sign in to comment.