zstd is broken on sparc64 due to unaligned accesses resulting in bus errors. Since __GNUC__ is defined and MEM_FORCE_MEMORY_ACCESS isn't defined, it defaults to 1, and we run into these:
https://github.com/facebook/zstd/blob/1be95291a89160be121c987c2e385331a65a4a0e/lib/common/mem.h#L192-L199 One simple fix is to define MEM_FORCE_MEMORY_ACCESS to 0 via CPPFLAGS. This forces all platforms to use memcpy, which may or may not result in some slowdown. We can consider more elaborate platform-specific fixes if that is desired, but then I need instructions. With this diff, the cmake test for zstd doesn't abort with a bus error, which allows me to build qt6/qtbase on sparc64, and in turn we should get a sizable chunk of the tree back to building. Index: Makefile =================================================================== RCS file: /cvs/ports/archivers/zstd/Makefile,v retrieving revision 1.43 diff -u -p -r1.43 Makefile --- Makefile 11 Feb 2023 22:04:54 -0000 1.43 +++ Makefile 3 Mar 2023 00:06:05 -0000 @@ -2,6 +2,7 @@ COMMENT = zstandard fast real-time comp V = 1.5.4 DISTNAME = zstd-${V} +REVISION = 0 SHARED_LIBS = zstd 6.2 # 1.5.4 @@ -23,12 +24,15 @@ LIB_DEPENDS = archivers/lz4 \ BUILD_DEPENDS = sysutils/ggrep MAKE_ENV = CC="${CC}" \ - CPPFLAGS="-I${LOCALBASE}/include" \ + CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include" \ LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib" MAKE_FLAGS = SHARED_EXT_VER="so.$(LIBzstd_VERSION)" \ SONAME_FLAGS= \ V=1 FAKE_FLAGS = PREFIX="${PREFIX}" + +# Avoid unaligned access; use memcpy. +CPPFLAGS += -DMEM_FORCE_MEMORY_ACCESS=0 USE_GMAKE = Yes