Build fails on big-endian PowerPC due to missing AltiVec
Closed this issue · 6 comments
On Debian's big-endian PowerPC ports (powerpc and ppc64), openal-soft fails due to AltiVec not being available:
[ 7%] Building CXX object CMakeFiles/alsoft.common.dir/common/ringbuffer.cpp.o
[ 8%] Building CXX object CMakeFiles/alsoft.common.dir/common/strutils.cpp.o
/usr/bin/c++ -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/build-tree -I/<<PKGBUILDDIR>>/common -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wdate-time -D_FORTIFY_SOURCE=2 -std=gnu++17 -fPIC -fvisibility=hidden -Winline -Wunused -Wall -Wextra -Wshadow -Wconversion -Wcast-align -Wpedantic -Wold-style-cast -Wnon-virtual-dtor -Woverloaded-virtual -Wno-c++20-attribute-extensions -Wno-interference-size -Werror=undef -fno-math-errno -pthread -MD -MT CMakeFiles/alsoft.common.dir/common/ringbuffer.cpp.o -MF CMakeFiles/alsoft.common.dir/common/ringbuffer.cpp.o.d -o CMakeFiles/alsoft.common.dir/common/ringbuffer.cpp.o -c /<<PKGBUILDDIR>>/common/ringbuffer.cpp
/usr/bin/c++ -I/<<PKGBUILDDIR>>/include -I/<<PKGBUILDDIR>>/build-tree -I/<<PKGBUILDDIR>>/common -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wdate-time -D_FORTIFY_SOURCE=2 -std=gnu++17 -fPIC -fvisibility=hidden -Winline -Wunused -Wall -Wextra -Wshadow -Wconversion -Wcast-align -Wpedantic -Wold-style-cast -Wnon-virtual-dtor -Woverloaded-virtual -Wno-c++20-attribute-extensions -Wno-interference-size -Werror=undef -fno-math-errno -pthread -MD -MT CMakeFiles/alsoft.common.dir/common/strutils.cpp.o -MF CMakeFiles/alsoft.common.dir/common/strutils.cpp.o.d -o CMakeFiles/alsoft.common.dir/common/strutils.cpp.o -c /<<PKGBUILDDIR>>/common/strutils.cpp
In file included from /<<PKGBUILDDIR>>/common/pffft.cpp:102:
/usr/lib/gcc/powerpc64-linux-gnu/14/include/altivec.h:34:2: error: #error Use the "-maltivec" flag to enable PowerPC AltiVec support
34 | #error Use the "-maltivec" flag to enable PowerPC AltiVec support
| ^~~~~
/<<PKGBUILDDIR>>/common/pffft.cpp:103:14: error: ‘__vector’ does not name a type; did you mean ‘vector’?
103 | using v4sf = vector float;
| ^~~~~~
AltiVec should be available on these targets in general, although I'm not sure what we're currently using as the baseline on Debian for these two PowerPC targets.
Full log at: https://buildd.debian.org/status/fetch.php?pkg=openal-soft&arch=ppc64&ver=1%3A1.24.0-2&stamp=1732122545&raw=0
Ah, the change d6520c4 enables AltiVec unconditionally on PowerPC which it shouldn't do as not all PowerPC targets actually support it or the baseline may have disabled it.
I need to figure out what the currently baselines for these Debian targets are at the moment.
Looks like the __VEC__
and/or __ALTIVEC__
macros should be defined when AltiVec is enabled. Should be easy enough to add a check for them to avoid it when not available (done in commit 8474293). It would still be good to check up on what baseline you can use, enabling AltiVec/SIMD operations would help performance.
Thanks! The big-endian baseline was changed to a more generic one in 2016 and it's probably a good idea to raise it again to include AltiVec for both 32-bit and 64-bit PowerPC which we will discuss in Debian as I fully agree with your stance.
In the meantime, it would be great if this could be fixed so that the package will build again for the time being.
It should just be enough to check for __ALTIVEC__
:
glaubitz@perotto:~$ echo | gcc -maltivec -E -dM - |grep -i altivec
#define __ALTIVEC__ 1
#define __pixel __attribute__((altivec(pixel__))) unsigned short
#define __vector __attribute__((altivec(vector__)))
#define __bool __attribute__((altivec(bool__))) unsigned
#define __APPLE_ALTIVEC__ 1
glaubitz@perotto:~$ echo | gcc -mno-altivec -E -dM - |grep -i altivec
#define __pixel __attribute__((altivec(pixel__))) unsigned short
#define __vector __attribute__((altivec(vector__)))
#define __bool __attribute__((altivec(bool__))) unsigned
glaubitz@perotto:~$
Yes, this should fix it.