GSoC Final Submission report — LibreOffice for Android

Overview

My project goals were to work behind the scenes to improve the LibreOffice Android build system. I worked on switching from deprecated NDK GCC toolchain to a relatively newer and better toolchain-Clang, used to compile the native code in LibreOffice. I also fixed the failures caused in the code because of compiler switching.

Apart from this, I worked on cross-compiling Mozilla’s NSS(Network Security Services) library for ARM and supporting it with LO Android which was using OpenSSL instead.

Note: My tasks lineup was shifted to what I originally proposed because two students were working on the same project and some of our proposed work overlapped.

I accepted my change of tasks because they challenged me with a better and different set of learnings to what I already knew.

Work

In chronological order — June to August

  1. LO Android build was only tested upto NDK r13b, updated and tested configure script to use NDK r14b — https://gerrit.libreoffice.org/#/c/38359/
  2. By the time I was completing clang switch, NDK r15b was released, updated configure again before switching the toolchain — https://gerrit.libreoffice.org/#/c/39127/
  3. Fixed bridges/ module crash with Clang because the following patches were to set Clang as default — https://gerrit.libreoffice.org/#/c/39050/
  4. Updated the configure to support building with Clang 5.0 toolchain coming with latest NDK — https://gerrit.libreoffice.org/#/c/39122/
  5. Set Clang as default compiler on Android instead of GCC — https://gerrit.libreoffice.org/#/c/39123/
  6. Removed the support for building with GCC — https://gerrit.libreoffice.org/#/c/39125/

Clang switch completed, moving on to the NSS part…

NSS still likes NDK’s GCC toolchain. I worked incrementally, first of all tried to tweak NSS sources to build for Android as target OS with existing build system. When it was successful, I modified configure and Makefiles to use Clang toolchain and fixed other errors breaking the build.

I had to prepare a patch file to support NSS building for Android and hope is that NSS upstream will accept those changes so that we won’t have to worry about managing the patch forever with LO code.

7. Combined all the NSS changes into one patch, fixed and enabled NSS building for Android — https://gerrit.libreoffice.org/#/c/40645/

8. Android used to use OpenSSL for security features in LO, we have now switched to NSS — https://gerrit.libreoffice.org/#/c/41308/

All GSoC related Patches

All commits — https://github.com/LibreOffice/core/commits/master?author=gautamprajapati06@gmail.com

  1. android: Update configure.ac for NDK r14b version
  2. Clean up declaration of __cxa_get_globals in linux_arm bridge
  3. android: Bump NDK version to 15 in configure.ac
  4. android:Supress the Clang’s unneeded-internal-declaration warning
  5. android:update safeint header to use the else implementation with clang
  6. Android Viewer: Listen for changes in editing preference settings
  7. add factory function mapping for libspelllo archive
  8. android: Fix bridges/ module for building with Clang
  9. android: update configure.ac to support building only with NDK>=15
  10. android: update configure.ac for supporting Clang5.0
  11. Supress unused variable warning in gcc arm bridge
  12. android: Set clang as default compiler for building
  13. android: Remove GCC support for building
  14. Clean up android specific template functions defined in std namespace
  15. android:Update configure.ac to support NDK 15.1.x
  16. android: remove unused GCC related code from configure.ac
  17. Fix and enable NSS build for Android
  18. Fix and enable libxmlsec build for Android
  19. Enable HAVE_FEATURE_NSS and package the NSS libraries with apk

Future Work

  • We want to switch to libc++ as STL from GNU libstdc++. We couldn’t do so in GSoC timeline because NDK does not have a stable implementation of libc++ right now.
  • Next step in NSS task would be to submit the Android/ARM specific changes to Mozilla repository so that LO won’t have to take care of patch all the time.

Other Links