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

compilation problem #16

Open
yidasahe92905 opened this issue May 21, 2023 · 0 comments
Open

compilation problem #16

yidasahe92905 opened this issue May 21, 2023 · 0 comments

Comments

@yidasahe92905
Copy link

Dear shouxieai,

I encountered an issue while using your document and I'm seeking your assistance to resolve it. The details are as follows:

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
project(pro)
add_definitions(-std=c++11)

option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/workspace)

set(CUDA_GEN_CODE "-gencode=arch=compute_72,code=sm_72")

set(OpenCV_DIR "/usr/local/include/opencv4/")
set(CUDA_DIR "/usr/local/cuda-10.2")
set(TENSORRT_INCLUDE_DIR "/usr/include/aarch64-linux-gnu")
set(TENSORRT_LIB_DIR "/usr/lib/aarch64-linux-gnu")

find_package(CUDA REQUIRED)
find_package(OpenCV)

include_directories(
${PROJECT_SOURCE_DIR}/src
${OpenCV_INCLUDE_DIRS}
${CUDA_DIR}
${TENSORRT_INCLUDE_DIR}
)

link_directories(
${TENSORRT_INCLUDE_DIR}/lib
${CUDA_DIR}/lib64
)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -O0 -Wfatal-errors -pthread -w -g")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++11 -O0 -Xcompiler -fPIC -g -w ${CUDA_GEN_CODE}")
file(GLOB_RECURSE cpp_srcs ${PROJECT_SOURCE_DIR}/src/.cpp)
file(GLOB_RECURSE cuda_srcs ${PROJECT_SOURCE_DIR}/src/
.cu)
cuda_add_library(cucodes SHARED ${cuda_srcs})

add_executable(pro ${cpp_srcs})

target_link_libraries(cucodes nvinfer nvonnxparser)
target_link_libraries(cucodes cuda cublas cudart cudnn)
target_link_libraries(pro ${OpenCV_LIBS})
target_link_libraries(pro cucodes)

add_custom_target(
run
DEPENDS pro
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/workspace
COMMAND ./pro
)

error:

CMakeFiles/pro.dir/src/main.cpp.o: In function single_inference()': /infer/src/main.cpp:107: undefined reference to yolo::Infer::forward(yolo::Image const&, void*)'
collect2: error: ld returned 1 exit status
CMakeFiles/pro.dir/build.make:165: recipe for target '../workspace/pro' failed

I appreciate your guidance and valuable resources.

Sincerely,
yidasahe92905

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