Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F-Droid can't build #2123

Open
licaon-kter opened this issue Feb 26, 2024 · 6 comments
Open

F-Droid can't build #2123

licaon-kter opened this issue Feb 26, 2024 · 6 comments

Comments

@licaon-kter
Copy link

ref: https://monitor.f-droid.org/builds/log/org.strongswan.android/81#site-footer

Ah, easy... let me bump NDK... umm OpenSSL does not build with 26, will use 2 versions then:

  - versionName: 2.5.0
    versionCode: 81
    commit: 4be75c5ab14a9983cc075a7a65ce4a4f4717f805
    subdir: src/frontends/android/app
    sudo:
      - apt-get update
      - apt-get install -y automake bison flex gettext gperf libtool make pkg-config
      - apt-get install -y openjdk-17-jdk-headless
      - update-java-alternatives -a
    gradle:
      - yes
    srclibs:
      - OpenSSL@OpenSSL_1_1_1t
    prebuild:
      - sdkmanager 'ndk;21.4.7075529'
      - sed -i -e "/clean.dependsOn 'cleanNative'/d" build.gradle
    scandelete:
      - testing
    build:
      - lib="$PWD/src/main/jni/openssl"
      - export ANDROID_NDK_HOME=$$SDK$$/ndk/21.4.7075529
      - export PATH=/opt/android-sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/android-sdk/tools:/opt/android-sdk/platform-tools:/opt/gradle/bin
      - pushd $$OpenSSL$$
      - export CC=armv7a-linux-androideabi16-clang
      - ./Configure android-arm no-shared no-ssl3 no-engine no-dso no-asm no-hw no-comp
        no-stdio -fPIC -DOPENSSL_PIC -D__ANDROID_API__=16 -ffast-math -O3 -funroll-loops
      - make -j $(nproc)
      - mkdir -p "${lib}/armeabi-v7a"
      - cp libcrypto.a ${lib}/armeabi-v7a/
      - make distclean
      - export CC=aarch64-linux-android21-clang
      - ./Configure android-arm64 no-shared no-ssl3 no-engine no-dso no-asm no-hw
        no-comp no-stdio -fPIC -DOPENSSL_PIC -D__ANDROID_API__=21 -ffast-math -O3
        -funroll-loops
      - make -j $(nproc)
      - mkdir -p "${lib}/arm64-v8a"
      - cp libcrypto.a ${lib}/arm64-v8a/
      - make distclean
      - export CC=i686-linux-android16-clang
      - ./Configure android-x86 no-shared no-ssl3 no-engine no-dso no-asm no-hw no-comp
        no-stdio -fPIC -DOPENSSL_PIC -D__ANDROID_API__=16 -ffast-math -O3 -funroll-loops
      - make -j $(nproc)
      - mkdir -p "${lib}/x86"
      - cp libcrypto.a ${lib}/x86/
      - make distclean
      - export CC=x86_64-linux-android21-clang
      - ./Configure android-x86_64 no-shared no-ssl3 no-engine no-dso no-asm no-hw
        no-comp no-stdio -fPIC -DOPENSSL_PIC -D__ANDROID_API__=21 -ffast-math -O3
        -funroll-loops
      - make -j $(nproc)
      - mkdir -p "${lib}/x86_64"
      - cp libcrypto.a ${lib}/x86_64/
      - cp -R include/ ${lib}/
      - make distclean
      - popd
      - export ANDROID_NDK_HOME=/opt/android-sdk/ndk/26.1.10909125
      - export PATH=/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/android-sdk/tools:/opt/android-sdk/platform-tools:/opt/gradle/bin
      - echo "LOCAL_PATH := \$(call my-dir)" >"${lib}/Android.mk"
      - echo "include \$(CLEAR_VARS)" >>"${lib}/Android.mk"
      - echo "LOCAL_MODULE := libcrypto_static" >>"${lib}/Android.mk"
      - echo "LOCAL_SRC_FILES := \$(TARGET_ARCH_ABI)/libcrypto.a" >>"${lib}/Android.mk"
      - echo "LOCAL_EXPORT_C_INCLUDES := \$(LOCAL_PATH)/include" >>"${lib}/Android.mk"
      - echo "include \$(PREBUILT_STATIC_LIBRARY)" >>"${lib}/Android.mk"
      - cd ../../../../
      - ./autogen.sh
      - ./configure --disable-defaults --verbose
      - make dist -j $(nproc)
    ndk: 26.1.10909125

ok... we juggle versions... OpenSSL builds... but then

...
~/build/org.strongswan.android/src/frontends/android/app
+ export ANDROID_NDK_HOME=/opt/android-sdk/ndk/26.1.10909125
+ ANDROID_NDK_HOME=/opt/android-sdk/ndk/26.1.10909125
+ export PATH=/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/android-sdk/tools:/opt/android-sdk/platform-tools:/opt/gradle/bin
+ PATH=/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/android-sdk/tools:/opt/android-sdk/platform-tools:/opt/gradle/bin
+ echo 'LOCAL_PATH := $(call my-dir)'
+ echo 'include $(CLEAR_VARS)'
+ echo 'LOCAL_MODULE := libcrypto_static'
+ echo 'LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libcrypto.a'
+ echo 'LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include'
+ echo 'include $(PREBUILT_STATIC_LIBRARY)'
+ cd ../../../../
+ ./autogen.sh
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4/config'.
libtoolize: copying file 'm4/config/libtool.m4'
libtoolize: copying file 'm4/config/ltoptions.m4'
libtoolize: copying file 'm4/config/ltsugar.m4'
libtoolize: copying file 'm4/config/ltversion.m4'
libtoolize: copying file 'm4/config/lt~obsolete.m4'
configure.ac:376: installing './compile'
configure.ac:379: installing './config.guess'
configure.ac:379: installing './config.sub'
configure.ac:24: installing './install-sh'
configure.ac:24: installing './missing'
fuzz/Makefile.am: installing './depcomp'
configure.ac: installing './ylwrap'
+ ./configure --disable-defaults --verbose
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '1000' is supported by ustar format... yes
checking whether GID '1000' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking configured UDP ports (500, 4500)... ok
checking for gcc... x86_64-linux-android21-clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/home/vagrant/build/org.strongswan.android':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

