CMake同时链接ACL库和mxVision报错
收藏回复举报
CMake同时链接ACL库和mxVision报错
t('forum.solved') 已解决
发表于2024-07-10 09:15:35
0 查看

CMakeLists.txt内容如下:

cmake_minimum_required(VERSION 3.11)

# project information
project(simpleAscend)

set(SAMPLE_NAME mindXTest)

set(MX_SDK_HOME $ENV{MX_SDK_HOME})      

if (NOT DEFINED ENV{MX_SDK_HOME})      
  string(REGEX REPLACE "(.*)/(.*)/(.*)/(.*)" "\\1" MX_SDK_HOME  ${CMAKE_CURRENT_SOURCE_DIR})
  message(STATUS "set default MX_SDK_HOME: ${MX_SDK_HOME}")
else ()
  message(STATUS "env MX_SDK_HOME: ${MX_SDK_HOME}")
endif()

# Compile options
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)  
add_definitions(-Dgoogle=mindxsdk_private)      
add_compile_options(-std=c++17 -fPIC -fstack-protector-all -Wall)   

#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})       
set(CMAKE_CXX_FLAGS_DEBUG "-g")                           
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now,-z,noexecstack -s -pie")
set(CMAKE_SKIP_RPATH TRUE)

# Header path  
include_directories(
  ${PROJECT_SOURCE_DIR}/include
  ${OpenCV_INCLUDE_DIRS}
  ${FREETYPE_DIR}
  ${MX_SDK_HOME}/include/     
  ${MX_SDK_HOME}/opensource/include/
)

 #add host lib path   
link_directories(
  ${MX_SDK_HOME}/lib/
  ${MX_SDK_HOME}/lib/modelpostprocessors/
  ${MX_SDK_HOME}/opensource/lib/
  ${MX_SDK_HOME}/opensource/lib64/
  $ENV{INSTALL_DIR}/runtime/lib64/stub/
  $ENV{THIRDPART_PATH}/lib/
)

add_executable(${SAMPLE_NAME} test2.cpp)
target_link_libraries(${SAMPLE_NAME} 
ascendcl acl_cblas acl_dvpp 
glog mxbase plugintoolkit mxpidatatype streammanager cpprest mindxsdk_protobuf)

出现报错:

/usr/bin/ld: /home/zzx/tools/MindX_SDK/mxVision/lib/libmxbase.so: undefined reference to `ge::InferShapeFuncRegister::InferShapeFuncRegister(char const*, std::function<unsigned int (ge::Operator&)> const&)'
/usr/bin/ld: /usr/local/Ascend/ascend-toolkit/latest/lib64/libdvpp_op_base.so: undefined reference to `gert::RuntimeAttrs::GetPointerByIndex(unsigned long) const'
/usr/bin/ld: /home/zzx/tools/MindX_SDK/mxVision/lib/libmxbase.so: undefined reference to `ge::Operator::GetOutputDescByName(char const*) const'
/usr/bin/ld: /home/zzx/tools/MindX_SDK/mxVision/lib/libmxbase.so: undefined reference to `ge::Operator::UpdateOutputDesc(char const*, ge::TensorDesc const&)'
/usr/bin/ld: /usr/local/Ascend/ascend-toolkit/latest/lib64/libdvpp_op_base.so: undefined reference to `ge::GeTensorDesc::GetFormat() const'
/usr/bin/ld: /home/zzx/tools/MindX_SDK/mxVision/lib/libmxbase.so: undefined reference to `ge::TensorDesc::GetShape() const'
/usr/bin/ld: /usr/local/Ascend/ascend-toolkit/latest/lib64/libdvpp_op_base.so: undefined reference to `ge::OpDesc::GetAllInputsSize() const'
/usr/bin/ld: /home/zzx/tools/MindX_SDK/mxVision/lib/libmxbase.so: undefined reference to `ge::TensorDesc::SetShape(ge::Shape const&)'
/usr/bin/ld: /usr/local/Ascend/ascend-toolkit/latest/lib64/libdvpp_op_base.so: undefined reference to `ge::OpDesc::GetOutputDesc(unsigned int) const'
/usr/bin/ld: /usr/local/Ascend/ascend-toolkit/latest/lib64/libdvpp_op_base.so: undefined reference to `gert::RuntimeAttrs::GetAttrNum() const'
/usr/bin/ld: /usr/local/Ascend/ascend-toolkit/latest/lib64/libdvpp_op_base.so: undefined reference to `ge::OpDesc::GetInputDesc(unsigned int) const'
/usr/bin/ld: /home/zzx/tools/MindX_SDK/mxVision/lib/libmxbase.so: undefined reference to `ge::Operator::GetInputDesc(unsigned int) const'
/usr/bin/ld: /home/zzx/tools/MindX_SDK/mxVision/lib/libmxbase.so: undefined reference to `ge::TensorDesc::SetFormat(ge::Format)'
/usr/bin/ld: /home/zzx/tools/MindX_SDK/mxVision/lib/libmxbase.so: undefined reference to `ge::Shape::GetDims() const'
/usr/bin/ld: /home/zzx/tools/MindX_SDK/mxVision/lib/libmxbase.so: undefined reference to `ge::TensorDesc::SetDataType(ge::DataType)'
/usr/bin/ld: /usr/local/Ascend/ascend-toolkit/latest/lib64/libdvpp_op_base.so: undefined reference to `ge::OpDesc::GetType() const'
/usr/bin/ld: /usr/local/Ascend/ascend-toolkit/latest/lib64/libdvpp_op_base.so: undefined reference to `ge::GeTensorDesc::GetShape() const'
/usr/bin/ld: /usr/local/Ascend/ascend-toolkit/latest/lib64/libdvpp_op_base.so: undefined reference to `ge::GeTensorDesc::GetOriginShape() const'
/usr/bin/ld: /usr/local/Ascend/ascend-toolkit/latest/lib64/libdvpp_op_base.so: undefined reference to `ge::GeShape::GetDim(unsigned long) const'
/usr/bin/ld: /home/zzx/tools/MindX_SDK/mxVision/lib/libmxbase.so: undefined reference to `ge::Shape::Shape(std::vector<long, std::allocator<long> > const&)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

mindXSDK相关的库不能和ACL库一起链接吗?

本帖最后由 匿名用户2024/12/05 17:29:58 编辑

我要发帖子