### Installing Xcode Command Line Tools (Shell) Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_LIB.md This command installs the Xcode Command Line Tools, which are essential for compiling native code on macOS. It provides compilers, debuggers, and other development tools required for the build process. ```shell xcode-select –install ``` -------------------------------- ### Installing libomp on macOS (Shell) Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_LIB.md This command uses Homebrew to install `libomp`, an OpenMP runtime library. `libomp` is a dependency for certain optimizations and parallel processing capabilities used by the OCR libraries. ```shell brew install libomp ``` -------------------------------- ### Searching for Another Log Print Statement (C) Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_LIB.md Similar to the previous example, this shows another `printf` statement to search for in the C/C++ source code. Commenting out such lines helps in disabling unwanted console output related to configuration details like `modelsDir`. ```c printf("modelsDir= ` ``` -------------------------------- ### Fixing ONNX Runtime Header Include Paths in C++ Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/Build_Rapid_OCR_Onnx_Lib_on_Kylin_arm64.md This snippet provides a solution for a common compilation error where the 'onnxruntime_cxx_api.h' header cannot be found. It demonstrates two alternative include paths: one suggested by the RapidOCR author and another that was successfully used during compilation. This modification is crucial for resolving build issues related to ONNX Runtime dependencies. ```C++ // 将下面的代码 #include //改为 #include // rapidOcr 作者建议的版本(暂时没验证) #include // kylin 编译时实际修改的版本 ``` -------------------------------- ### Searching for Log Print Statements (C) Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_LIB.md This example demonstrates how to search for specific `printf` statements in the C/C++ source code using a global search tool like CLion. Identifying these statements is the first step to commenting them out and disabling console log output. ```c printf("numThread=` ``` -------------------------------- ### Cloning RapidOcrOnnx Project (Shell) Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_LIB.md This command clones the RapidOcrOnnx repository from GitHub, which is the first step in preparing the source code for compilation. It fetches all project files to the local machine. ```shell git clone https://github.com/RapidAI/RapidOcrOnnx ``` -------------------------------- ### ONNX Runtime Static Library Directory Structure (Text) Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_LIB.md This snippet illustrates the expected directory structure after extracting the ONNX Runtime static library package. It shows the main `onnxruntime-static` directory containing configuration files and platform-specific subdirectories for Linux, macOS, and Windows. ```text onnxruntime-static ├── OnnxRuntimeWrapper.cmake ├── linux ├── macos ├── windows-x64 └── windows-x86 ``` -------------------------------- ### Building RapidOcrOnnx Project (Shell) Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_LIB.md This shell command executes the build script for the RapidOcrOnnx project. Users are prompted to select options during the build process, ultimately choosing to compile the 'JNI dynamic library'. ```shell ./build.sh ``` -------------------------------- ### OpenCV Static Library Directory Structure (Text) Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_LIB.md This snippet illustrates the expected directory structure after extracting the OpenCV static library package. It shows the main `opencv-static` directory containing configuration files and platform-specific subdirectories for Linux, macOS, and Windows. ```text opencv-static ├── OpenCVWrapperConfig.cmake ├── linux ├── macos ├── windows-x64 └── windows-x86 ``` -------------------------------- ### Packaging Maven Project with Linux Profile Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_JAR.md This shell command is used to package a Maven project, explicitly activating the `linux-x86_64` profile defined in the `pom.xml`. The `-P linux-x86_64` flag ensures that the Linux-specific dependency is included, and `-Dlinux-build` might be a custom property used within the build process. ```Shell # 下面命令中linux-x86_64对应上面pom文件中id标签 mvn clean package -P linux-x86_64 -Dlinux-build ``` -------------------------------- ### Executing RapidOcrOnnx Tests (Shell) Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_LIB.md This command runs the test suite for the compiled RapidOcrOnnx library. It's crucial to modify the script to point to the correct target image path before execution to ensure accurate testing. ```shell ./run-test.sh ``` -------------------------------- ### Directly Adding Linux x86_64 Dependency in Maven POM Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_JAR.md This XML snippet shows how to directly include both the `rapidocr` and `rapidocr-onnx-linux-x86_64` dependencies in the `pom.xml`. This approach bypasses the need for Maven profiles and ensures that the Linux-specific library is always bundled, regardless of the build environment, simplifying the build process for cross-platform deployment. ```XML io.github.mymonstercat rapidocr x.x.x io.github.mymonstercat rapidocr-onnx-linux-x86_64 x.x.x ``` -------------------------------- ### Adding Linux x86_64 Profile to Maven POM Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_JAR.md This XML snippet defines a Maven profile named `linux-x86_64` within the `pom.xml`. This profile is activated when the operating system is Unix-like (`family=unix`) and the architecture is `amd64`. When active, it includes the `rapidocr-onnx-linux-x86_64` dependency, ensuring the correct platform-specific library is used for Linux builds. ```XML linux-x86_64 unix amd64 io.github.mymonstercat rapidocr-onnx-linux-x86_64 x.x.x ``` -------------------------------- ### Adjusting ONNX Runtime C++ Header Include Path (C) Source: https://github.com/mymonstercat/rapidocr-java/blob/main/docs/COMPILE_LIB.md This C++ code modification is required for successful compilation on macOS. It changes the include directive for the ONNX Runtime C++ API header, simplifying the path to `onnxruntime/onnxruntime_cxx_api.h` from `onnxruntime/core/session/onnxruntime_cxx_api.h` in specific header files like AngleNet.h, CrnnNet.h, DbNet.h, OcrLite.h, and OcrUtils.h. ```c // Original: #include // Modified (for macOS): #include ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.