Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiled Opencv supported CANN errors #3900

Open
121209 opened this issue Mar 11, 2025 · 2 comments
Open

Compiled Opencv supported CANN errors #3900

121209 opened this issue Mar 11, 2025 · 2 comments

Comments

@121209
Copy link

121209 commented Mar 11, 2025

OS:

NAME="Huawei Cloud EulerOS"
VERSION="2.0 (aarch64)"
ID="hce"
VERSION_ID="2.0"
PRETTY_NAME="Huawei Cloud EulerOS 2.0 (aarch64)"
ANSI_COLOR="0;31

caNN8.0.RC2

camke code:

!cmake
-D CMAKE_BUILD_TYPE=RELEASE
-D ASCEND_CANN_PACKAGE_PATH=/data_0n1/y00836044/ascend_1.0RC2/ascend-toolkit/latest
-D CMAKE_INSTALL_PREFIX=$(pwd)/install
-D CMAKE_MODULE_PATH=../../opencv_contrib/modules/cannops/ascendc_kernels
-D WITH_DEBUG=0
-D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules
-D ADE_DIR=../../.cache/ade/ade-0.1.2e/
-D WITH_CUDA=0
-D WITH_CANN=1
-D CANN_DIR=/data_0n1/y00836044/ascend_1.0RC2/ascend-toolkit/latest
-D CANN_INCLUDE_DIR=/data_0n1/y00836044/ascend_1.0RC2/ascend-toolkit/latest/include
-D CANN_LIBRARY=/data_0n1/y00836044/ascend_1.0RC2/ascend-toolkit/latest/lib64/libascendcl.so
-D PYTHON3_EXECUTABLE={python_path}
-D PYTHON3_LIBRARY={python_library}
-D PYTHON3_INCLUDE_DIR={python_include_dir}
-D BUILD_opencv_wechat_qrcode=OFF
-D BUILD_opencv_xfeatures2d=OFF
-D BUILD_opencv_face=OFF
-D BUILD_opencv_dnn=ON
-D BUILD_opencv_features2d=ON
-D WITH_CAROTENE=OFF
-D WITH_IPP=OFF
-D WITH_JPEG=ON
-D BUILD_JPEG=OFF
-D JPEG_INCLUDE_DIR=/usr/lcocal/include
-D JPEG_LIBRARY=/usr/lcocal/lib64/libjpeg.so
-D CMAKE_PREFIX_PATH=/usr/lcocal
-D CMAKE_C_COMPILER=clang
-D WITH_GAPI=ON
-D BUILD_DOCS=ON
-D BUILD_EXAMPLES=ON
..
make -j5

Errors:

collect2: error: ld returned 1 exit status
make[2]: *** [modules/cannops/CMakeFiles/opencv_perf_cannops.dir/build.make:155: bin/opencv_perf_cannops] Error 1
make[1]: *** [CMakeFiles/Makefile2:7608: modules/cannops/CMakeFiles/opencv_perf_cannops.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 69%] Built target opencv_perf_imgproc
[ 69%] Linking CXX executable ../../bin/opencv_test_imgcodecs
[ 69%] Built target opencv_test_imgcodecs
[ 69%] Linking CXX executable ../../bin/opencv_test_imgproc
[ 69%] Linking CXX executable ../../bin/opencv_test_videoio
[ 69%] Built target opencv_test_videoio
[ 69%] Built target opencv_test_imgproc
[ 69%] Linking CXX executable ../../bin/opencv_test_calib3d
[ 69%] Built target opencv_test_calib3d
[ 69%] Linking CXX executable ../../bin/opencv_perf_core
[ 69%] Built target opencv_perf_core
[ 69%] Linking CXX executable ../../bin/opencv_test_core
[ 69%] Built target opencv_test_core
[ 69%] Linking CXX shared library ../../lib/libopencv_dnn.so
[ 69%] Built target opencv_dnn
make: *** [Makefile:166: all] Error 2

@121209
Copy link
Author

121209 commented Mar 11, 2025

