繁体   English   中英

用于32位MIPS处理器的Cmake工具链

[英]Cmake toolchain for 32-bit MIPS processor

需要在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`运行它。

如果我按照文档所述运行它,请使用-cl --sysroot = / usr / local / mipsisa32r2el / r23。 我收到无法找到OpenSSL的错误,并且失败得多。

找出其中的一部分。 它找不到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%的情况下,出现以下错误,在此进行了讨论和解决。 简短的答案,仅从util-linux构建uuid。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM