【问题标题】:Cmake toolchain for 32-bit MIPS processor用于 32 位 MIPS 处理器的 Cmake 工具链
【发布时间】:2018-02-14 14:53:52
【问题描述】:

需要在 Axis 相机上运行 Azure IoT SDK C 示例。使用标准 cmake 构建示例不起作用,因为它们是为 64 位 x86_84 编译的。需要将其编译为 MIPS32。

尤金·肖。建议为它制作一个工具链文件。我现在写了一个,但它在 16% 时失败并出现以下错误:

[ 16%] /usr/bin/cmake: /usr/local/lib/libcurl.so.4: no version information available (required by /usr/bin/cmake)
Building C object c-utility/CMakeFiles/aziotsharedutil.dir/adapters/uniqueid_linux.c.o
/demo/azure-iot-sdk-c/c-utility/adapters/uniqueid_linux.c:7:23: fatal error: uuid/uuid.h: No such file or directory
compilation terminated.
make[2]: *** [c-utility/CMakeFiles/aziotsharedutil.dir/adapters/uniqueid_linux.c.o] Error 1
make[1]: *** [c-utility/CMakeFiles/aziotsharedutil.dir/all] Error 2
make: *** [all] Error 2

我的工具链文件:

INCLUDE(CMakeForceCompiler)

SET(CMAKE_SYSTEM_NAME Linux)     # this one is important
SET(CMAKE_SYSTEM_VERSION 1)      # this one not so much
SET(CMAKE_SYSTEM_PROCESSOR mips)

# this is the location of the imps toolchain targeting the M1125
SET(CMAKE_C_COMPILER /usr/local/mipsisa32r2el/r23/bin/mipsisa32r2el-axis-linux-gnu-gcc)

# this is the file system root of the target
#SET(CMAKE_FIND_ROOT_PATH /usr/local/mipsisa32r2el/r23)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

并使用 ´./build.sh --toolchain-file toolchain-mips.cmake` 运行它。

如果我按照documentation 所说的那样运行它,使用 -cl --sysroot=/usr/local/mipissa32r2el/r23。我收到它无法找到 OpenSSL 并且更早失败的错误。

【问题讨论】:

  • 您需要一个用于 MIPS 的交叉编译器工具链。这就是建议。
  • 啊,当然。好建议。

标签: c compilation mips axis toolchain


【解决方案1】:

想出了其中的一部分。它找不到 OpenSSL,因为它不在指定的根文件夹中。很明显,真的。需要克隆源代码并使用 mips gcc 构建并提供其根目录的路径。

SET(CMAKE_FIND_ROOT_PATH /path/to/mips/openssl /usr/local/mipsisa32r2el/r23)

Curl 也是一样。

SET(CMAKE_FIND_ROOT_PATH /path/to/mips/openssl /path/to/mips/curl /usr/local/mipsisa32r2el/r23)

现在我基本上回到了我开始的地方。缺少我不完全应该放置的头文件。然而,一个新问题是,当运行带有 --sysroot=/usr/local/mipsisa32r2el/r23 后缀的构建脚本时,它会在 0% 时失败,因为警告被视为错误。考虑到没有后缀就不会发生这种情况,我只能假设它与提供的 mips 相关文件而不是 CMake 文件有关。

编辑:设法修复它并使用工具链成功构建。

跳过了sysroot 参数。解决了有关缺少 uuid 的头文件的错误。

在 22% 时出现以下错误,即 discussed and solved here.。简短的回答,仅从 util-linux 构建 uuid。

最后,我能够通过 Cmake 为我的 MIPS-32 设备构建。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-23
    • 1970-01-01
    • 2019-04-13
    • 2014-10-15
    • 1970-01-01
    • 2011-04-19
    相关资源
    最近更新 更多