odd I'll enter the VM, retry ./configure but now it works, what....??? whatever

we'll come back later, carry on

$ cd src/frontends/android/app
$ gradle assembleRelease
...
> Task :app:configureNdkBuildRelease[arm64-v8a] FAILED
> Task :app:lintVitalAnalyzeRelease

FAILURE: Build failed with an exception.

full log:
log.log

Umm, now what?

@tobiasbrunner
Copy link
Member

Ah, easy... let me bump NDK

Note that we now have the NDK version set in ndkVersion in build.gradle.

... umm OpenSSL does not build with 26 ...

  • OpenSSL@OpenSSL_1_1_1t

Why use OpenSSL 1.1.1 and not OpenSSL 3.x? (I know newer versions of OpenSSL 3.x currently don't build with the NDK, but otherwise 3.x builds fine with 26.1.10909125). We also provide a build script for OpenSSL. It uses Docker by default, but that can be disabled via NO_DOCKER=1.

Also note that running autogen.sh, configure and make dist is only to generate some files (e.g. parsers etc.) in the source directory when building from the repository (as compared to a release tarball, which contains these generated files). This is not meant to be run with the NDK. The build eventually failed because one of the generated files (oid.c, which is generated from oid.txt with a Perl script) was missing.

@tobiasbrunner tobiasbrunner removed the bug label Feb 27, 2024
@licaon-kter
Copy link
Author

right 3.2.1 hits openssl/openssl#22181 (do we want to patch it like android/ndk#1992 (comment) ?)

downgraded to 3.1.2 for now

recipe

  - versionName: 2.5.1
    versionCode: 82
    commit: b21178b43ced84c091ee15541035db5bcc6b280c
    subdir: src/frontends/android/app
    sudo:
      - apt-get update
      - apt-get install -y automake bison flex gettext gperf jq libtool make pkg-config
      - apt-get install -y openjdk-17-jdk-headless
      - update-java-alternatives -a
    gradle:
      - yes
    srclibs:
      - OpenSSL@openssl-3.1.2
    prebuild: sed -i -e "/clean.dependsOn 'cleanNative'/d" build.gradle
    scandelete:
      - testing
    build:
      - export ANDROID_NDK_ROOT=$$NDK$$
      - export ANDROID_NDK_HOME=$$NDK$$
      - export lib="$PWD/src/main/jni/openssl"
      - export script="$PWD/../openssl"
      - pushd $$OpenSSL$$
      - OUT_DIR=$lib $script/compile.sh
      - popd
      - echo "LOCAL_PATH := \$(call my-dir)" >"${lib}/Android.mk"
      - echo "include \$(CLEAR_VARS)" >>"${lib}/Android.mk"
      - echo "LOCAL_MODULE := libcrypto_static" >>"${lib}/Android.mk"
      - echo "LOCAL_SRC_FILES := \$(TARGET_ARCH_ABI)/libcrypto.a" >>"${lib}/Android.mk"
      - echo "LOCAL_EXPORT_C_INCLUDES := \$(LOCAL_PATH)/include" >>"${lib}/Android.mk"
      - echo "include \$(PREBUILT_STATIC_LIBRARY)" >>"${lib}/Android.mk"
      - cd ../../../../
      - ./autogen.sh
      - ./configure --disable-defaults --verbose
      - make dist -j $(nproc)
    ndk: 26.1.10909125

can you test this APK? org.strongswan.android_82.apk.ZIP (remove .ZIP from name)

@tobiasbrunner
Copy link
Member

prebuild: sed -i -e "/clean.dependsOn 'cleanNative'/d" build.gradle

You can remove that, the file doesn't contain the manual NDK invocations anymore since 1cab544.

echo "LOCAL_PATH := $(call my-dir)" >"${lib}/Android.mk"

The manual creation of ${lib}/Android.mk wouldn't be necessary if you called build.sh instead of compile.sh (pass NO_DOCKER=1 to it so it calls compile.sh directly instead of using Docker).

can you test this APK?

Not really, sorry.

@licaon-kter
Copy link
Author

Not really, sorry.

Ok, we postpone the update until confirmed working

@celesteking
Copy link

While on it, can we kick someone at EPEL to get the latest package built and released? Right now EL8 is shipping strongswan 5.9.10 package which contains buggy EAP-TLS implementation, which means none of Windows clients would connect. Spent half a day debugging that only to realize it wasn't on my side. Thanks.

https://packages.fedoraproject.org/pkgs/strongswan/strongswan/

@tobiasbrunner
Copy link
Member

While on it, can we kick someone at EPEL to get the latest package built and released?

I don't see how the two are related. Anyway, there is already an open ticket to package newer versions. Feel free to chime in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants