nanodet icon indicating copy to clipboard operation
nanodet copied to clipboard

build demo_ncnn in linux error(Target "nanodet_demo" links to target "OpenMP::OpenMP_CXX" but the target was not found)

Open aidemHJC opened this issue 3 years ago • 1 comments

Dear author: thanks for you code. I did follow your readme.md in linux only skip the step2, and the cmake logs is:

xxx@xxx-System-Product-Name:~/freespace/nanodet-main/demo_ncnn$ mkdir build xxx@xxx-System-Product-Name:~/freespace/nanodet-main/demo_ncnn$ cd build/ xxx@xxx-System-Product-Name:~/freespace/nanodet-main/demo_ncnn/build$ cmake .. -- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Try OpenMP C flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Try OpenMP CXX flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Found OpenMP: -fopenmp
OPENMP FOUND -- Found OpenCV: /usr/local/opencv3 (found version "3.4.16") -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - found -- Found Threads: TRUE
ncnn FOUND -- Configuring done CMake Error at CMakeLists.txt:31 (add_executable): Target "nanodet_demo" links to target "OpenMP::OpenMP_CXX" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?

CMake Error at CMakeLists.txt:31 (add_executable): CXX_STANDARD is set to invalid value '17'

-- Generating done -- Build files have been written to: /home/xxx/freespace/nanodet-main/demo_ncnn/build

======================== my cmake version is 3.5, ubuntu16.04

thanks

aidemHJC avatar Feb 14 '22 09:02 aidemHJC

add my cmakelist.txt

cmake_minimum_required(VERSION 3.4.1) set(CMAKE_CXX_STANDARD 17)

project(nanodet_demo) set(OpenCV_DIR /usr/local/opencv3/share/OpenCV/)

find_package(OpenMP REQUIRED) if(OPENMP_FOUND) message("OPENMP FOUND") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") endif()

find_package(OpenCV REQUIRED)

find_package(ncnn REQUIRED) if(NOT TARGET ncnn) message(WARNING "ncnn NOT FOUND! Please set ncnn_DIR environment variable") else() message("ncnn FOUND ") endif()

include_directories( ${OpenCV_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )

add_executable(nanodet_demo main.cpp nanodet.cpp)

target_link_libraries( nanodet_demo ncnn ${OpenCV_LIBS} )

aidemHJC avatar Feb 14 '22 09:02 aidemHJC