From 244739db9d732ae6647b2f9c975f5af2c17e3f4d Mon Sep 17 00:00:00 2001 From: fanquake Date: Wed, 1 Jul 2026 09:52:55 +0100 Subject: [PATCH 1/3] depends: move FreeBSD SDK handling to CI As pointed out by Hebasto, the approach used in #35397 and #35412 is better, rather than hardcoding flags and putting the SDK handling into depends. --- ci/test/00_setup_env_freebsd_cross.sh | 18 +++++++++-- ci/test/01_base_install.sh | 2 -- depends/hosts/freebsd.mk | 43 ++++++++++++++------------- 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/ci/test/00_setup_env_freebsd_cross.sh b/ci/test/00_setup_env_freebsd_cross.sh index 1be28a22c64..2a0ba92e3b1 100755 --- a/ci/test/00_setup_env_freebsd_cross.sh +++ b/ci/test/00_setup_env_freebsd_cross.sh @@ -9,13 +9,25 @@ export LC_ALL=C.UTF-8 export CONTAINER_NAME=ci_freebsd_cross export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04" export APT_LLVM_V="22" -export FREEBSD_VERSION=15.0 -export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} lld" export HOST=x86_64-unknown-freebsd -export DEP_OPTS="build_CC=clang build_CXX=clang++ AR=llvm-ar-${APT_LLVM_V} STRIP=llvm-strip-${APT_LLVM_V} NM=llvm-nm-${APT_LLVM_V} RANLIB=llvm-ranlib-${APT_LLVM_V}" +export FREEBSD_VERSION=15.0 +export FREEBSD_SDK_BASENAME="freebsd-${HOST}-${FREEBSD_VERSION}" +export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} lld-${APT_LLVM_V}" +export SYSROOT="--sysroot=${DEPENDS_DIR}/SDKs/${FREEBSD_SDK_BASENAME}" +export DEP_OPTS="build_CC=clang build_CXX=clang++ \ + CC='clang --target=${HOST} ${SYSROOT}' \ + CXX='clang++ --target=${HOST} ${SYSROOT} -stdlib=libc++' \ + LDFLAGS='-Wc,-fuse-ld=lld -fuse-ld=lld' \ + AR=llvm-ar-${APT_LLVM_V} \ + NM=llvm-nm-${APT_LLVM_V} \ + OBJCOPY=llvm-objcopy-${APT_LLVM_V} \ + OBJDUMP=llvm-objdump-${APT_LLVM_V} \ + RANLIB=llvm-ranlib-${APT_LLVM_V} \ + STRIP=llvm-strip-${APT_LLVM_V}" export GOAL="install" export BITCOIN_CONFIG="\ --preset=dev-mode \ + -DCMAKE_LINKER_TYPE=LLD \ -DREDUCE_EXPORTS=ON \ -DWITH_USDT=OFF \ " diff --git a/ci/test/01_base_install.sh b/ci/test/01_base_install.sh index 466d2e3b13d..652416b93a8 100755 --- a/ci/test/01_base_install.sh +++ b/ci/test/01_base_install.sh @@ -118,8 +118,6 @@ if [ -n "$XCODE_VERSION" ] && [ ! -d "${DEPENDS_DIR}/SDKs/${OSX_SDK_BASENAME}" ] tar -C "${DEPENDS_DIR}/SDKs" -xf "$OSX_SDK_PATH" fi -FREEBSD_SDK_BASENAME="freebsd-${HOST}-${FREEBSD_VERSION}" - if [ -n "$FREEBSD_VERSION" ] && [ ! -d "${DEPENDS_DIR}/SDKs/${FREEBSD_SDK_BASENAME}" ]; then FREEBSD_SDK_FILENAME="base-${FREEBSD_VERSION}.txz" FREEBSD_SDK_PATH="${DEPENDS_DIR}/sdk-sources/${FREEBSD_SDK_FILENAME}" diff --git a/depends/hosts/freebsd.mk b/depends/hosts/freebsd.mk index 240180f2fd2..ada5a449b30 100644 --- a/depends/hosts/freebsd.mk +++ b/depends/hosts/freebsd.mk @@ -1,26 +1,6 @@ -FREEBSD_VERSION ?= 15.0 -FREEBSD_SDK=$(SDK_PATH)/freebsd-$(host)-$(FREEBSD_VERSION)/ - -clang_prog=$(shell command -v clang) -clangxx_prog=$(shell command -v clang++) - -freebsd_AR=$(shell command -v llvm-ar) -freebsd_NM=$(shell command -v llvm-nm) -freebsd_OBJCOPY=$(shell command -v llvm-objcopy) -freebsd_OBJDUMP=$(shell command -v llvm-objdump) -freebsd_RANLIB=$(shell command -v llvm-ranlib) -freebsd_STRIP=$(shell command -v llvm-strip) - - -freebsd_CC=$(clang_prog) --target=$(host) \ - --sysroot=$(FREEBSD_SDK) - -freebsd_CXX=$(clangxx_prog) --target=$(host) \ - --sysroot=$(FREEBSD_SDK) -stdlib=libc++ - freebsd_CFLAGS= freebsd_CXXFLAGS= -freebsd_LDFLAGS=-fuse-ld=lld +freebsd_LDFLAGS= freebsd_release_CFLAGS=-O2 freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS) @@ -28,4 +8,25 @@ freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS) freebsd_debug_CFLAGS=-O1 -g freebsd_debug_CXXFLAGS=$(freebsd_debug_CFLAGS) +ifeq (86,$(findstring 86,$(build_arch))) +i686_freebsd_CC=clang -m32 +i686_freebsd_CXX=clang++ -m32 +i686_freebsd_AR=ar +i686_freebsd_RANLIB=ranlib +i686_freebsd_NM=nm +i686_freebsd_STRIP=strip + +x86_64_freebsd_CC=clang -m64 +x86_64_freebsd_CXX=clang++ -m64 +x86_64_freebsd_AR=ar +x86_64_freebsd_RANLIB=ranlib +x86_64_freebsd_NM=nm +x86_64_freebsd_STRIP=strip +else +i686_freebsd_CC=$(default_host_CC) -m32 +i686_freebsd_CXX=$(default_host_CXX) -m32 +x86_64_freebsd_CC=$(default_host_CC) -m64 +x86_64_freebsd_CXX=$(default_host_CXX) -m64 +endif + freebsd_cmake_system_name=FreeBSD From 495f43f7b320a9f0e617756b821f0395a878d529 Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 3 Jul 2026 14:12:10 +0100 Subject: [PATCH 2/3] ci: FreeBSD 15.1 --- ci/test/00_setup_env_freebsd_cross.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/test/00_setup_env_freebsd_cross.sh b/ci/test/00_setup_env_freebsd_cross.sh index 2a0ba92e3b1..29602ae2ebd 100755 --- a/ci/test/00_setup_env_freebsd_cross.sh +++ b/ci/test/00_setup_env_freebsd_cross.sh @@ -10,7 +10,7 @@ export CONTAINER_NAME=ci_freebsd_cross export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04" export APT_LLVM_V="22" export HOST=x86_64-unknown-freebsd -export FREEBSD_VERSION=15.0 +export FREEBSD_VERSION=15.1 export FREEBSD_SDK_BASENAME="freebsd-${HOST}-${FREEBSD_VERSION}" export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} lld-${APT_LLVM_V}" export SYSROOT="--sysroot=${DEPENDS_DIR}/SDKs/${FREEBSD_SDK_BASENAME}" From 22ac4ad9496697f5881cb9a990fd0b50849e437e Mon Sep 17 00:00:00 2001 From: fanquake Date: Fri, 3 Jul 2026 14:55:05 +0100 Subject: [PATCH 3/3] ci: ensure we use correct lld version in OpenBSD job If we don't suffix with -${APT_LLVM_V}, then lld-21 will be installed. --- ci/test/00_setup_env_openbsd_cross.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/test/00_setup_env_openbsd_cross.sh b/ci/test/00_setup_env_openbsd_cross.sh index a3ee96fc112..30d36213695 100755 --- a/ci/test/00_setup_env_openbsd_cross.sh +++ b/ci/test/00_setup_env_openbsd_cross.sh @@ -12,7 +12,7 @@ export APT_LLVM_V="22" export HOST=x86_64-unknown-openbsd export OPENBSD_VERSION=7.9 export OPENBSD_SDK_BASENAME="openbsd-${HOST}-${OPENBSD_VERSION}" -export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} lld" +export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} lld-${APT_LLVM_V}" export SYSROOT="--sysroot=${DEPENDS_DIR}/SDKs/${OPENBSD_SDK_BASENAME}" export DEP_OPTS="build_CC=clang build_CXX=clang++ \ CC='clang --target=${HOST} ${SYSROOT}' \