Как использовать компилятор arm-linux-androideabi для создания iotivity-lite? - PullRequest
0 голосов
/ 25 февраля 2019

Как скомпилировать и собрать iotivity-lite (https://github.com/iotivity/iotivity-constrained) для Android с использованием arm-linux-androideabi компилятор? Меня интересует Makefile изменения и настройки.

1 Ответ

0 голосов
/ 25 февраля 2019

Инструкции по созданию iotivity-lite для Android доступны в формате readme внутри файла Makefile.

Перейти к [iotivity-lite]/port/android/Makefile

Ссылка на файл сборки Andorid

из этого файла make:

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

Инструкции по сборке ограничены сборкой кода C, который должен выполняться с использованием оболочки adb.

В то время, когда я пишу это, существует отдельная ветвь, которая работает, чтобы представить IoTctivity-lite для Java с использованием JNI.Это ветвь swig.

Существует файл readme, содержащий инструкции по созданию API-интерфейсов Java, а также некоторые примеры программ.

README инструкции для ветви swig

Ветвь swig все еще находится в активной разработке, но должна быть достаточно стабильной для удовлетворения ваших потребностей.

...