我尝试将Azure IoT C SDK (https://github.com/azure/azure-iot-sdk-c)交叉编译为BeagleBoard黑色。
我确实安装了Debian GNU/Linux8.7 (jessie)机器并安装了工具链,如下所示:http://exploringbeaglebone.com/chapter7/。
然后我按照下面的步骤操作:https://github.com/Azure/azure-iot-sdk-c/blob/master/doc/SDK_cross_compile_example.md并创建了一个工具链文件:
INCLUDE(CMakeForceCompiler)
SET(CMAKE_SYSTEM_NAME Linux) # this one is important
SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
# this is the location of the amd64 toolchain targeting the Raspberry Pi
SET(CMAKE_C_COMPILER /usr/bin/arm-linux-gnueabihf-gcc)
SET(CMAKE_FIND_ROOT_PATH /usr/lib/arm-linux-gnueabihf)
# 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_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)我使用以下命令调用azure-sdk的Buildscript:
./build.sh --toolchain-file toolchain-bb.cmake -cl --sysroot=/usr/lib/arm-linux-gnueabihf出现以下错误
CMake Error at /usr/share/cmake-3.0/Modules/FindPackageHandleStandardArgs.cmake:136 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.0/Modules/FindPackageHandleStandardArgs.cmake:343 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:328 (find_package_handle_standard_args)
c-utility/CMakeLists.txt:141 (find_package)我尝试使用以下命令安装openssl:
sudo apt-get install openssl:armhf 但是错误仍然存在,如果我构建arm64的源代码(只使用azure-iot-sdk的build.sh文件),一切都会正常工作。
如果我克隆openssl并以arm为目标构建它,我会得到以下错误:
CMake Error at /usr/share/cmake-3.0/Modules/FindPackageHandleStandardArgs.cmake:136 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES) (found
version "1.1.1")发布于 2017-05-13 01:10:34
如果您的工具链中有Openssl,那么您只需向cmake工具链文件中添加几行。这将帮助cmake找到你的库和头文件。如下所示:
SET(OPENSSL_ROOT_DIR /path/to/openssl/lib) SET(OPENSSL_INCLUDE_DIR /path/to/openssl/include/)
如果它不存在,那么您需要为您的目标交叉编译openssl并将其安装到您的工具链中。通常为/<sysroot>/usr/lib和/<sysroot>/usr/include。
或者,如果openssl在您的设备上,但不在您的工具链中,那么您可以简单地从设备复制它。这里有一个将依赖项复制到Raspberry Pi演示中的工具链的示例:https://github.com/Azure/azure-iot-sdk-c/blob/master/doc/SDK_cross_compile_example.md
https://stackoverflow.com/questions/43586529
复制相似问题