I've been taking a close look at c++ ports on sparc64. I've submitted some low hanging fruit fixes that have been committed. However, there is a class of ports that it's not possible to fix without changing clang.port.mk and bsd.port.mk. Some background first.
A c++ port that uses the base compiler that also depends on the c++ standard lib must add ${COMPILER_LIBCXX} to WANTLIB. COMPILER_LIBCXX is set to match the base compiler's c++ stdlib: c++ c++abi pthread on clang archs and stdc++ pthread on gcc archs. When a port is built using ports-clang or ports-gcc, COMPILER_LIBCXX is not updated. Rather it puts c++ standard lib depends directly into WANTLIB. This approach poses a problem for ports that use c++ where the resulting port is a header only port, or a port that produces only static libs, or a port that statically links in the c++ standard lib. For these ports they end up with extra WANTLIB that there is no way to fix. These types of ports don't put COMPILER_LIBCXX into WANTLIB but get the c++ standard lib anyway when a ports compiler is used. The following diff changes the clang.ports.mk and gcc4.ports.mk approach. It overrides LIBECXX which allows the rest of the makefile infrastructure to set COMPILER_LIBCXX to the correct value and does not inject the c++ standard libs into WANTLIB. It fixes the following WANTLIB problems: ports-clang ports-gcc: uses c++ to build but result has no depend on c++ libs: ./sysutils/py-tsk Extra: estdc++.19 on sparc64 and Extra: c++.10 c++abi.7 pthread.27 on amd64 base-clang: ports-clang ports-gcc c++ headers only: ./devel/catch2 Extra: estdc++.19 on sparc64 ./devel/zug Extra: estdc++.19 on sparc64 ./devel/immer Extra: estdc++.19 on sparc64 ./devel/lager Extra: estdc++.19 on sparc64 ./graphics/glm Extra: estdc++.19 on sparc64 ports-clang: c++ static libs only: ./lang/wasi-sdk/compiler-rt Extra: estdc++.19 on sparc64 and Extra: c++.10 c++abi.7 pthread.27 on amd64 ./lang/wasi-sdk/libcxx Extra: estdc++.19 on sparc64 and Extra: c++.10 c++abi.7 pthread.27 on amd64 ./lang/wasi-sdk/libcxxabi Extra: estdc++.19 on sparc64 and Extra: c++.10 c++abi.7 pthread.27 on amd64 ports-clang: statically links in llvm libs ./lang/zig/Makefile Extra: c++.10 c++abi.7 on amd64 ports-clang: c++ used but no depends on stdc++ libs: ./www/iridium Extra c++.10 c++abi.7 Unrelated: Extra: iconv.7 Missing: epoll-shim lzma udev on amd64 ./www/ungoogled-chromium Extra c++.10 c++abi.7 on amd64 ports-gcc: uses c++ to build but no actual depend on c++ libs: ./devel/openmpi Extra estdc++.19 on both sparc64 and amd64 ./lang/compcert Extra estdc++.19 on amd64 Thoughts? If looks good, testing with a bulk build on amd64 and sparc64 would be helpful to ensure I didn't miss a port that needs a REVISION bump. Index: lang/clang/clang.port.mk =================================================================== RCS file: /cvs/ports/lang/clang/clang.port.mk,v diff -u -p -u -r1.42 clang.port.mk --- lang/clang/clang.port.mk 17 Dec 2023 13:51:16 -0000 1.42 +++ lang/clang/clang.port.mk 13 Jan 2025 19:52:27 -0000 @@ -65,12 +65,12 @@ MODULES += gcc4 MODCLANG_CPPLIBDEP = ${MODGCC4_CPPLIBDEP} LIB_DEPENDS += ${MODCLANG_CPPLIBDEP} MODCLANG_CPPWANTLIB = ${MODGCC4_CPPWANTLIB} -WANTLIB += ${MODCLANG_CPPWANTLIB} +LIBECXX = ${MODCLANG_CPPWANTLIB} . else # uses libc++ MODCLANG_CPPLIBDEP = MODCLANG_CPPWANTLIB = c++ c++abi pthread -WANTLIB += ${MODCLANG_CPPWANTLIB} +LIBECXX = ${MODCLANG_CPPWANTLIB} . endif . endif .endif Index: lang/gcc/11/gcc4.port.mk =================================================================== RCS file: /cvs/ports/lang/gcc/11/gcc4.port.mk,v diff -u -p -u -r1.2 gcc4.port.mk --- lang/gcc/11/gcc4.port.mk 11 Mar 2022 19:28:58 -0000 1.2 +++ lang/gcc/11/gcc4.port.mk 13 Jan 2025 19:52:27 -0000 @@ -26,7 +26,7 @@ _MODGCC4_LINKS = MODGCC4STDCPP = estdc++ MODGCC4_CPPLIBDEP = lang/gcc/11,-libs>=11,<12 MODGCC4_CPPDEP = lang/gcc/11,-c++>=11,<12 -MODGCC4_CPPWANTLIB = estdc++>=20 +MODGCC4_CPPWANTLIB = estdc++>=20 pthread MODGCC4_ATOMICWANTLIB = atomic MODGCC4_FORTRANDEP = lang/gcc/11,-f95>=11,<12 @@ -50,7 +50,7 @@ COMPILER_LINKS += gcc ${LOCALBASE}/bin/e . if ${MODGCC4_LANGS:L:Mc++} BUILD_DEPENDS += ${MODGCC4_CPPDEP} LIB_DEPENDS += ${MODGCC4_CPPLIBDEP} -WANTLIB += ${MODGCC4_CPPWANTLIB} +LIBECXX = ${MODGCC4_CPPWANTLIB} # XXX ports-clang already defines this . if !${COMPILER_LINKS:Mg++} COMPILER_LINKS += c++ ${LOCALBASE}/bin/eg++ g++ ${LOCALBASE}/bin/eg++ Index: lang/gcc/8/gcc4.port.mk =================================================================== RCS file: /cvs/ports/lang/gcc/8/gcc4.port.mk,v diff -u -p -u -r1.5 gcc4.port.mk --- lang/gcc/8/gcc4.port.mk 11 Mar 2022 19:28:59 -0000 1.5 +++ lang/gcc/8/gcc4.port.mk 13 Jan 2025 19:52:27 -0000 @@ -26,7 +26,7 @@ _MODGCC4_LINKS = MODGCC4STDCPP = estdc++ MODGCC4_CPPLIBDEP = lang/gcc/8,-libs>=8,<9 MODGCC4_CPPDEP = lang/gcc/8,-c++>=8,<9 -MODGCC4_CPPWANTLIB = estdc++>=19 +MODGCC4_CPPWANTLIB = estdc++>=19 pthread MODGCC4_ATOMICWANTLIB = atomic MODGCC4_FORTRANDEP = lang/gcc/8,-f95>=8,<9 @@ -50,7 +50,7 @@ COMPILER_LINKS += gcc ${LOCALBASE}/bin/e . if ${MODGCC4_LANGS:L:Mc++} BUILD_DEPENDS += ${MODGCC4_CPPDEP} LIB_DEPENDS += ${MODGCC4_CPPLIBDEP} -WANTLIB += ${MODGCC4_CPPWANTLIB} +LIBECXX = ${MODGCC4_CPPWANTLIB} # XXX ports-clang already defines this . if !${COMPILER_LINKS:Mg++} COMPILER_LINKS += c++ ${LOCALBASE}/bin/eg++ g++ ${LOCALBASE}/bin/eg++ Index: devel/catch2/Makefile =================================================================== RCS file: /cvs/ports/devel/catch2/Makefile,v diff -u -p -u -r1.52 Makefile --- devel/catch2/Makefile 4 Oct 2024 06:15:01 -0000 1.52 +++ devel/catch2/Makefile 13 Jan 2025 19:52:20 -0000 @@ -5,6 +5,8 @@ GH_PROJECT = Catch2 GH_TAGNAME = v3.7.1 PKGNAME = ${DISTNAME:L} +REVISION = 0 + CATEGORIES = devel MAINTAINER = Rafael Sadowski <rsadow...@openbsd.org> Index: devel/immer/Makefile =================================================================== RCS file: /cvs/ports/devel/immer/Makefile,v diff -u -p -u -r1.4 Makefile --- devel/immer/Makefile 26 Dec 2024 21:48:10 -0000 1.4 +++ devel/immer/Makefile 13 Jan 2025 19:52:20 -0000 @@ -3,7 +3,7 @@ COMMENT = immutable and persistent data GH_ACCOUNT = arximboldi GH_PROJECT = immer GH_TAGNAME = v0.8.1 -REVISION = 1 +REVISION = 2 CATEGORIES = devel Index: devel/lager/Makefile =================================================================== RCS file: /cvs/ports/devel/lager/Makefile,v diff -u -p -u -r1.4 Makefile --- devel/lager/Makefile 5 Jan 2025 18:51:11 -0000 1.4 +++ devel/lager/Makefile 13 Jan 2025 19:52:21 -0000 @@ -3,7 +3,7 @@ COMMENT = redux for C++ GH_ACCOUNT = arximboldi GH_PROJECT = lager GH_TAGNAME = v0.1.1 -REVISION = 1 +REVISION = 2 CATEGORIES = devel Index: devel/openmpi/Makefile =================================================================== RCS file: /cvs/ports/devel/openmpi/Makefile,v diff -u -p -u -r1.45 Makefile --- devel/openmpi/Makefile 10 Jan 2025 18:03:43 -0000 1.45 +++ devel/openmpi/Makefile 13 Jan 2025 19:52:21 -0000 @@ -2,7 +2,7 @@ COMMENT = open source MPI-3.1 implement V = 4.1.6 DISTNAME = openmpi-$V -REVISION = 0 +REVISION = 1 SHARED_LIBS += open-pal 9.0 # 70.3 SHARED_LIBS += mca_common_sm 5.0 # 70.0 Index: devel/zug/Makefile =================================================================== RCS file: /cvs/ports/devel/zug/Makefile,v diff -u -p -u -r1.4 Makefile --- devel/zug/Makefile 26 Dec 2024 21:47:47 -0000 1.4 +++ devel/zug/Makefile 13 Jan 2025 19:52:24 -0000 @@ -3,7 +3,7 @@ COMMENT = C++ library providing transduc GH_ACCOUNT = arximboldi GH_PROJECT = zug GH_TAGNAME = v0.1.1 -REVISION = 1 +REVISION = 2 CATEGORIES = devel Index: graphics/glm/Makefile =================================================================== RCS file: /cvs/ports/graphics/glm/Makefile,v diff -u -p -u -r1.12 Makefile --- graphics/glm/Makefile 14 Oct 2022 13:27:10 -0000 1.12 +++ graphics/glm/Makefile 13 Jan 2025 19:52:26 -0000 @@ -4,6 +4,8 @@ GH_TAGNAME= 0.9.9.8 GH_PROJECT= glm GH_ACCOUNT= g-truc +REVISION= 0 + CATEGORIES= graphics math HOMEPAGE= https://glm.g-truc.net/ Index: lang/compcert/Makefile =================================================================== RCS file: /cvs/ports/lang/compcert/Makefile,v diff -u -p -u -r1.43 Makefile --- lang/compcert/Makefile 5 Jan 2025 21:40:38 -0000 1.43 +++ lang/compcert/Makefile 13 Jan 2025 19:52:27 -0000 @@ -10,6 +10,7 @@ GH_PROJECT = CompCert GH_TAGNAME = v${V} DISTNAME = ${GH_PROJECT}-${V} PKGNAME = ${DISTNAME:L} +REVISION = 0 HOMEPAGE = https://compcert.org/ @@ -18,7 +19,7 @@ CATEGORIES = lang # INRIA Non-Commercial License Agreement. PERMIT_PACKAGE = Yes -WANTLIB += c m +WANTLIB += c m pthread COMPILER = ports-gcc Index: lang/wasi-sdk/compiler-rt/Makefile =================================================================== RCS file: /cvs/ports/lang/wasi-sdk/compiler-rt/Makefile,v diff -u -p -u -r1.8 Makefile --- lang/wasi-sdk/compiler-rt/Makefile 7 Dec 2023 12:01:18 -0000 1.8 +++ lang/wasi-sdk/compiler-rt/Makefile 13 Jan 2025 19:52:27 -0000 @@ -6,6 +6,8 @@ LIBPATH = wasi/libclang_rt.builtins-wasm BUILDSUBDIR = lib/builtins BUILD_DEPENDS += lang/wasi-libc>=0.20220413p0 +REVISION = 0 + # In transition from BSD-ish to Apache 2 + LLVM exceptions PERMIT_PACKAGE = Yes Index: lang/wasi-sdk/libcxx/Makefile =================================================================== RCS file: /cvs/ports/lang/wasi-sdk/libcxx/Makefile,v diff -u -p -u -r1.3 Makefile --- lang/wasi-sdk/libcxx/Makefile 7 Dec 2023 12:01:18 -0000 1.3 +++ lang/wasi-sdk/libcxx/Makefile 13 Jan 2025 19:52:27 -0000 @@ -5,6 +5,8 @@ PKGNAME = wasi-libcxx-${LLVM_V} LIBPATH = wasm32-wasi/libc++.a BUILDSUBDIR = libcxx +REVISION = 0 + # In transition from BSD-ish to Apache 2 + LLVM exceptions PERMIT_PACKAGE = Yes Index: lang/wasi-sdk/libcxxabi/Makefile =================================================================== RCS file: /cvs/ports/lang/wasi-sdk/libcxxabi/Makefile,v diff -u -p -u -r1.3 Makefile --- lang/wasi-sdk/libcxxabi/Makefile 7 Dec 2023 12:01:18 -0000 1.3 +++ lang/wasi-sdk/libcxxabi/Makefile 13 Jan 2025 19:52:27 -0000 @@ -5,6 +5,8 @@ PKGNAME = wasi-libcxxabi-${LLVM_V} LIBPATH = wasm32-wasi/libc++abi.a BUILDSUBDIR = libcxxabi +REVISION = 0 + # In transition from BSD-ish to Apache 2 + LLVM exceptions PERMIT_PACKAGE = Yes Index: lang/zig/Makefile =================================================================== RCS file: /cvs/ports/lang/zig/Makefile,v diff -u -p -u -r1.24 Makefile --- lang/zig/Makefile 22 Oct 2024 08:59:26 -0000 1.24 +++ lang/zig/Makefile 13 Jan 2025 19:52:27 -0000 @@ -11,6 +11,8 @@ GH_ACCOUNT = ziglang GH_PROJECT = zig GH_COMMIT = ${ZIG_COMMIT} +REVISION = 0 + # see https://github.com/ziglang/zig/tree/0.13.0 ZIG_VERSION = 0.13.0 ZIG_COMMIT = cf90dfd3098bef5b3c22d5ab026173b3c357f2dd @@ -24,7 +26,7 @@ MAINTAINER = Sebastien Marie <semarie@ka # MIT PERMIT_PACKAGE = Yes -WANTLIB = ${COMPILER_LIBCXX} c m +WANTLIB = c m pthread # C++17 COMPILER = ports-clang Index: sysutils/py-tsk/Makefile =================================================================== RCS file: /cvs/ports/sysutils/py-tsk/Makefile,v diff -u -p -u -r1.19 Makefile --- sysutils/py-tsk/Makefile 21 Dec 2024 11:38:54 -0000 1.19 +++ sysutils/py-tsk/Makefile 13 Jan 2025 19:52:33 -0000 @@ -3,7 +3,7 @@ COMMENT = Python bindings for The Sleuth MODPY_DISTV = 20200117 DISTNAME = pytsk3-${MODPY_DISTV} PKGNAME = py-tsk-${MODPY_DISTV} -REVISION = 7 +REVISION = 8 CATEGORIES = sysutils @@ -21,7 +21,7 @@ MODULES += gnu MODPY_PI = Yes MODPY_PYBUILD = setuptools -WANTLIB += pthread talloc tsk ${MODPY_WANTLIB} +WANTLIB += talloc tsk ${MODPY_WANTLIB} # C++11 COMPILER= ports-clang ports-gcc Index: www/iridium/Makefile =================================================================== RCS file: /cvs/ports/www/iridium/Makefile,v diff -u -p -u -r1.215 Makefile --- www/iridium/Makefile 6 Jan 2025 20:10:47 -0000 1.215 +++ www/iridium/Makefile 13 Jan 2025 19:52:35 -0000 @@ -18,6 +18,8 @@ DISTNAME= iridium-browser-${V} PKGNAME= iridium-${V} DISTFILES+= ${IRIDIUM_DISTFILES} +REVISION= 0 + IRIDIUM_DISTFILES+= ${DISTNAME}${EXTRACT_SUFX} EXTRACT_ONLY= ${IRIDIUM_DISTFILES} @@ -50,14 +52,14 @@ COMPILER= ports-clang # uses pledge() WANTLIB+= GL X11 Xau Xcomposite Xdamage Xdmcp Xext Xfixes Xft Xi Xrandr WANTLIB+= Xrender Xtst aom atk-1.0 atk-bridge-2.0 atspi c cairo -WANTLIB+= cbor crypto cups dav1d dbus-1 drm event execinfo expat ffi fido2 -WANTLIB+= fontconfig freetype fribidi gbm gio-2.0 glib-2.0 gmodule-2.0 -WANTLIB+= gobject-2.0 graphite2 gthread-2.0 harfbuzz harfbuzz-gobject -WANTLIB+= harfbuzz-subset iconv icudata icui18n icuuc intl jpeg kvm m -WANTLIB+= nspr4 nss3 nssutil3 openh264 opus pango-1.0 pangocairo-1.0 -WANTLIB+= pangoft2-1.0 pcre2-8 pixman-1 plc4 plds4 png pthread pthread smime3 -WANTLIB+= sndio usbhid util vpx xcb xcb-render xcb-shm xkbcommon xml2 -WANTLIB+= xshmfence xslt z +WANTLIB+= cbor crypto cups dav1d dbus-1 drm epoll-shim event execinfo +WANTLIB+= expat ffi fido2 fontconfig freetype fribidi gbm gio-2.0 glib-2.0 +WANTLIB+= gmodule-2.0 gobject-2.0 graphite2 gthread-2.0 harfbuzz +WANTLIB+= harfbuzz-gobject harfbuzz-subset icudata icui18n icuuc intl jpeg +WANTLIB+= kvm lzma m nspr4 nss3 nssutil3 openh264 opus pango-1.0 +WANTLIB+= pangocairo-1.0 pangoft2-1.0 pcre2-8 pixman-1 plc4 plds4 png +WANTLIB+= pthread smime3 sndio udev usbhid util vpx xcb xcb-render xcb-shm +WANTLIB+= xkbcommon xml2 xshmfence xslt z RUN_DEPENDS= devel/xdg-utils \ devel/desktop-file-utils \ Index: www/ungoogled-chromium/Makefile =================================================================== RCS file: /cvs/ports/www/ungoogled-chromium/Makefile,v diff -u -p -u -r1.149 Makefile --- www/ungoogled-chromium/Makefile 6 Jan 2025 20:11:01 -0000 1.149 +++ www/ungoogled-chromium/Makefile 13 Jan 2025 19:52:36 -0000 @@ -13,7 +13,7 @@ COMMENT= Chromium browser sans integrat V= 131.0.6778.204 UGV= ${V}-1 -REVISION= 0 +REVISION= 1 DISTNAME= ungoogled-chromium-${V}