godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.81k stars 21.14k forks source link

More architectures need -latomic to build godot #77645

Open petterreinholdtsen opened 1 year ago

petterreinholdtsen commented 1 year ago

Godot version

3.5.1-stable

System information

Debian unstable on armel machine.

Issue description

Similar to the issue in #54393 for FreeBSD, Linux builds on at least armel and riscv64 also need to be linked to the atomic library. I tried to modify the scons build rules to get this working on armel, but had to give up as none of the approaches I tried worked. I tried modifying platform/x11/detect.py. The issue is reported to Debian as https://bugs.debian.org/1019868.

This is the proposed fix for the debian build, solving the issue outside scons:

diff --git a/debian/rules b/debian/rules
index f46330e3..51ceee03 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,6 +7,11 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 DPKG_EXPORT_BUILDFLAGS = 1
 include /usr/share/dpkg/buildflags.mk

+# Link with libatomic on archs where it is needed.
+ifeq ($(DEB_HOST_ARCH),$(filter $(GCC_MINOR),armel riscv64))
+       export DEB_LDFLAGS_MAINT_APPEND += -Wl,--no-as-needed -latomic -Wl,--as-needed
+endif
+
 override_dh_clean:
        dh_clean
        scons -c

Steps to reproduce

Try building 3.5.1 on Debian unstable using a armel machine.

Minimal reproduction project

N/A

akien-mga commented 1 year ago

Thanks for the report. We don't typically support nor test armel, on the ARM side we support armv7hl (Linux, Android, \~Windows) and arm64-v8 (Linux, Android, macOS, iOS, \~Windows).

I believe Debian's armel is for older armv5 generation chipsets? Is this the only change you had to do to get Godot to compile? Beyond compiling to satisfy distro packaging requirements, does it actually work?

petterreinholdtsen commented 1 year ago

I only got it to the point where it compiled and built .deb packages. Only got remote ssh access to a armel machine, so not able to test it any further. But the need for libatomic will be needed on any architecture where gcc inject calls to it for types not nativley atomic.

LinuxUserGD commented 1 year ago

For Linux GCC libatomic might not be necessary, see error for x86_64-gentoo-linux-musl with standalone LLVM/Clang/libc++ toolchain after uninstalling GCC on Gentoo Linux, which is similar to FreeBSD:

x86_64-gentoo-linux-musl-ld.lld: error: unable to find library -latomic
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
scons: *** [bin/godot.linuxbsd.template_release.x86_64.llvm.runner] Error 1
scons: building terminated because of errors.
petterreinholdtsen commented 1 year ago

[Linux User]

For Linux GCC libatomic might not be necessary,

Correct. Only needed on some architectures. x86_64 should not need it. -- Happy hacking Petter Reinholdtsen