Problem building the android app

Hi

I want to setup a dev environment to build the android app.

I tried to build the native part with gradle but there are compilation problems

./gradlew --scan buildNative assembleDebug

Configure project :app Signing not ready. Did you specify a signingConfig for the variation Release?

Task syncthing:buildNative FAILED Starting build for arm

Building Syncthing

`# runtime/cgo

In file included from gcc_libinit.c:8:

In file included from /home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/pthread.h:37:

In file included from /home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/time.h:33: In file included from /home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/sys/time.h:37:

In file included from /home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/sys/select.h:36:

/home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/signal.h:96:18: error: expected ‘;’ at end of declaration list

/home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/asm/signal.h:85:22: note: expanded from macro ‘sa_handler’

In file included from gcc_libinit.c:8:

In file included from /home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/pthread.h:37:

In file included from /home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/time.h:33:

In file included from /home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/sys/time.h:37:

In file included from /home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/sys/select.h:36:

/home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/signal.h:97:12: error: expected ‘)’

/home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/asm/signal.h:86:24: note: expanded from macro ‘sa_sigaction’

/home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/signal.h:97:10: note: to match this ‘(’

/home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/signal.h:97:12: error: duplicate member ‘_u’

/home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/asm/signal.h:86:22: note: expanded from macro ‘sa_sigaction’

/home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin/…/sysroot/usr/include/signal.h:96:18: note: previous declaration is here

/home/jaoh/git/syncthing-android/syncthing/gobuild/standalone-ndk/android-14-arm/bin /…/sysroot/usr/include/asm/signal.h:85:20: note: expanded from macro ‘sa_handler’ `

FAILURE: Build failed with an exception.

What went wrong: Execution failed for task ‘syncthing:buildNative’. Process ‘command ‘./build-syncthing.bash’’ finished with non-zero exit value 2

BUILD FAILED in 48s 1 actionable task: 1 executed

is this a knowen mistake on my side or is the build broken ?

Looks that there are eigher two ndks or you pointed the ndk somewhere incorrectly.

Thanks for the reply

The standalone ndk gets generated by the build script, it is part of the gobuild.

I only have one ndk installed.

The NDK home looks good or is it wrong ?

jaoh@jaoh-Erazer-P6661-MD99873:~/git/syncthing-android$ echo $ANDROID_NDK_HOME /home/jaoh/git/syncthing-android/ndktest/android-ndk-r15c/

jaoh@jaoh-Erazer-P6661-MD99873:~/git/syncthing-android$ ls $ANDROID_NDK_HOME build meta ndk-depends ndk-stack platforms python-packages shader-tools source.properties sysroot CHANGELOG.md ndk-build ndk-gdb ndk-which prebuilt README.md simpleperf sources toolchains

I switched from go 1.10.1 to go 1.7.5
If I remember the documentation (https://docs.syncthing.net/dev/building.html#prerequisites) correctly there is no upper version limit for go.

Should I open a bug report ?

Does it work with go 1.7.5? If yes, then probably yeah as a compatibility with go 1.10.1 issue.

Yes there is some problem with Go 1.10 in the Android build, but I have not idea what. 1.9 is the last version that works right now.

1 Like

The changed something regarding Cgo and the mapping of pointers.

https://golang.org/doc/go1.10

I opend an issue on Github

I would actually need to understand how the build process of the native part works and where cgo is used.