my CMakeLists.txt is :

if(IOS OR WINRT OR ANDROID OR APPLE OR WIN32 OR (NOT HAVE_CANN))
ocv_module_disable(cannops)
endif()

set(the_description "Ascend-accelerated Operations on Matrices")

ocv_add_module(cannops opencv_core WRAP python)
ocv_module_include_directories(${CANN_INCLUDE_DIRS})
ocv_glob_module_sources()
ocv_install_used_external_targets(${CANN_LIBRARIES})
ocv_create_module(${CANN_LIBRARIES})

ocv_include_directories(${CMAKE_SOURCE_DIR}/modules/ts/include)

ocv_add_accuracy_tests(DEPENDS_ON opencv_cannops)
ocv_add_perf_tests(DEPENDS_ON opencv_cannops)
ocv_add_samples(opencv_cannops)

add_subdirectory(ascendc_kernels)
ocv_include_directories(${CMAKE_BINARY_DIR}/include/ascendc_kernels)
ocv_target_link_libraries(opencv_cannops PRIVATE ascendc_kernels)
ocv_target_link_libraries(opencv_test_cannops PRIVATE ascendc_kernels)

set(CANN_ROOT_DIR "/data_0n1/y00836044/ascend_1.0RC2/ascend-toolkit/latest" CACHE PATH "Path to CANN toolkit")
set(CANN_LIB_DIR "${CANN_ROOT_DIR}/lib64" CACHE PATH "Path to CANN libraries")

find_library(CANN_ASCENDCL_LIB ascendcl HINTS ${CANN_LIB_DIR})
find_library(CANN_ACL_OP_COMPILER_LIB acl_op_compiler HINTS ${CANN_LIB_DIR})
find_library(CANN_GRAPH_LIB graph HINTS ${CANN_LIB_DIR})
find_library(CANN_GE_COMPILER_LIB ge_compiler HINTS ${CANN_LIB_DIR})
find_library(CANN_GRAPH_BASE_LIB graph_base HINTS ${CANN_LIB_DIR})
find_library(CANN_ACL_DVPP_MPI_LIB acl_dvpp_mpi HINTS ${CANN_LIB_DIR})
find_library(CANN_GE_RUNNER_LIB ge_runner HINTS ${CANN_LIB_DIR})
if(NOT CANN_GE_RUNNER_LIB)
message(FATAL_ERROR "Cannot find libge_runner.so in ${CANN_LIB_DIR}")
endif()
list(APPEND CANN_LIBS ${CANN_GE_RUNNER_LIB})
find_library(PROTOBUF_LIB protobuf HINTS /usr/lib64 /usr/local/lib64)
if(NOT PROTOBUF_LIB)
message(FATAL_ERROR "Protobuf library not found")
endif()
list(APPEND CANN_LIBS ${PROTOBUF_LIB})

if(CANN_GE_RUNNER_LIB)
list(APPEND CANN_LIBS ${CANN_GE_RUNNER_LIB})
endif()

if(NOT CANN_ASCENDCL_LIB)
message(FATAL_ERROR "Cannot find libascendcl.so in ${CANN_LIB_DIR}")
endif()

set(CANN_LIBS
${CANN_ASCENDCL_LIB}
${CANN_ACL_OP_COMPILER_LIB}
${CANN_GRAPH_LIB}
${CANN_GE_COMPILER_LIB}
${CANN_GRAPH_BASE_LIB}
${CANN_ACL_DVPP_MPI_LIB}
)

if(TARGET example_cannops_image_processing)
target_link_libraries(example_cannops_image_processing
PRIVATE
opencv_cannops
${CANN_LIBS}
pthread dl rt
)
target_link_options(example_cannops_image_processing
PRIVATE
-Wl,-rpath=${CANN_LIB_DIR}
)
else()
message(WARNING "Target example_cannops_image_processing not found, skipping custom linking")
endif()

@121209
Copy link
Author

121209 commented Mar 11, 2025

HELP! HOW can I deal with this can't find os file problem but the os file can be found!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant