Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installer for Android, based on NDK #538

hugbug opened this issue May 18, 2018 · 0 comments

Installer for Android, based on NDK #538

hugbug opened this issue May 18, 2018 · 0 comments


Copy link

@hugbug hugbug commented May 18, 2018

Android is based on Linux. That allowed us to use binaries compiled for Linux on Android. Unfortunately these binaries don't work in Android 8 anymore. We are going to fix this.

C libraries

POSIX defines API - a list of functions available for applications written in C (and other languages which can access C API). All these functions are usually implemented by platform vendors as standard C library. GNU/Linux has glibc which is used on server and desktop systems. There are also other C libraries such as uClibc or musl. C libraries contain high level functions such as for string manipulation but also low level system functions such as for file access. The latter rely on kernel functions to access device drivers or other hardware related manipulations.

Android has it's own C library called Bionic. Like other C libraries it needs to call kernel functions for low level things.

Restrictions in Android 8

In Android 8 an attempt was made to improve security by restricting third-party applications from accessing certain kernel functions. Android developers have built a list of kernel functions used in Bionic and declared it whitelist. All other kernel functions are not available for third-party applications.

NZBGet binaries included in installer for Linux are compiled using glibc and uClibc. It happened that glibc and uClibc do use certain kernel functions which Bionic doesn't use and which weren't added to whitelist. As a result nzbget binaries compiled for Linux are not working on Android 8 anymore.

Interesting fact: whitelist restrictions are applied to processes launched via Android UI. When launching nzbget from android debugger shell it (nzbget) works. That doesn't help us though as we need a way to launch nzbget from Android UI.

What to do?

A logical solution is to compile nzbget using Android's C library Bionic. That means:

  • prepare cross-compiling toolchains based on Android NDK - armv7 and x86 for the start; aarch64 and x86_64 may be added later;
  • make nzbget code compatible with Bionic;
  • extend nzbget build script build-nzbget to work with NDK based toolchains;
  • extend unpacker build script build-unpack to work with NDK based toolchains;
  • build 7zip and unrar for Android targets;
  • extend installer script to work with Android targets;
  • update Android installer app to use Android installer packages instead of Linux installer packages;
  • build busybox (used in Android installer app) using new NDK toolchains.
@hugbug hugbug added the feature label May 18, 2018
@hugbug hugbug added this to the v21 milestone May 18, 2018
hugbug added a commit that referenced this issue Jun 13, 2018
@hugbug hugbug mentioned this issue Jun 15, 2018
2 of 2 tasks complete
hugbug added a commit that referenced this issue Jun 15, 2018
hugbug added a commit to nzbget/ that referenced this issue Jun 15, 2018
@hugbug hugbug closed this Jun 22, 2018
hugbug added a commit that referenced this issue Sep 1, 2018
isn’t necessary when building specifically for Android using Android
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant