未验证 提交 db44e8b4 编写于 作者: Q Qi Li 提交者: GitHub

[ASCEND] fix build for Ubuntu18.04 and GCC7.3, test=develop (#4397)

* [ASCEND] fix build for Ubuntu18.04 and GCC7.3, test=develop

* [ASCEND] address review comments, test=develop
上级 5c39519e
...@@ -16,6 +16,11 @@ if(NOT LITE_WITH_HUAWEI_ASCEND_NPU) ...@@ -16,6 +16,11 @@ if(NOT LITE_WITH_HUAWEI_ASCEND_NPU)
return() return()
endif() endif()
# require -D_GLIBCXX_USE_CXX11_ABI=0 if GCC 7.3.0
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
# 1. path to Huawei Ascend Install Path # 1. path to Huawei Ascend Install Path
if(NOT DEFINED HUAWEI_ASCEND_NPU_DDK_ROOT) if(NOT DEFINED HUAWEI_ASCEND_NPU_DDK_ROOT)
set(HUAWEI_ASCEND_NPU_DDK_ROOT $ENV{HUAWEI_ASCEND_NPU_DDK_ROOT}) set(HUAWEI_ASCEND_NPU_DDK_ROOT $ENV{HUAWEI_ASCEND_NPU_DDK_ROOT})
......
...@@ -217,6 +217,10 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST) ...@@ -217,6 +217,10 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
SET(OPTIONAL_ARGS ${OPTIONAL_ARGS} "-DCMAKE_GENERATOR_PLATFORM=x64") SET(OPTIONAL_ARGS ${OPTIONAL_ARGS} "-DCMAKE_GENERATOR_PLATFORM=x64")
ENDIF() ENDIF()
IF(LITE_WITH_HUAWEI_ASCEND_NPU)
SET(OPTIONAL_ARGS ${OPTIONAL_ARGS} "-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")
ENDIF()
if(LITE_WITH_LIGHT_WEIGHT_FRAMEWORK) if(LITE_WITH_LIGHT_WEIGHT_FRAMEWORK)
ExternalProject_Add( ExternalProject_Add(
${TARGET_NAME} ${TARGET_NAME}
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include <cmath>
#include "lite/core/subgraph_bridge_registry.h" #include "lite/core/subgraph_bridge_registry.h"
#include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h"
#include "lite/kernels/huawei_ascend_npu/bridges/utility.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h"
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include <cmath>
#include "lite/core/subgraph_bridge_registry.h" #include "lite/core/subgraph_bridge_registry.h"
#include "lite/kernels/huawei_ascend_npu/bridges/graph.h" #include "lite/kernels/huawei_ascend_npu/bridges/graph.h"
#include "lite/kernels/huawei_ascend_npu/bridges/utility.h" #include "lite/kernels/huawei_ascend_npu/bridges/utility.h"
......
...@@ -372,7 +372,7 @@ function make_x86 { ...@@ -372,7 +372,7 @@ function make_x86 {
build_directory=$BUILD_DIR/build.lite.x86 build_directory=$BUILD_DIR/build.lite.x86
if [ ${WITH_HUAWEI_ASCEND_NPU} == "ON" ]; then if [ ${WITH_HUAWEI_ASCEND_NPU} == "ON" ]; then
export CXX=/usr/bin/g++ # Ascend need g++ in centos export CXX=g++ # Huawei Ascend NPU need g++
build_directory=$BUILD_DIR/build.lite.huawei_ascend_npu build_directory=$BUILD_DIR/build.lite.huawei_ascend_npu
fi fi
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册