Digital2Slave / ncnn-android-yolov8-seg

a sample yolov8 object segment android project based on ncnn and opencv.
68 stars 8 forks source link

cannot find -lcnn during make #2

Open programmeddeath1 opened 1 year ago

programmeddeath1 commented 1 year ago

I have installed ncnn and ran the ncnn examples but while running the build on the yolov8seg.cpp, i get the following error.

[ 50%] Linking CXX executable ncnn-yolov8s-seg
/usr/bin/ld: cannot find -lncnn
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ncnn-yolov8s-seg.dir/build.make:157: ncnn-yolov8s-seg] Error 1
make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/ncnn-yolov8s-seg.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

What could be the issue here?

Digital2Slave commented 1 year ago

@programmeddeath1 It seems that the ncnn-yolov8s-seg cannot find ncnn library. Please check the following setting in CMakeLists.txt:

include_directories(/usr/local/include)
include_directories(/usr/local/include/ncnn)
link_directories(/usr/local/lib)

BTW, make sure you build and install ncnn with the following commands:

# build part
$ mkdir build && cd build
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/ ..
$ make -j$(nproc)
$ sudo make install
programmeddeath1 commented 1 year ago

Hi I have already installed ncnn on the board and it is present on /usr/local/include/ncnn.

Digital2Slave commented 1 year ago

Hi I have already installed ncnn on the board and it is present on /usr/local/include/ncnn.

You could set ncnn library in CMakeLists.txt like the following:

# Lib files
file(GLOB NCNNLIB /usr/local/lib/libncnn.a)

target_link_libraries(ncnn-yolov8s-seg  ${NCNNLIB}  ${OpenCV_LIBS})