Catfriend1 / syncthing-android

Syncthing-Fork - A Syncthing Wrapper for Android.
Mozilla Public License 2.0
1.92k stars 57 forks source link

F-Droid build failed 1.21.0.3 / Downgrade NDK r25b > r24 / python(3)? #919

Closed linsui closed 1 year ago

linsui commented 2 years ago

Description of the issue

# github.com/syncthing/syncthing/cmd/syncthing
/home/vagrant/build/syncthing-android-prereq/go_1.19.1/pkg/tool/linux_amd64/link: running /home/vagrant/build/com.github.catfriend1.syncthingandroid/syncthing/../../syncthing-android-prereq/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi19-clang failed: exit status 1
clang-14: error: unable to execute command: posix_spawn failed: Exec format error
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

exit status 2
exit status 1
Traceback (most recent call last):
  File "./build-syncthing.py", line 385, in <module>
    ] + ['-no-upgrade', 'build'], env=environ, cwd=syncthing_dir)
  File "/usr/lib/python2.7/subprocess.py", line 186, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/vagrant/build/com.github.catfriend1.syncthingandroid/syncthing/../../syncthing-android-prereq/go_1.19.1/bin/go', 'run', 'build.go', '-goos', 'android', '-goarch', 'arm', '-cc', '/home/vagrant/build/com.github.catfriend1.syncthingandroid/syncthing/../../syncthing-android-prereq/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi19-clang', '-version', u'v1.21.0', '-no-upgrade', 'build']' returned non-zero exit status 1

https://monitor.f-droid.org/builds/log/com.github.catfriend1.syncthingandroid/1210003#site-footer

Could you please take a look? Thanks!

Catfriend1 commented 2 years ago

Sure, give me some time :)

Catfriend1 commented 2 years ago

image

Got the same problem too on my Debian builder. I wonder what's the root cause here as it builds fine under Windows.

Catfriend1 commented 2 years ago

Maybe related: https://github.com/android/ndk/issues/1755

Catfriend1 commented 2 years ago

This workaround didn't help: https://github.com/android/ndk/issues/1755#issuecomment-1258064065

linsui commented 2 years ago

Can we downgradle the ndk?

Catfriend1 commented 2 years ago

I did this a minute ago , see the new tag, please: https://github.com/Catfriend1/syncthing-android-fdroid/commits/v1.21.0.3 I'll now wait and see if it builds...

linsui commented 2 years ago

It works. Thanks! Could you please invoke python with python3? Debian doesn't have the python link anymore but python3 is always available.

linsui commented 2 years ago

https://gitlab.com/fdroid/fdroiddata/-/merge_requests/11944

Catfriend1 commented 2 years ago

Okay, will see what scripts are affected during my next session :)

Catfriend1 commented 2 years ago

https://monitor.f-droid.org/builds/log/com.github.catfriend1.syncthingandroid/1210003#site-footer

Successful build :-). Thank you.

Catfriend1 commented 2 years ago

@linsui My Windows system has "C:\Program Files\Python39\python.exe" to invoke python. There is no "python3". I still could change it, but then the README.md on the front page would not be accurate to build on Windows - the user would have to manually create a symlink first.

Do you know a way to list alternatives for the same command in the "build.gradle", so we could some how conditionally decide there if it's "python" or "python3" to call?

linsui commented 2 years ago

If it's difficult, the current patch is good to me. To check if python exists you can run python --version and check if the it succeeds. https://stackoverflow.com/questions/46461898/using-gradle-how-can-i-ensure-that-a-command-exists

binsys commented 2 years ago

https://github.com/android/ndk/issues/1755#issuecomment-1258064065 work for me Please don't cp file just one command please replace [/home/binsys/work/] with your path

workaround: patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 [/home/binsys/work/]android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang-14

@Catfriend1

Catfriend1 commented 1 year ago

https://github.com/Catfriend1/syncthing-android/commit/46824cef69f747a36414fd533ce7439fa5017390

linsui commented 1 year ago

Thanks!

guss77 commented 1 year ago

I still seem to have this issue on builds on Ubuntu 22.10:

                clang-14: error: unable to execute command: posix_spawn failed: Exec format error
                clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

Reverting to NDK 24 works around the problem for me, but running patchelf does not (not that it is a good idea to use it anyway, as it isn't installed by default).

ImranR98 commented 5 days ago

Just noting that this is still an issue on the latest main branch, at least for me on Fedora 41. Reverting to NDK 24 does work around it.