交叉编译天青IOT SDK(cross compile azure iot sdk)

2019-09-30 14:43发布

我尝试crosscompile Azure的物联网ÇSDK( https://github.com/azure/azure-iot-sdk-c的BeagleBoard的黑色)。

我没有设定一个Debian GNU / Linux的8.7(杰西)机械与此处描述安装工具链: 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

以下错误Occures

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和构建它靶臂我得到以下错误:

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")

Answer 1:

如果你有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是您的设备上,但不是在你的工具链,那么你可以简单地从设备复制。 有复制依赖于树莓派演示工具链的例子在这里: https://github.com/Azure/azure-iot-sdk-c/blob/master/doc/SDK_cross_compile_example.md



文章来源: cross compile azure iot sdk