devgianlu / Aria2App

Aria2App is an advanced download manager based on aria2 that can handle remote servers too.
GNU General Public License v3.0
1.1k stars 88 forks source link

F-Droid can't build #331

Open licaon-kter opened 1 month ago

licaon-kter commented 1 month ago

ref: https://monitor.f-droid.org/builds/log/com.gianlu.aria2app/230#site-footer

so I changed NDK to 26 but now it fails differently

In file included from main.cc:45:
In file included from ./MultiUrlRequestInfo.h:45:
In file included from ./DownloadResult.h:47:
In file included from ./RequestGroup.h:48:
In file included from ./Request.h:42:
In file included from ./TimerA2.h:43:
./a2functional.h:106:39: error: no template named 'binary_function' in namespace 'std'; did you mean '__binary_function'?
class LeastRecentAccess : public std::binary_function<T, T, bool> {
                                 ~~~~~^~~~~~~~~~~~~~~
                                      __binary_function
/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/c++/v1/__functional/binary_
function.h:49:1: note: '__binary_function' declared here
using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>;
^
In file included from AbstractAuthResolver.cc:37:
./a2functional.h:106:39: error: no template named 'binary_function' in namespace 'std'; did you mean '__binary_function'?
class LeastRecentAccess : public std::binary_function<T, T, bool> {
                                 ~~~~~^~~~~~~~~~~~~~~
                                      __binary_function
/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/c++/v1/__functional/binary_
function.h:49:1: note: '__binary_function' declared here
using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>;
^
In file included from AbstractCommand.cc:35:
In file included from ./AbstractCommand.h:44:
In file included from ./TimerA2.h:43:
./a2functional.h:106:39: error: no template named 'binary_function' in namespace 'std'; did you mean '__binary_function'?
class LeastRecentAccess : public std::binary_function<T, T, bool> {
                                 ~~~~~^~~~~~~~~~~~~~~
                                      __binary_function
/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/c++/v1/__functional/binary_function.h:49:1: note: '__binary_function' declared here
using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>;
^
1 error generated.
In file included from AbstractHttpServerResponseCommand.cc:35:
In file included from ./AbstractHttpServerResponseCommand.h:42:
In file included from ./TimerA2.h:43:
./a2functional.h:106:39: error: no template named 'binary_function' in namespace 'std'; did you mean '__binary_function'?
class LeastRecentAccess : public std::binary_function<T, T, bool> {
                                 ~~~~~^~~~~~~~~~~~~~~
                                      __binary_function
/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/c++/v1/__functional/binary_function.h:49:1: note: '__binary_function' declared here
using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>;
^
make[3]: *** [Makefile:2638: AbstractAuthResolver.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from AbstractDiskWriter.cc:48:
In file included from ./util.h:59:
./a2functional.h:106:39: error: no template named 'binary_function' in namespace 'std'; did you mean '__binary_function'?
class LeastRecentAccess : public std::binary_function<T, T, bool> {
                                 ~~~~~^~~~~~~~~~~~~~~
                                      __binary_function
/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/c++/v1/__functional/binary_function.h:49:1: note: '__binary_function' declared here
using __binary_function = __binary_function_keep_layout_base<_Arg1, _Arg2, _Result>;
^
1 error generated.
make[3]: *** [Makefile:2638: AbstractDiskWriter.lo] Error 1
1 error generated.
make[3]: *** [Makefile:2622: main.o] Error 1
1 error generated.
make[3]: *** [Makefile:2638: AbstractHttpServerResponseCommand.lo] Error 1
1 error generated.
make[3]: *** [Makefile:2638: AbstractCommand.lo] Error 1
make[2]: *** [Makefile:2679: all-recursive] Error 1
make[1]: *** [Makefile:557: all-recursive] Error 1
make: *** [Makefile:468: all] Error 2
./bin/armeabi-v7a/bin/aria2c: ERROR: cannot stat `./bin/armeabi-v7a/bin/aria2c' (No such file or directory)

what am I missing?

/LE: fyi https://gitlab.com/fdroid/fdroiddata/-/commit/ab6788e9070a318a2b80c2a963aa5bc5a8a83bc8

licaon-kter commented 1 month ago

tried with NDK 25 locally and... it builds fine :shrug:

I've reenabled the build so it's retried in the next cycle: https://gitlab.com/fdroid/fdroiddata/-/commit/ba96949a3f28f23f6bb847aa2de1050a59d7b5c6

devgianlu commented 1 month ago

Not sure what is breaking because in the first log you attached the binaries are built just fine:

./bin/armeabi-v7a/bin/aria2c: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, with debug_info, not stripped
./bin/arm64-v8a/bin/aria2c: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, with debug_info, not stripped
./bin/x86/bin/aria2c: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, with debug_info, not stripped
./bin/x86_64/bin/aria2c: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, with debug_info, not stripped
Done building aria2c binaries!
linsui commented 3 weeks ago

It builds but the apk is very large. https://monitor.f-droid.org/builds/log/com.gianlu.aria2app/230#site-footer

> Task :aria2lib:stripFossReleaseDebugSymbols

[CXX1104] NDK from ndk.dir at /opt/android-sdk/ndk/25.0.8775105 had version [25.0.8775105] which disagrees with android.ndkVersion [26.1.10909125]

[CXX1104] NDK from ndk.dir at /opt/android-sdk/ndk/25.0.8775105 had version [25.0.8775105] which disagrees with android.ndkVersion [26.1.10909125]

[CXX1104] NDK from ndk.dir at /opt/android-sdk/ndk/25.0.8775105 had version [25.0.8775105] which disagrees with android.ndkVersion [26.1.10909125]

[CXX1104] NDK from ndk.dir at /opt/android-sdk/ndk/25.0.8775105 had version [25.0.8775105] which disagrees with android.ndkVersion [26.1.10909125]

Unable to strip the following libraries, packaging them as they are: libaria2c.so.
licaon-kter commented 3 weeks ago

ah, so I guess @devgianlu has NDK 26 (?) installed somewhere in the system, and that one does the stripping... but unknowingly

I tried to map the cases back in https://gitlab.com/fdroid/fdroidserver/-/issues/1207#note_1881935461

maybe I never tested to install ndk 26 via sdkmanager and keep ndk: as 25

devgianlu commented 3 weeks ago

ah, so I guess @devgianlu has NDK 26 (?) installed somewhere in the system, and that one does the stripping... but unknowingly

The APKs for Google Play and FOSS are build with GH Actions: https://github.com/devgianlu/Aria2App/blob/master/.github/workflows/android.yml

linsui commented 2 weeks ago

Those prebuilt libs are used in the action. F-Droid builds them from source.

devgianlu commented 2 weeks ago

Yes, but the stripping should be done in that CI. The CI that built them does not strip: https://github.com/devgianlu/aria2-android/blob/master/.github/workflows/build.yml

linsui commented 2 weeks ago

The prebuilt libs are about 5MB while our builds are about 50MB... So maybe we should just build the libs with an old NDK?

devgianlu commented 2 weeks ago

Oh... I thought 5MB was already a lot, but it looks like they are indeed stripped:

Aria2App/aria2lib/src/main/jniLibs/arm64-v8a/libaria2c.so:   ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, stripped
Aria2App/aria2lib/src/main/jniLibs/armeabi-v7a/libaria2c.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, stripped
Aria2App/aria2lib/src/main/jniLibs/x86/libaria2c.so:         ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker, stripped
Aria2App/aria2lib/src/main/jniLibs/x86_64/libaria2c.so:      ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, stripped

No idea where they have been stripped and not sure why your build is complaining about the NDK version which I haven't set anywhere explicitly.

linsui commented 2 weeks ago

I also can't find the ndk version. And it seems you don't have any ndk installed when building the apk.

linsui commented 2 weeks ago

The ndk version is from a default value of AGP. Can you set a valid value of ndkVersion? It seems 25.2.9519653 is the newest ndk version that can still build the lib and an older version may produce smaller libs.