首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用arm-编译器来构建iotivity?

如何使用arm-编译器来构建iotivity?
EN

Stack Overflow用户
提问于 2019-02-25 06:39:08
回答 1查看 199关注 0票数 0

如何使用arm-linux-androideabi编译器为编译和构建 (https://github.com/iotivity/iotivity-constrained)?我对Makefile的更改和设置感兴趣。

EN

回答 1

Stack Overflow用户

发布于 2019-02-25 20:56:53

在Makefile中,使用了一种自述格式,可以获得为Android构建iotivity的说明。

转到[iotivity-lite]/port/android/Makefile

链接到安道尔Makefile

从那个文件中:

代码语言:javascript
复制
Port for native Android compilation (without Java).
Tested NDK versions:
API   Android version
  19   4.4
  21   5.0
  23   6.0
  24   7.0

 API version 24 is closest to regular Linux so far.
 With API 24 the Android port is almost identical to the Linux port
 except for the removal of the unsupported pthread_cancel and that
 the IP adapter assures that interfaces have multicast and broadcast
 enabled to avoid 3G/4G/5G interfaces.

 It is expected that higher versions then API 24 should work without any
 further modifications.

 Testing compilations on non-rooted Android phones:
 - Enable USB debugging on your phone.
 - Install ADB or Android Studio
 - adb start-server
   Your phone should query now if you trust the computer. Hit OK.
 - adb push simpleclient /data/local/tmp/
   Most likely your phone gives you in /data/local some more permissions
   Non-rooted devices are a bit restrictive what you can do in the file system.
 - adb shell
 - cd /data/local/tmp
 - chmod 755 simpleclient
   It was observed that the file has read-write permissions only after the upload
   on Android 7.
 - In a different terminal window start simpleserver on your developer box.
 - ./simpleclient
 - Kill client with Ctrl-C or Ctrl-\
 - exit
 - *** DISABLE USB debugging!!! *** (security issue if left on)

 Note: On regular Android phones the server versions will not be found
       (ie. simpleserver will not be discovered). But the clients
       should work.

 Download NDK: https://developer.android.com/ndk/downloads/index.html
 Unzip downloaded package.
 Choose architecture and API level.
 cd <NDK>/build/tools
 ./make_standalone_toolchain.py --arch <architecture> --api <level> --install-dir <path>
 For example: ./make_standalone_toolchain.py --arch arm --api 23 --install-dir ~/android-arm-23
 This makefile uses then the NDK in <install-dir>.
 For further setup see: https://developer.android.com/ndk/guides/standalone_toolchain.html

 Either set ANDROID_API and ANDROID_BASE in this makefile
 or invoke like this: make NDK_HOME=/opt/android-ndk ANDROID_API=24

下载NDK之后,请确保运行make_standalone_toolchain.py脚本。要为arm构建调试版本,我将运行以下命令。

make NDK_HOME=~/Android/android-arm-23/ ANDROID_API=23 DYNAMIC=1 TCP=1 SECURE=1 DEBUG=1

构建指令仅限于构建必须使用亚行shell运行的C代码。

在我编写这篇文章的时候,有一个独立的分支正在使用JNI向Java公开物联网。这是酒馆。

有一个自述文件,它包含构建Java的说明以及一些示例程序。

swig分支的自述指令

swig分支仍在积极开发,但应该足够稳定,以满足您的需要。

编辑:

自从提出这个问题以来,swig分支已经与碘岩的主分支合并了。还请注意,由于这个问题被问到,存储库名从iotivity-constrained更改为iotivity-lite。为Android构建的所有内容都应该在[iotivity-lite]/port/android/README.md文件中。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54860731

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档