F-Droid can't build 162
What are we missing? https://gist.github.com/licaon-kter/907455429847dbaddc1d4651a7cc9744
/LE: install libc++1-7 fixes it.
@licaon-kter It seems the F-Droid build for 1.28.0 (versionCode 64) contains an invalid shared object somehow that makes the app crash 😬
Here are details on the topic: https://github.com/markusfisch/BinaryEye/issues/113#issuecomment-630249889
The shared object, librs.rotator.so, holds the native RenderScript kernel to rotate the camera frame. This library gets build (for each supported architecture) by the RenderScript compiler in the Android build tools.
I don't know why, but dlopen can't load librs.rotator.so (on at least the devices I get reports from) because there's apparently a segment (which is 0 bytes long?) "past end of file":
E(30566:30663) Unable to open shared library (/data/user/0/de.markusfisch.android.binaryeye//lib/librs.rotator.so): dlopen failed: invalid ELF file "/data/app/de.markusfisch.android.binaryeye-2/lib/arm/librs.rotator.so" load segment[5]: p_offset (0x3000) + p_filesz (0x0) ( = 0x3000) past end of file (0x2550)
Do you have any idea what's causing the issue?
I'm building the app on Ubuntu 18.04.4 LTS without a "side by side NDK".
How to trigger that? What devices? What Android version? What arches?
Fyi no issue here, but I don't know the repro steps.
https://github.com/markusfisch/BinaryEye/issues/113 comes from a user on a OnePlus X (according to the internet an ARMv7) with Android 6.0.1.
I've tried a couple of my own test devices and found that the crash also happens on a Yotaphone 2 which also runs Android 6.0.1 and also has an ARMv7. So it may be related to Android 6.0.1 or ARMv7 or both.
I'll try to find more devices to check this on.
Just found out that if the NDK (at least if it's 21) is installed alongside the build tools, the app will crash on the Yotaphone 2 and also on a Moto E running Android 6.0.
Without the NDK, the app runs just fine!
As far as I know, RenderScript will either be built with RenderScript's own tools or, if an NDK is present, by using the NDK.
If there's no NDK, gradle will print this warning:
WARNING: Compatible side by side NDK version was not found. Default is 20.0.5594570.
Compatible side by side NDK version was not found. Default is 20.0.5594570.
So, at least the OnePlus X, the Yotaphone 2 and the Moto E cannot use librs.rotator.so if it's build by the NDK.
@markusfisch ok
warning: Linking two modules of different data layouts: '/home/strech/android-sdk-linux/build-tools/29.0.3/renderscript/lib/bc/armeabi-v7a/libclcore.bc' is 'e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64' whereas '/home/strech/fdroiddata/build/de.markusfisch.android.binaryeye/app/build/generated/res/rs/release/raw/bc32/rotator.bc' is 'e-p:32:32-i64:64-v128:64:128-n32-S64'
warning: Linking two modules of different target triples: /home/strech/android-sdk-linux/build-tools/29.0.3/renderscript/lib/bc/armeabi-v7a/libclcore.bc' is 'armv7--linux-android' whereas '/home/strech/fdroiddata/build/de.markusfisch.android.binaryeye/app/build/generated/res/rs/release/raw/bc32/rotator.bc' is 'armv7-none-linux-gnueabi'
warning: Linking two modules of different data layouts: '/home/strech/android-sdk-linux/build-tools/29.0.3/renderscript/lib/bc/x86/libclcore.bc' is 'e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64' whereas '/home/strech/fdroiddata/build/de.markusfisch.android.binaryeye/app/build/generated/res/rs/release/raw/bc32/rotator.bc' is 'e-p:32:32-i64:64-v128:64:128-n32-S64'
warning: Linking two modules of different target triples: /home/strech/android-sdk-linux/build-tools/29.0.3/renderscript/lib/bc/x86/libclcore.bc' is 'armv7--linux-android' whereas '/home/strech/fdroiddata/build/de.markusfisch.android.binaryeye/app/build/generated/res/rs/release/raw/bc32/rotator.bc' is 'armv7-none-linux-gnueabi'
warning: Linking two modules of different target triples: /home/strech/android-sdk-linux/build-tools/29.0.3/renderscript/lib/bc/x86_64/libclcore.bc' is 'aarch64--linux-android' whereas '/home/strech/fdroiddata/build/de.markusfisch.android.binaryeye/app/build/generated/res/rs/release/raw/bc64/rotator.bc' is 'aarch64-none-linux-gnueabi'
warning: Linking two modules of different target triples: /home/strech/android-sdk-linux/build-tools/29.0.3/renderscript/lib/bc/arm64-v8a/libclcore.bc' is 'aarch64--linux-android' whereas '/home/strech/fdroiddata/build/de.markusfisch.android.binaryeye/app/build/generated/res/rs/release/raw/bc64/rotator.bc' is 'aarch64-none-linux-gnueabi'
...these are related? seeing them with 21 too
Ok I can repro by forcing 21, but... the metadata does not ask for 21 so it should default to 12b.
@licaon-kter I get the same warnings but since the difference seems to be just aarch64--linux-android and aarch64-none-linux-gnueabi, it's probably save to ignore them. At the very least, I can confirm the resulting build works on all target platforms.
About the metadata and 21 - I suppose you mean NDK version 21? If so, does a build using NDK 21 work on Android 6 on ARMv7 for you?
Because it's not working for me, at least not on the Yotaphone 2 or the Moto E. The APK does only work on all platforms (I tried) when it's compiled without the NDK.
Is it possible to specify this in the metadata?
I can repro by forcing 21
...means the error :)
Can't your specify not to use the NDK?
Not sure we have a "notNDK" metadata thing :(
Unfortunately, I can't configure build.gradle to not use the NDK 😞 I've tried setting android.ndkVersion to a non-existing value, but Gradle aborts if the value isn't valid. An empty string doesn't work either.
The only way that works for me is to explicitly set the old (and deprecated) environment variable ANDROID_NDK_HOME to nothing before invoking Gradle:
$ ANDROID_NDK_HOME=; ./gradlew assembleRelease
So I'm wondering if setting ndk_paths to nothing in the metadata for F-Droid would work?
We can do that, will try asap
A couple of days ago, I've opened this Merge Request with what I hope could resolve the problem: https://gitlab.com/fdroid/fdroiddata/-/merge_requests/6971
Would you mind having a look?