RV1106 mmdeploy cross compile failed编译失败

  • Hello,

    __ctype_tolower and __ctype_b are c library functions, which may be related to your compilation environment.

    Check whether this error will occur when compiling rknpu2 directly. If an error is reported, please check your compilation environment:

    1. Install rknpu2

    Code: Select all

    git clone https://github.com/rockchip-linux/rknpu2.git
    
    2. Set environment variables

    Code: Select all

    export RK_RV1106_TOOLCHAIN=<SDK directory>/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf
    
    3. Cross compilation

    Code: Select all

    chmod +x build-linux_RV1106.sh
    ./build-linux_RV1106.sh
    
    Note: rknpu2 has stopped maintenance, and the secondary development is still based on the routines in rknn_model_zoo
  • Eng38 wrote: 2024-03-09 9:29 Hello,

    __ctype_tolower and __ctype_b are c library functions, which may be related to your compilation environment.

    Check whether this error will occur when compiling rknpu2 directly. If an error is reported, please check your compilation environment:

    1. Install rknpu2

    Code: Select all

    git clone https://github.com/rockchip-linux/rknpu2.git
    
    2. Set environment variables

    Code: Select all

    export RK_RV1106_TOOLCHAIN=<SDK directory>/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf
    
    3. Cross compilation

    Code: Select all

    chmod +x build-linux_RV1106.sh
    ./build-linux_RV1106.sh
    
    Note: rknpu2 has stopped maintenance, and the secondary development is still based on the routines in rknn_model_zoo
    Appreciate for your reply. I figure out what is wrong with my project. I failed to set the RKNN tool chain so that the cmake used the system's gcc-linux-armhf compiler. This also may raise exception even if compiling is complete,. For instance, the execute file can not run on target board, because system's compiler uses GlibC , whereas rv1106 uses ulibc tool chain.

    I fix this problem now. However, the compiling process still break down when linking with rknn. There is the :
    Error:

    Code: Select all

    /opt/RKNN/arm-rockchip830-linux-uclibcgnueabihf/bin/../lib/gcc/arm-rockchip830-linux-uclibcgnueabihf/8.3.0/../../../../arm-rockchip830-linux-uclibcgnueabihf/bin/ld.bfd: ../../lib/libmmdeploy.so.1.3.1: undefined reference to `rknn_run'
    /opt/RKNN/arm-rockchip830-linux-uclibcgnueabihf/bin/../lib/gcc/arm-rockchip830-linux-uclibcgnueabihf/8.3.0/../../../../arm-rockchip830-linux-uclibcgnueabihf/bin/ld.bfd: ../../lib/libmmdeploy.so.1.3.1: undefined reference to `rknn_query'
    /opt/RKNN/arm-rockchip830-linux-uclibcgnueabihf/bin/../lib/gcc/arm-rockchip830-linux-uclibcgnueabihf/8.3.0/../../../../arm-rockchip830-linux-uclibcgnueabihf/bin/ld.bfd: ../../lib/libmmdeploy.so.1.3.1: undefined reference to `rknn_outputs_get'
    I try to fix this error by modifying part of cmake file:

    Code: Select all

        link_directories("/opt/RKNN/rknpu2/runtime/RV1106/Linux/librknn_api/armhf/librknn_api.so")
        link_directories("/opt/RKNN/rknpu2/runtime/RV1106/Linux/librknn_api/armhf/librknnmrt.so")
    I also ensured that the rknn_api.h is included in the project.

    Code: Select all

    // Copyright (c) OpenMMLab. All rights reserved.
    #include "rknn_net.h"
    #include <stdio.h>
    
    #include <fstream>
    
    #include "mmdeploy/core/logger.h"
    #include "mmdeploy/core/model.h"
    #include "mmdeploy/core/utils/filesystem.h"
    #include "mmdeploy/core/utils/formatter.h"
    
    namespace mmdeploy::framework {
    
    static inline const char* const rknn_type(rknn_tensor_type type) {
      switch (type) {
        case RKNN_TENSOR_FLOAT32:
          return "FP32";
    But they don't work. I wonder if there are any solutions for this? Thanks.
  • Kyle wrote: 2024-03-09 11:59 I try to fix this error by modifying part of cmake file:

    Code: Select all

        link_directories("/opt/RKNN/rknpu2/runtime/RV1106/Linux/librknn_api/armhf/librknn_api.so")
        link_directories("/opt/RKNN/rknpu2/runtime/RV1106/Linux/librknn_api/armhf/librknnmrt.so")
    link_directories is mainly used to specify the directories where the linker searches for library files, rather than directly specifying the library name. In CMake, you can use target_link_libraries to explicitly specify the linked library names. For example:

    Code: Select all

    target_link_libraries(rknn_yolov5_demo "/opt/RKNN/rknpu2/runtime/RV1106/Linux/librknn_api/armhf/librknnmrt.so")