Use of LGPL libraries in closed source android software

androidlegallgpl

I'm investigating the legal issues of using LGPL native libraries in a closed source Android software.

As for now, my research on the subject shows that using LGPL libraries in closed source software is doable, and that the requirements are not specially high.

On a regular application (for example a C closed source application), I would dynamically link the library, and distribute the binaries of the application along with the library with proper reference to it and instruction on how to replace this library with the version the user would like to. (I may be forgetting some stuff here but this is not the point of my question).

My question refers to Android software and JNI. Assuming I am building an Android software using JNI I do have :

My java source
A JNI folder including :

  • Android.mk file for the compilation of the application
  • the library source code
  • .cpp/.h files linking the source code with JNI

To compile my application, two steps are required :

  • Compilation of the library using NDK to generate a *.so file
  • Compilation of the Android application using Ant. The java code includes a System.loadlibrary("nameOfTheLibrary")

The problem I am facing is that the source code of the library is first compiled to a *.so file. This can be considered as derivative work, am I right ?

How could I include the native LGPL libraries and distribute it in a proper way to avoid any legal problems ?

Best Answer

Your code is compiled to a .so. But that includes just your sources and any libraries linked statically, i.e. as .a. Libraries that were compiled separately to .so are separate.

So you must generate separate .so files from the LGPL parts and separate .so from your code, which will be linked to the other .sos (this is the dynamic link that stops LGPL from applying further). All of those .so files than have to be packed into the .apk (the build system should place them in the right directory automatically) and the user can replace them and repack the .apk (and have to sign it with their key, but since any valid key will do, that's fine)

The build system should be able to define any number of shared library modules (I don't remember the details, I am compiling android libraries with CMake, so look at the documentation). And remember that the makefiles describing how to build the LGPL libraries are considered source by LGPL too.