flutter-openpgp icon indicating copy to clipboard operation
flutter-openpgp copied to clipboard

Shared libraries stripped by F-Droid

Open amake opened this issue 7 months ago • 4 comments

F-Droid apparently strips shared libraries that are provided as binaries. It looks to me like they want the source included and the libraries to be built at application build time.

https://github.com/amake/orgro/issues/151#issuecomment-2908230128 https://forum.f-droid.org/t/how-to-use-shared-library-in-f-droid/22041

This results in failures like this at runtime:

I/flutter ( 2660): fallback to open DynamicLibrary on older devices
I/flutter ( 2660): Invalid argument(s): Failed to load dynamic library '/data/data/com.madlonkay.orgro/lib/libopenpgp_bridge.so': dlopen failed: library "/data/data/com.madlonkay.orgro/lib/libopenpgp_bridge.so" not found
I/flutter ( 2660): #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11)
I/flutter ( 2660): #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22)
I/flutter ( 2660): #2      Binding.openLib (package:openpgp/bridge/binding.dart:198)
I/flutter ( 2660): #3      new Binding._internal (package:openpgp/bridge/binding.dart:29)
I/flutter ( 2660): #4      Binding._instance (package:openpgp/bridge/binding.dart:18)
I/flutter ( 2660): #5      OpenPGPBridge.bindingEnabled (package:openpgp/openpgp_bridge.dart)
I/flutter ( 2660): #6      OpenPGPBridge.callSync (package:openpgp/openpgp_bridge.dart)
I/flutter ( 2660): #7      OpenPGPSync.decryptSymmetric (package:openpgp/openpgp_sync.dart:202)
I/flutter ( 2660): #8      decrypt (package:orgro/src/encryption.dart:81)
I/flutter ( 2660): #9      compute.<anonymous closure> (package:flutter/src/foundation/_isolates_io.dart:23)
I/flutter ( 2660): #10     _RemoteRunner._run (dart:isolate:1118)
I/flutter ( 2660): #11     _RemoteRunner._remoteExecute (dart:isolate:1112)
I/flutter ( 2660): #12     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:318)
I/flutter ( 2660): #13     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:194)

I understand that this is arguably an F-Droid problem, but it is something that consumers of this plugin need to know if they want to publish to F-Droid.

amake avatar May 26 '25 01:05 amake

Examples of F-Droid apps that are building golang binaries as part of their app recipes:

https://gitlab.com/search?search=%5Cb%22go+build%22&nav_source=navbar&project_id=36528&group_id=28397&search_code=true&repository_ref=master&regex=true

amake avatar May 27 '25 02:05 amake

It would satisfy F-Droid's requirements for flutter-openpgp to build the binaries at app build time, but failing that it seems the expected thing is for app developers to arrange for building any such binary dependencies as part of the F-Droid build phase:

https://forum.f-droid.org/t/correct-fix-for-scandeleted-binaries-in-dependency/32256/1

I will post my solution when it's confirmed working.

amake avatar May 28 '25 05:05 amake

Here is an F-Droid build configuration that successfully results in a working APK containing flutter-openpgp binaries: https://gitlab.com/fdroid/fdroiddata/-/blob/d66b0431d0daa192521e5059f5ef0ce7b6ab9cd1/metadata/com.madlonkay.orgro.yml#L1226

amake avatar Jun 04 '25 14:06 amake

@amake thanks for this. I really appreciate the time you took to implement it. Sorry I couldn’t be of help

jerson avatar Jun 04 '25 15:06 jerson