Tencent / ncnn

ncnn is a high-performance neural network inference framework optimized for the mobile platform
Other
20.12k stars 4.14k forks source link

some protobuf compiler issues in tools caffe & onnx #2168

Open baryluk opened 3 years ago

baryluk commented 3 years ago
user@debian:~/ncnn/build$ cmake .. -DNCNN_VULKAN=ON
-- CMAKE_INSTALL_PREFIX = /home/user/ncnn/build/install
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Target arch: x86
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- OpenCV library: /usr
--     version: 4.2.0
--     libraries: opencv_core;opencv_highgui;opencv_imgproc;opencv_imgcodecs;opencv_videoio
--     include path: /usr/include/opencv4
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-pthread (found version "3.12.3") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/ncnn/build
user@debian:~/ncnn/build$ make -j32
tools/caffe/CMakeFiles/caffe2ncnn.dir/build.make:80: *** target pattern contains no '%'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:1140: tools/caffe/CMakeFiles/caffe2ncnn.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
tools/onnx/CMakeFiles/onnx2ncnn.dir/build.make:80: *** target pattern contains no '%'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:1194: tools/onnx/CMakeFiles/onnx2ncnn.dir/all] Error 2
...

most other tools are built fine.

It produces weird stuff in Makefile, that doesn't make much sense actually.

I believe this is because cmake only checks for the runtime protobuf library (libprotobuf), but doesn't actually look for the protocol buffer compiler.

Installing protobuf-compiler on Debian and reruning cmake from scratch, makes the build process work.

Please add checking for existence of protocol buffer compiler you are using.

xyzxyz-321 commented 3 years ago

@baryluk ,Hello, my dear friend, I also encountered your similar problem during the installation of a program. Do you have a solution? Thank you!

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed

baryluk commented 3 years ago

@xyzxyz-321 Please open a separate bug report, or full output including cmake log files. It looks you have different issue.

xyzxyz-321 commented 3 years ago

@baryluk ,Thank you for your reply. I am trying to compile and install a program called Rocstar. After executing cmake, the output is as follows:

-- The CXX compiler identification is GNU 9.3.0
-- The C compiler identification is GNU 9.3.0
-- The Fortran compiler identification is GNU 9.3.0
-- 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
-- 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 Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran  -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
-- Setting build type to 'Release' as none was specified.
-- Found MPI_C: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so (found version "3.1") 
-- Found MPI_CXX: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so (found version "3.1") 
-- Found MPI_Fortran: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_usempif08.so (found version "3.1") 
-- Found MPI: TRUE (found version "3.1")  
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - found
-- Found BLAS: /usr/lib/x86_64-linux-gnu/libblas.so  
-- Looking for Fortran cheev
-- Looking for Fortran cheev - not found
-- Looking for Fortran cheev
-- Looking for Fortran cheev - found
-- A library with LAPACK API found.
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.17") found components: doxygen dot 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/dyfluid/Rocstar-master/build

One of the lines is what I just mentioned:

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed

Then I executed make, the output is missing the'mpi.mod' file, the following is the complete output file CMakeError.log CMakeOutput.log

baryluk commented 3 years ago

@xyzxyz-321 I don't any issues. This is a correct and expected output. The Failed just means that this very specific test failed. It is not a bug or a failure. The job of cmake is to test the system capabilities. Some tests are expected to fail. As long as You see Generating done, you are good and cmake succeeded.

Just enter the build directory (cd build), and run make (make -j$(nproc)).

nihui commented 1 month ago

针对onnx模型转换的各种问题,推荐使用最新的pnnx工具转换到ncnn In view of various problems in onnx model conversion, it is recommended to use the latest pnnx tool to convert your model to ncnn

pip install pnnx
pnnx model.onnx inputshape=[1,3,224,224]

详细参考文档 Detailed reference documentation https://github.com/pnnx/pnnx https://github.com/Tencent/ncnn/wiki/use-ncnn-with-pytorch-or-onnx#how-to-use-pnnx