git: ebdfcf26c93e - main - databases/rocksdb: Fix build on i386 with Clang 17+

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Thu, 05 Sep 2024 06:19:43 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ebdfcf26c93e631c979ce0068ff7fb1ba4ba6d0f

commit ebdfcf26c93e631c979ce0068ff7fb1ba4ba6d0f
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2024-09-05 05:24:43 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2024-09-05 06:11:22 +0000

    databases/rocksdb: Fix build on i386 with Clang 17+
    
    mkdir -p utilities/transactions/lock/range/range_tree/lib/locktree && clang++ -O2 -pipe  -DOS_FREEBSD -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing   -Wno-inconsistent-missing-override -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field -isystem /usr/local/include -std=c++17   -fPIC -DROCKSDB_DLL -DROCKSDB_USE_RTTI   -g -W -Wextra -Wall -Wsign-compare -Wshadow -Wunused-parameter -Werror -I. -I./include -std=c++17 -O2 -pipe  -DOS_FREEBSD -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing   -Wno-inconsistent-missing-override -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field -isystem /usr/local/include -std=c++17  -faligned-new -DHAVE_ALIGNED_NEW -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -O2 -pipe  -DOS_FREEBSD -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -D_REENTRANT -DOS_FREEBSD -DSNAPPY -DGFLAGS=1 -DZLIB -DBZIP2 -DLZ4 -DZSTD -DROCKSDB_MALLOC_USABLE_SIZE -DROC
 KSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_SCHED_GETCPU_PRESENT   -isystem third-party/gtest-1.8.1/fused-src -O2 -fno-omit-frame-pointer -momit-leaf-frame-pointer -DNDEBUG -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-invalid-offsetof -c utilities/transactions/lock/range/range_tree/lib/locktree/manager.cc -o utilities/transactions/lock/range/range_tree/lib/locktree/manager.o
    In file included from utilities/transactions/lock/range/range_tree/lib/locktree/manager.cc:58:
    In file included from utilities/transactions/lock/range/range_tree/lib/locktree/../portability/toku_pthread.h:60:
    In file included from utilities/transactions/lock/range/range_tree/lib/locktree/../portability/toku_portability.h:71:
    utilities/transactions/lock/range/range_tree/lib/locktree/../portability/toku_atomic.h:80:10: error: __sync builtin operation MUST have natural alignment (consider using __atomic). [-Werror,-Wsync-alignment]
       80 |   return __sync_fetch_and_add(addr, diff);
          |          ^
    utilities/transactions/lock/range/range_tree/lib/locktree/../portability/toku_atomic.h:92:10: error: __sync builtin operation MUST have natural alignment (consider using __atomic). [-Werror,-Wsync-alignment]
       92 |   return __sync_fetch_and_sub(addr, diff);
          |          ^
    2 errors generated.
    gmake: *** [Makefile:2566: utilities/transactions/lock/range/range_tree/lib/locktree/manager.o] Error 1
    
    Tested on:      13.3-RELEASE-p5 (17.0.6), 15.0-CURRENT (18.1.6)
    Reference:      https://pkg-status.freebsd.org/beefy17/data/main-i386-default/p1963f6d23107_s10d5b43424d/logs/rocksdb-9.4.0.log
                    https://github.com/llvm/llvm-project/issues/69146
---
 databases/rocksdb/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/databases/rocksdb/Makefile b/databases/rocksdb/Makefile
index 3ddeef8acdb7..e5fbf6d58669 100644
--- a/databases/rocksdb/Makefile
+++ b/databases/rocksdb/Makefile
@@ -60,6 +60,9 @@ ZSTD_MAKE_ENV_OFF=	ROCKSDB_DISABLE_ZSTD=yes
 
 .if ${CHOSEN_COMPILER_TYPE} == clang
 CXXFLAGS+=	-Wno-inconsistent-missing-override -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field
+.if ${COMPILER_VERSION} >= 170
+CXXFLAGS+=	-Wno-sync-alignment
+.endif
 .endif
 
 post-patch: