On 2024/06/24 21:49, Thomas Frohwein wrote:
> On Mon, Jun 24, 2024 at 12:35:03PM +0100, Stuart Henderson wrote:
> 
> [...]
> 
> > This one fails on i386,
> > 
> > FAILED: powder.p/src_X86KillDenormals.cpp.o
> > c++ -Ipowder.p -I. -I../The-Powder-Toy-98.2.365 -Isrc 
> > -I../The-Powder-Toy-98.2.365/src -Iresources 
> > -I../The-Powder-Toy-98.2.365/resourc
> > es -I/usr/include -I/usr/local/include/libpng16 -I/usr/local/include/SDL2 
> > -I/usr/X11R6/include -I/usr/local/include/luajit-2.1 -I/usr/l
> > ocal/include -fdiagnostics-color=always -D_LIBCPP_ENABLE_ASSERTIONS=1 
> > -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++17 -fno-rtti -
> > O2 -pipe -D_REENTRANT -pthread -ftree-vectorize -funsafe-math-optimizations 
> > -ffast-math -fomit-frame-pointer -Wno-invalid-offsetof -Wno
> > -unused-result -Wno-missing-field-initializers -Wno-unused-parameter -MD 
> > -MQ powder.p/src_X86KillDenormals.cpp.o -MF powder.p/src_X86Ki
> > llDenormals.cpp.o.d -o powder.p/src_X86KillDenormals.cpp.o -c 
> > ../The-Powder-Toy-98.2.365/src/X86KillDenormals.cpp
> > ../The-Powder-Toy-98.2.365/src/X86KillDenormals.cpp:7:2: error: 
> > '_mm_setcsr' needs target feature sse                                       
> >    _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
> >         ^                                                                   
> >                                                            
> > /usr/lib/clang/16/include/xmmintrin.h:2977:37: note: expanded from macro 
> > '_MM_SET_FLUSH_ZERO_MODE'
> > #define _MM_SET_FLUSH_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & 
> > ~_MM_FLUSH_ZERO_MASK) | (x)))                                               
> >                                 ^
> 
> Looks like the file X86KillDenormals.cpp requires sse, but is included
> with any x86 arch[1]. Diff below includes the file only if sse is
> active.
> 
> Would appreciate a second look if this seems correct... Still builds on
> amd64.
> 
> [1] 
> https://github.com/The-Powder-Toy/The-Powder-Toy/blob/c174833734968e52412ef2283a22ee672e55e60f/src/meson.build#L127
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/games/powder-toy/Makefile,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 Makefile
> --- Makefile  21 Jun 2024 01:43:09 -0000      1.1.1.1
> +++ Makefile  25 Jun 2024 01:38:35 -0000
> @@ -6,6 +6,7 @@ USE_NOBTCFI =         Yes
>  V =                  98.2.365
>  PKGNAME =            powder-toy-${V}
>  DIST_TUPLE +=                github The-Powder-Toy The-Powder-Toy v${V} .
> +REVISION =           0
>  CATEGORIES =         games
>  MAINTAINER =         Thomas Frohwein <[email protected]>
>  
> Index: patches/patch-src_meson_build
> ===================================================================
> RCS file: patches/patch-src_meson_build
> diff -N patches/patch-src_meson_build
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_meson_build     25 Jun 2024 01:38:35 -0000
> @@ -0,0 +1,14 @@
> +X86KillDenormals.cpp needs SSE
> +
> +Index: src/meson.build
> +--- src/meson.build.orig
> ++++ src/meson.build
> +@@ -98,7 +98,7 @@ else
> +             'PowderToySDLCommon.cpp',
> +     )
> + endif
> +-if is_x86
> ++if x86_sse_level > 0
> +     powder_files += files('X86KillDenormals.cpp')
> + endif
> + 

That fails with this:

ld.lld: error: undefined symbol: X86KillDenormals()

Forcing use of sse works:

.if ${MACHINE_ARCH:Mi386}
CXXFLAGS +=            -msse2
.endif

Reply via email to