kaylorchen / rk3588-yolo-demo

The project is a multi-threaded inference demo of Yolo running on the RK3588 platform, which has been adapted for reading video files and camera feeds. The demo uses the Yolov8n model for file inference, with a maximum inference frame rate of up to 100 frames per second.
MIT License
196 stars 26 forks source link

compile error 编译失败 #19

Closed Liablbility closed 2 months ago

Liablbility commented 2 months ago

请问我为啥编译失败啊 Why am I couldn't compile it (base) liable@liable-G3:~/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/build$ cmake -DCMAKE_TOOLCHAIN_FILE=/home/liable/Documents/RKNN/rk3588_dev_rootfs/toolchain-aarch64.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..

-- The C compiler identification is GNU 6.3.1 -- The CXX compiler identification is GNU 6.3.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /home/liable/Documents/RKNN/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc - 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: /home/liable/Documents/RKNN/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found OpenCV: /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr (found version "4.5.4") -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
-- Configuring done -- Generating done -- Build files have been written to: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/build

(base) liable@liable-G3:~/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/build$ make

[ 7%] Building CXX object utils/CMakeFiles/yolov8-kaylordut.dir/camera.cpp.o In file included from /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/camera.cpp:5:0: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/include/camera.h: In constructor ‘Camera::Camera(uint16t, cv::Size, double)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/include/camera.h:16:20: warning: ‘Camera::capture’ will be initialized after [-Wreorder] cv::VideoCapture capture; ^~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/include/camera.h:15:12: warning: ‘cv::Size Camera::size’ [-Wreorder] cv::Size size_; ^~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/camera.cpp:10:1: warning: when initialized here [-Wreorder] Camera::Camera(uint16_t index, cv::Size size, double framerate) ^~ [ 15%] Building CXX object utils/CMakeFiles/yolov8-kaylordut.dir/image_process.cpp.o In file included from /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/eigen3/Eigen/Core:162:0, from /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/dataType.h:6, from /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/kalmanFilter.h:3, from /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/STrack.h:4, from /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/BYTETracker.h:3, from /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/include/image_process.h:6, from /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp:5: /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/eigen3/Eigen/src/Core/util/Meta.h:504:25: error: ‘invoke_result’ in namespace ‘std’ does not name a template type typedef typename std::invoke_result<F, ArgTypes...>::type type1; ^~~~~ /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/eigen3/Eigen/src/Core/util/Meta.h:504:38: error: expected unqualified-id before ‘<’ token typedef typename std::invoke_result<F, ArgTypes...>::type type1; ^ /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/eigen3/Eigen/src/Core/util/Meta.h:505:31: error: ‘type1’ was not declared in this scope typedef typename remove_all::type type; ^~~~~ /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/eigen3/Eigen/src/Core/util/Meta.h:505:36: error: template argument 1 is invalid typedef typename remove_all::type type; ^ In file included from /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/eigen3/Eigen/Core:162:0, from /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/dataType.h:6, from /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/kalmanFilter.h:3, from /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/STrack.h:4, from /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/BYTETracker.h:3, from /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/include/image_process.h:6, from /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp:5: /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/eigen3/Eigen/src/Core/util/Meta.h:616:25: error: ‘invoke_result’ in namespace ‘std’ does not name a template type typedef typename std::invoke_result<F, ArgTypes...>::type type1; ^~~~~ /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/eigen3/Eigen/src/Core/util/Meta.h:616:38: error: expected unqualified-id before ‘<’ token typedef typename std::invoke_result<F, ArgTypes...>::type type1; ^ /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/eigen3/Eigen/src/Core/util/Meta.h:617:31: error: ‘type1’ was not declared in this scope typedef typename remove_all::type type; ^~~~~ /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr/include/eigen3/Eigen/src/Core/util/Meta.h:617:36: error: template argument 1 is invalid typedef typename remove_all::type type; ^ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp: In member function ‘std::unique_ptr ImageProcess::Convert(const cv::Mat&)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp:51:12: warning: the compiler can assume that the address of ‘src’ will never be NULL [-Waddress] if (&src == nullptr) {


/home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp: In member function ‘void ImageProcess::ImagePostProcess(cv::Mat&, object_detect_result_list&)’:
/home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp:73:9: warning: unused variable ‘cls_id’ [-Wunused-variable]
     int cls_id = od_results.results[0].cls_id;
         ^~~~~~
make[2]: *** [utils/CMakeFiles/yolov8-kaylordut.dir/build.make:90: utils/CMakeFiles/yolov8-kaylordut.dir/image_process.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:182: utils/CMakeFiles/yolov8-kaylordut.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
kaylorchen commented 2 months ago

你的用的交叉编译工具链有问题

Liablbility commented 2 months ago

我电脑里倒是有两个 交叉编译工具 当前用的是rknn给的工具链 https://releases.linaro.org/components/toolchain/binaries/6.3 2017.05/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz
然后还有一个是 apt 安装的 工具链
我应该用后者吗 还是 其他版本的工具链呢

kaylorchen commented 2 months ago

用apt的

Liablbility commented 2 months ago

好的,谢谢指导 已经编译成功 (base) liable@liable-G3:~/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/build$ cmake -DCMAKE_TOOLCHAIN_FILE=/home/liable/Documents/RKNN/rk3588_dev_rootfs/toolchain-aarch64.cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. -- The C compiler identification is GNU 11.4.0 -- The CXX compiler identification is GNU 11.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/aarch64-linux-gnu-gcc - 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/aarch64-linux-gnu-g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found OpenCV: /home/liable/Documents/RKNN/rk3588_dev_rootfs/rootfs/usr (found version "4.5.4") -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
-- Configuring done -- Generating done -- Build files have been written to: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/build (base) liable@liable-G3:~/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/build$ make [ 7%] Building CXX object utils/CMakeFiles/yolov8-kaylordut.dir/camera.cpp.o In file included from /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/camera.cpp:5: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/include/camera.h: In constructor ‘Camera::Camera(uint16t, cv::Size, double)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/include/camera.h:16:20: warning: ‘Camera::capture’ will be initialized after [-Wreorder] 16 | cv::VideoCapture capture; | ^~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/include/camera.h:15:12: warning: ‘cv::Size Camera::size’ [-Wreorder] 15 | cv::Size size_; | ^~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/camera.cpp:10:1: warning: when initialized here [-Wreorder] 10 | Camera::Camera(uint16_t index, cv::Size size, double framerate) | ^~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/camera.cpp: In member function ‘std::unique_ptr Camera::GetNextFrame()’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/camera.cpp:51:19: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move] 51 | return std::move(frame); | ~~~^~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/camera.cpp:51:19: note: remove ‘std::move’ call [ 15%] Building CXX object utils/CMakeFiles/yolov8-kaylordut.dir/image_process.cpp.o /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp: In member function ‘std::unique_ptr ImageProcess::Convert(const cv::Mat&)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp:51:12: warning: the compiler can assume that the address of ‘src’ will never be NULL [-Waddress] 51 | if (&src == nullptr) { | ~^~~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp:61:19: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move] 61 | return std::move(square_img); | ~~~^~~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp:61:19: note: remove ‘std::move’ call /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp: In member function ‘void ImageProcess::ImagePostProcess(cv::Mat&, object_detect_result_list&)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp:73:9: warning: unused variable ‘cls_id’ [-Wunused-variable] 73 | int cls_id = od_results.results[0].cls_id; | ^~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp: In member function ‘std::unique_ptr ImageProcess::Convert(const cv::Mat&)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/image_process.cpp:51:3: warning: ‘nonnull’ argument ‘src’ compared to NULL [-Wnonnull-compare] 51 | if (&src == nullptr) { | ^~ [ 23%] Building CXX object utils/CMakeFiles/yolov8-kaylordut.dir/postprocess.cpp.o /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp: In function ‘void matmul_by_npu_i8(std::vector&, float, uint8_t, int, int, int, rknn_app_context_t)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp:299:7: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] 299 | int ret = rknn_matmul_create(&ctx, &info, &io_attr); | ^~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp: In function ‘void matmul_by_npu_fp16(std::vector&, float, uint8_t, int, int, int, rknn_app_context_t)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp:369:7: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] 369 | int ret = rknn_matmul_create(&ctx, &info, &io_attr); | ^~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp: In function ‘int process_i8(rknn_output, int, int, int, int, int, int, int, std::vector&, std::vector&, float, std::vector&, std::vector&, float, rknn_app_context_t)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp:551:9: warning: unused variable ‘seg_scale’ [-Wunused-variable] 551 | float seg_scale = app_ctx->output_attrs[input_id + 3].scale; | ^~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp: In function ‘int post_process_seg(rknn_app_context_t, rknn_output, letterbox_t, float, float, object_detect_result_list)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp:739:7: warning: unused variable ‘output_per_branch’ [-Wunused-variable] 739 | int output_per_branch = app_ctx->io_num.n_output / 3; // default 3 branch | ^~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp: In function ‘int process_i8_pose(int8_t, int32_t, float, int8_t, int32_t, float, int8_t, int32_t, float, int8_t, int32_t, float, int, int, int, int, std::vector&, std::vector&, std::vector&, std::vector&, float)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp:989:11: warning: variable ‘max_class_id’ set but not used [-Wunused-but-set-variable] 989 | int max_class_id = -1; | ^~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp: In function ‘int post_process_obb(rknn_app_context_t, rknn_output, letterbox_t, float, float, object_detect_result_list)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/postprocess.cpp:1518:7: warning: unused variable ‘model_in_w’ [-Wunused-variable] 1518 | int model_in_w = app_ctx->model_width; | ^~~~~~ [ 30%] Building CXX object utils/CMakeFiles/yolov8-kaylordut.dir/rknn_pool.cpp.o /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/rknn_pool.cpp: In member function ‘int RknnPool::get_model_id()’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/rknn_pool.cpp:69:10: warning: comparison of integer expressions of different signedness: ‘uint32_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare] 69 | if (id == threadnum) { | ~^~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/rknn_pool.cpp: In member function ‘std::shared_ptr RknnPool::GetImageResultFromQueue()’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/rknn_pool.cpp:84:21: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move] 84 | return std::move(res); | ~~~^~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/rknn_pool.cpp:84:21: note: remove ‘std::move’ call [ 38%] Building CXX object utils/CMakeFiles/yolov8-kaylordut.dir/videofile.cpp.o /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/videofile.cpp: In member function ‘std::unique_ptr VideoFile::GetNextFrame()’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/videofile.cpp:53:19: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move] 53 | return std::move(frame); | ~~~^~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/videofile.cpp:53:19: note: remove ‘std::move’ call [ 46%] Building CXX object utils/CMakeFiles/yolov8-kaylordut.dir/yolov8.cpp.o /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/yolov8.cpp: In function ‘int read_data_from_file(const char, char)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/yolov8.cpp:35:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare] 35 | if (file_size != fread(data, 1, file_size, fp)) { | ~~^~~~~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/yolov8.cpp: In member function ‘int Yolov8::Init(rknn_context, bool)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/yolov8.cpp:127:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] 127 | for (int i = 0; i < io_num.n_input; i++) { | ^~~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/yolov8.cpp:149:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] 149 | for (int i = 0; i < io_num.n_output; i++) { | ^~~~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/yolov8.cpp: In member function ‘int Yolov8::Inference(void, object_detect_result_list, letterbox_t)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/yolov8.cpp:259:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] 259 | for (int i = 0; i < appctx.io_num.n_output; ++i) { | ^~~~~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/yolov8.cpp: In member function ‘int Yolov8::Init(rknn_context, bool)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/utils/yolov8.cpp:98:27: warning: ‘core_mask’ may be used uninitialized in this function [-Wmaybe-uninitialized] 98 | ret = rknn_set_coremask(ctx, core_mask); | ~~~~^~~~~~~ [ 53%] Linking CXX static library libyolov8-kaylordut.a [ 53%] Built target yolov8-kaylordut [ 61%] Building CXX object CMakeFiles/videofile_demo.dir/videofile_demo.cpp.o [ 69%] Linking CXX executable videofile_demo [ 69%] Built target videofile_demo [ 76%] Building CXX object CMakeFiles/camera_demo.dir/camera_demo.cpp.o [ 84%] Linking CXX executable camera_demo [ 84%] Built target camera_demo [ 92%] Building CXX object CMakeFiles/imagefile_demo.dir/imagefile_demo.cpp.o /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/imagefile_demo.cpp: In function ‘int main(int, char)’: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/imagefile_demo.cpp:94:11: warning: unused variable ‘running_flag’ [-Wunused-variable] 94 | uint8_t running_flag = 0; | ^~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/imagefile_demo.cpp:96:14: warning: unused variable ‘image_count’ [-Wunused-variable] 96 | static int image_count = 0; | ^~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/imagefile_demo.cpp:97:14: warning: unused variable ‘image_res_count’ [-Wunused-variable] 97 | static int image_res_count = 0; | ^~~~~~~ /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/imagefile_demo.cpp: At global scope: /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/imagefile_demo.cpp:97:14: warning: ‘image_res_count’ defined but not used [-Wunused-variable] /home/liable/Documents/YoloV8Pose/rk3588-yolo-demo/src/yolov8/imagefile_demo.cpp:96:14: warning: ‘image_count’ defined but not used [-Wunused-variable] 96 | static int image_count = 0; | ^~~ [100%] Linking CXX executable imagefile_demo [100%] Built target imagefile_demo