diff --git a/.gitignore b/.gitignore index a2fa26ff55..22279d6db2 100644 --- a/.gitignore +++ b/.gitignore @@ -432,4 +432,4 @@ screen.png adb_screen.png tools/*.png resource/infrast -.vscode/settings.json +.vscode diff --git a/CMakeLists.txt b/CMakeLists.txt index f1241acef4..39bc4209b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,11 +27,13 @@ find_library(MeoJson_LIB NAMES meojson PATHS 3rdparty/lib) if (WIN32) find_library(OpenCV NAMES opencv_world453 PATHS 3rdparty/lib) + find_library(ZLIB NAMES zlibstatic PATHS 3rdparty/lib) else () find_package(OpenCV REQUIRED) + find_package(ZLIB REQUIRED) endif () -target_link_libraries(MeoAssistant ${OpenCV} ${PaddleOCR_LIB} ${Penguin_LIB} ${MeoJson_LIB}) +target_link_libraries(MeoAssistant ${OpenCV} ${PaddleOCR_LIB} ${Penguin_LIB} ${MeoJson_LIB} ${ZLIB}) if (BUILD_TEST) add_executable(test tools/TestCaller/main.cpp) diff --git a/docs/Linux编译教程.md b/docs/Linux编译教程.md index 89d3e0e546..a61ab90ccf 100644 --- a/docs/Linux编译教程.md +++ b/docs/Linux编译教程.md @@ -10,7 +10,7 @@ ### Opencv -请自行搜索教程安装,没什么特别的,作者当前成功验证过的版本为`4.5.3`版本,其他版本应该也没什么问题。仅`Opencv`本体即可,不需要额外安装`opencv_contrib`。 +请自行搜索教程安装,没什么特别的,作者当前成功验证过的版本为`4.5.3`版本。其他版本应该也可以,但仍然推荐使用`4.5.3`版本,与项目保持一致,避免一些不必要的问题。仅`Opencv`本体即可,不需要额外安装`opencv_contrib`。 ### PaddleOCR @@ -39,6 +39,16 @@ make shared 使用我魔改了接口的版本:https://github.com/MistEO/penguin-stats-recognize-v3 +### zlib + +Ubuntu 下: +```bash +sudo apt update && sudo apt install zlib1g-dev +sudo ldconfig +``` + +其他发行版若源中没有 zlib, 也可尝试通过 [源码](https://github.com/madler/zlib) 编译 + ## MeoAssistant 1. 直接拷贝上面编译的第三方库到 `3rdparty/lib` 或者 手动修改 `CMakeLists.txt` 指定第三方库路径 diff --git a/src/MeoAssistant/AbstractTask.h b/src/MeoAssistant/AbstractTask.h index aa94f09f6f..54d0d69ab4 100644 --- a/src/MeoAssistant/AbstractTask.h +++ b/src/MeoAssistant/AbstractTask.h @@ -26,7 +26,7 @@ namespace asst void set_task_chain(std::string name) noexcept { m_task_chain = std::move(name); } const std::string& get_task_chain() const noexcept { return m_task_chain; } - constexpr static int RetryTimesDefault = 20; + constexpr static int RetryTimesDefault = 50; protected: virtual bool _run() = 0; virtual bool on_run_fails() { return true; } diff --git a/src/MeoAssistant/Assistant.h b/src/MeoAssistant/Assistant.h index fcffb566ae..c709e03c45 100644 --- a/src/MeoAssistant/Assistant.h +++ b/src/MeoAssistant/Assistant.h @@ -76,7 +76,7 @@ namespace asst [[deprecated]] bool set_param(const std::string& type, const std::string& param, const std::string& value); - static constexpr int ProcessTaskRetryTimesDefault = 50; + static constexpr int ProcessTaskRetryTimesDefault = AbstractTask::RetryTimesDefault; static constexpr int OpenRecruitTaskRetryTimesDefault = 20; static constexpr int AutoRecruitTaskRetryTimesDefault = 10; diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index af237c8a7e..4106fa5d61 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -61,6 +61,9 @@ asst::Controller::Controller() #endif m_pipe_buffer = std::make_unique(PipeBuffSize); + if (!m_pipe_buffer) { + throw "controller pipe buffer allocated failed"; + } auto bind_pipe_working_proc = std::bind(&Controller::pipe_working_proc, this); m_cmd_thread = std::thread(bind_pipe_working_proc); @@ -447,11 +450,11 @@ std::pair> asst::Controller::call_command(const // parent process // LogTraceScope("Parent process: " + cmd); do { - ssize_t read_num = read(m_pipe_out[PIPE_READ], m_pipe_buffer.get(), BuffSize); + ssize_t read_num = read(m_pipe_out[PIPE_READ], m_pipe_buffer.get(), PipeBuffSize); while (read_num > 0) { pipe_data.insert(pipe_data.end(), m_pipe_buffer.get(), m_pipe_buffer.get() + read_num); - read_num = read(m_pipe_out[PIPE_READ], m_pipe_buffer.get(), BuffSize); + read_num = read(m_pipe_out[PIPE_READ], m_pipe_buffer.get(), PipeBuffSize); }; } while (::waitpid(m_child, nullptr, WNOHANG) == 0); }