beeware / briefcase-android-gradle-template

A template for generating Android Gradle projects with Briefcase
MIT License
21 stars 22 forks source link

Extend LD_LIBRARY_PATH, rather than overwriting it #6

Closed paulproteus closed 2 years ago

paulproteus commented 4 years ago

pmp-p on BeeWare Gitter points out that overwriting LD_LIBRARY_PATH could conflict with the configuration provided by Android vendors. It's better to add to the LD_LIBRARY_PATH, rather than overwrite it:

https://github.com/beeware/briefcase-android-gradle-template/blob/c8b8c08026c1f4f841d9fbea3b4ef3b575381a0e/%7B%7B%20cookiecutter.formal_name%20%7D%7D/app/src/main/java/org/beeware/android/MainActivity.java#L111

If possible, I'd prefer not to set that environment variable at all.

pmp-p commented 4 years ago

If possible, I'd prefer not to set that environment variable at all.

That's what i usually do, but i put all my libs ( especially the pip generated ones ) in the apk special lib folder : so i'm not sure if you won't need it for some dlopen() stuff later

mhsmith commented 2 years ago

In my experience, setting LD_LIBRARY_PATH after the process starts doesn't actually have any effect on Android. Instead, if you want to update the dynamic linker path, you have to call the undocumented function android_update_LD_LIBRARY_PATH in libdl.so.

Anyway, this code will be removed when we move to Chaquopy.