DeaDBeeF-Player / deadbeef

DeaDBeeF Player
https://deadbeef.sourceforge.io/
Other
1.65k stars 178 forks source link

Building on aarch64 clang<18 fails due to unsupported -fstack-clash-protection #3038

Closed rsekman closed 10 months ago

rsekman commented 10 months ago

I was checking if deadbeef would build on my Raspberry Pi 4, i.e. aarch64. It does, but not out of the box. The reason is that before version 18 clang does not support -fstack-clash-protection and emits a -Wunused-command-line-argument warning. See this example: https://godbolt.org/z/hjPEq7P4s. Now, the gtkui Makefile also specifies -Werror, so the build fails.

The workaround for this is to make sure -Wno-error=unused-command-line-argument is set. I'm not sure whether this should be the responsibility of the packager, in which case deadbeef doesn't need to change anything; or not, in which case this is a simple fix.

Deadbeef version: master OS:

uname -a
Linux schwarzschild 6.6.10-1-rpi-ARCH #1 SMP PREEMPT Mon Jan  8 07:41:07 MST 2024 aarch64 GNU/Linux
Oleksiy-Yakovenko commented 10 months ago

So you want to pass -fstack-clash-protection argument, but at the same time want the build system to ignore it and not fail? If you are passing this -- what is preventing you from also passing -Wno-error=unused-command-line-argument? You can do it all on your machine, locally.

Oleksiy-Yakovenko commented 10 months ago

Closing because I don't understand what problem needs solving. Works as designed.

rsekman commented 10 months ago

So you want to pass -fstack-clash-protection argument, but at the same time want the build system to ignore it and not fail?

On x86, -fstack-clash-protection is implemented. Everything works fine.

On aarch64 and clang < 18, -fstack-clash-protection is a no-op. For most of the codebase this just results in a harmless warning. However the gtkui plugin builds with -Werror and then that warning is promoted to a fatal error. Maybe there is a good reason for it to use -Werror; in that case the least impactful way to match the x86 build is to add -Wno-error=unused-command-line-argument.

If you are passing this -- what is preventing you from also passing -Wno-error=unused-command-line-argument? You can do it all on your machine, locally.

Nothing at all, I've done so in my PKGBUILD. But in the spirit of FOSS I'd like this to benefit anyone else who might want to build deadbeef on a Raspberry Pi.

Closing because I don't understand what problem needs solving. Works as designed.

Problem that needs solving: FTBFS on aarch64 with the instructions in the README. I understand if you only want to target x86! But the fix is minimal and is a no-op on x86 (where -fstack-clash-protection only raises a warning on clang <9 or something ancient like that).

Oleksiy-Yakovenko commented 10 months ago

My point is that this argument is not used by the deadbeef build scripts. You're adding this argument in your local script, and you need to handle the problems this causes.

rsekman commented 10 months ago

My point is that this argument is not used by the deadbeef build scripts.

OH. Now I get what you mean!

You're adding this argument in your local script,

I'm not, I was using the same PKGBUILD to compile on aarch64 as on x86. But it seems automake does it... On aarch64:

deadbeef% grep fstack-clash Make*
Makefile:CFLAGS = -march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection  -D_GNU_SOURCE -D__EXTENSIONS__  -DLIBDIR=\"${exec_prefix}/lib\" -DPREFIX=\"/usr\" -DDOCDIR=\"${datarootdir}/doc/${PACKAGE_TARNAME}\" -DDDB_WARN_DEPRECATED=1
Makefile:CXXFLAGS = -march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -Wp,-D_GLIBCXX_ASSERTIONS  -D_GNU_SOURCE -D__EXTENSIONS__  -DLIBDIR=\"${exec_prefix}/lib\" -DPREFIX=\"/usr\" -DDOCDIR=\"${datarootdir}/doc/${PACKAGE_TARNAME}\" -DDDB_WARN_DEPRECATED=1

on x86:

deadbeef% grep ^CFLAGS Makefile
CFLAGS = -g -O2  -D_GNU_SOURCE -D__EXTENSIONS__  -DLIBDIR=\"${exec_prefix}/lib\" -DPREFIX=\"/usr\" -DDOCDIR=\"${datarootdir}/doc/${PACKAGE_TARNAME}\" -DDDB_WARN_DEPRECATED=1

and you need to handle the problems this causes.

Yeah, I totally agree now. It seems it's automake defaults or something differing between the architectures. Thank you for taking the time to help me figure this out.

Oleksiy-Yakovenko commented 10 months ago

What if you don't use PKGBUILD and just run ./configure? Does it add this?

rsekman commented 10 months ago

I won't have time to check today or next week but I will look into that. Thanks for the help.