当前位置:   article > 正文

交叉编译 微软物联网SDK (azure-iot-sdk-c)_微软azure iot sdk下载

微软azure iot sdk下载

因工作需要移植微软的物联网SDK,通过文档交叉编译出了sdk库,在此记录下编译方法.

1. 先下载 SDK (azure-iot-sdk-c: https://github.com/Azure/azure-iot-sdk-c/tree/2018-09-11),有一点要提示下,我在下载SDK时最开始选择的是 DownLoad ZIP,这样下载下来的SDK不完整有很多依赖的文件夹内容都下载不下来,后面安装了git工具才拿到完整的代码(git clone -b <yyyy-mm-dd> --recursive https://github.com/Azure/azure-iot-sdk-c.git) https://github.com/Azure/azure-iot-sdk-c/blob/master/doc/devbox_setup.md#linux

 

2. 编译前的准备,交叉编译azure-iot-sdk-c需要用到 curl库和openssl库和uuid库,在网上下载源码交叉编译好,由于这几个库我做项目经常用到所以我统一放在一个公共目录里面方便使用

3. 需要的库准备好后就要根据文档来进行编译了。这里面用的是cmake,我电脑上装的有现成的,没有的自行安装,运行cmake指令前,需要添加一些配置,指定用什么编译器,库的目录等等,创建一个配置文件 toolchain-rpi.cmake 内容如下

  1. INCLUDE(CMakeForceCompiler)
  2. SET(CMAKE_SYSTEM_NAME Linux) # this one is important
  3. SET(CMAKE_SYSTEM_VERSION 1) # this one not so much
  4. # this is the location of the amd64 toolchain targeting the Raspberry Pi
  5. #SET(CMAKE_C_COMPILER $ENV{RPI_ROOT}/../bin/arm-linux-gnueabihf-gcc)
  6. SET(CMAKE_C_COMPILER /opt/hisi-linux/x86-arm/arm-hisiv600-linux/target/bin/arm-hisiv600-linux-gcc)
  7. # this is the file system root of the target
  8. #SET(CMAKE_FIND_ROOT_PATH $ENV{RPI_ROOT})
  9. SET(CMAKE_FIND_ROOT_PATH /test/azure-iot-sdk-c/DEMO)
  10. # search for programs in the build host directories
  11. SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  12. # for libraries and headers in the target directories
  13. SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  14. SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

参考文档: https://github.com/Azure/azure-iot-sdk-c/blob/2018-09-11/doc/SDK_cross_compile_example.md

放入

最后在当前目前下执行 指令  ./build.sh --toolchain-file toolchain-rpi.cmake  --provisioning -cl -L/test/azure-iot-sdk-c/DEMO/lib

最终结果:

生成的库在

 

 

 

 

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/612962
推荐阅读
  

闽ICP备14008679号