THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NOTES.ANDROID 3.7KB

  1. NOTES FOR ANDROID PLATFORMS
  2. ===========================
  3. Requirement details
  4. -------------------
  5. Beside basic tools like perl and make you'll need to download the Android
  6. NDK. It's available for Linux, Mac OS X and Windows, but only Linux
  7. version was actually tested. There is no reason to believe that Mac OS X
  8. wouldn't work. And as for Windows, it's unclear which "shell" would be
  9. suitable, MSYS2 might have best chances. NDK version should play lesser
  10. role, the goal is to support a range of most recent versions.
  11. Configuration
  12. -------------
  13. Android is naturally cross-compiled target and you can't use ./config.
  14. You have to use ./Configure and name your target explicitly; there are
  15. android-arm, android-arm64, android-mips, android-mip64, android-x86
  16. and android-x86_64. Do not pass --cross-compile-prefix (as you might
  17. be tempted), as it will be "calculated" automatically based on chosen
  18. platform. Though you still need to know the prefix to extend your PATH,
  19. in order to invoke $(CROSS_COMPILE)gcc and company. (Configure will fail
  20. and give you a hint if you get it wrong.) Apart from PATH adjustment
  21. you need to set ANDROID_NDK_HOME environment to point at NDK directory
  22. as /some/where/android-ndk-<ver>. Both variables are significant at both
  23. configuration and compilation times. NDK customarily supports multiple
  24. Android API levels, e.g. android-14, android-21, etc. By default latest
  25. one available is chosen. If you need to target older platform, pass
  26. additional -D__ANDROID_API__=N to Configure. N is numeric value of the
  27. target platform version. For example, to compile for ICS on ARM with
  28. NDK 10d:
  29. export ANDROID_NDK_HOME=/some/where/android-ndk-10d
  30. PATH=$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:$PATH
  31. ./Configure android-arm -D__ANDROID_API__=14
  32. make
  33. Caveat lector! Earlier OpenSSL versions relied on additional CROSS_SYSROOT
  34. variable set to $ANDROID_NDK_HOME/platforms/android-<api>/arch-<arch> to
  35. appoint headers-n-libraries' location. It's still recognized in order
  36. to facilitate migration from older projects. However, since API level
  37. appears in CROSS_SYSROOT value, passing -D__ANDROID_API__=N can be in
  38. conflict, and mixing the two is therefore not supported. Migration to
  39. CROSS_SYSROOT-less setup is recommended.
  40. One can engage clang by adjusting PATH to cover same NDK's clang. Just
  41. keep in mind that if you miss it, Configure will try to use gcc...
  42. Also, PATH would need even further adjustment to cover unprefixed, yet
  43. target-specific, ar and ranlib. It's possible that you don't need to
  44. bother, if binutils-multiarch is installed on your Linux system.
  45. Another option is to create so called "standalone toolchain" tailored
  46. for single specific platform including Android API level, and assign its
  47. location to ANDROID_NDK_HOME. In such case you have to pass matching
  48. target name to Configure and shouldn't use -D__ANDROID_API__=N. PATH
  49. adjustment becomes simpler, $ANDROID_NDK_HOME/bin:$PATH suffices.
  50. Running tests (on Linux)
  51. ------------------------
  52. This is not actually supported. Notes are meant rather as inspiration.
  53. Even though build output targets alien system, it's possible to execute
  54. test suite on Linux system by employing qemu-user. The trick is static
  55. linking. Pass -static to Configure, then edit generated Makefile and
  56. remove occurrences of -ldl and -pie flags. You would also need to pick
  57. API version that comes with usable static libraries, 42/2=21 used to
  58. work. Once built, you should be able to
  59. env EXE_SHELL=qemu-<arch> make test
  60. If you need to pass additional flag to qemu, quotes are your friend, e.g.
  61. env EXE_SHELL="qemu-mips64el -cpu MIPS64R6-generic" make test