[英]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.