ideas for library loading for gpgme on Android

Hans-Christoph Steiner hans at guardianproject.info
Fri Aug 31 18:14:39 CEST 2012



On 08/31/2012 11:30 AM, Marcus Brinkmann wrote:
> On 08/31/2012 03:47 PM, Hans-Christoph Steiner wrote:
>>
>>
>> On 08/31/2012 09:08 AM, Marcus Brinkmann wrote:
>>> On 08/31/2012 03:52 AM, Hans-Christoph Steiner wrote:
>>>>
>>>> So Android has a very limited linker, and the _only_ way to specify load
>>>> paths for shared libraries is with the LD_LIBRARY_PATH env var.  By
>>>> default, LD_LIBRARY_PATH is set to:
>>>>
>>>> LD_LIBRARY_PATH=/vendor/lib:/system/lib
>>>
>>> That's the canonical way.  Normally, the environment is inherited by
>>> child processes, so it will just propagate through GPGME.
>>>
>>> Or is this different on Android?
>>
>> The difference on Android is that there are no built-in paths and rpath
>> is not supported.  On all the GNU/Linux systems I've used, I've never
>> seen LD_LIBRARY_PATH set by the system.
>>
>> The environment is inherited in Android as well, but since Android apps
>> are Java, there isn't a way that I know to set LD_LIBRARY_PATH for the
>> current process in Java, only child processes.
> 
> Well, in that case, the quickest way is possibly to set the environment
> from within gpgme before spawning child processes.

Is there a way to do that cleanly within gpgme? Or are you suggesting
that I just patch in a putenv()?

>> I think that Android does look in the app-local lib/ folder when loading
>> JNI libs, but that doesn't seem to set LD_LIBRARY_PATH so that's not
>> inherited by the gpg child process.
>>
>> I'll investigate more today...

I haven't found how Android manages to load the JNI libs for an app from
its standard location: /data/data/com.example.app/lib/libmyjni.so.

.hc



More information about the Gnupg-devel mailing list