NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: toolchain/61079: ld compat linker warnings considered harmful
The following reply was made to PR toolchain/61079; it has been noted by GNATS.
From: Thomas Klausner <wiz%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: Ryo ONODERA <ryo%tetera.org@localhost>, kikadf%netbsd.org@localhost
Subject: Re: toolchain/61079: ld compat linker warnings considered harmful
Date: Thu, 26 Nov 2026 22:53:56 +0100
--zwv5hsvn5dmvcfjf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Wed, Nov 25, 2026 at 10:30:03PM +0100, RVP via gnats wrote:
> Revert this:
> =20
> https://github.com/NetBSD/src/commit/d138d9f7e9bad645835c789d42405d05fb3=
dd84b
With a userland with this patch, I built ~2000 packages (my usual set)
and had two problems.
labwc
[174/178] Linking target clients/labnag
FAILED: [code=3D1] clients/labnag
gcc -o clients/labnag clients/labnag.p/meson-generated_.._tablet-v2-protoc=
ol.c.o clients/labnag.p/meson-generated_.._xdg-shell-protocol.c.o clients/l=
abnag.p/meson-generated_.._cursor-shape-v1-protocol.c.o clients/labnag.p/me=
son-generated_.._wlr-layer-shell-unstable-v1-protocol.c.o clients/labnag.p/=
labnag.c.o clients/labnag.p/pool-buffer.c.o -L/usr/pkg/lib -L/usr/lib -I/us=
r/pkg/include/libepoll-shim -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/=
gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/include -I/usr/pkg/incl=
ude -I/usr/pkg/include/freetype2 -I/usr/pkg/include/harfbuzz -I/usr/pkg/inc=
lude/libxml2 -I/usr/pkg/include/libdrm -Wl,--as-needed -Wl,--no-undefined -=
Wl,-zrelro -Wl,-znow -Wl,-R/usr/pkg/lib -Wl,-R/usr/lib -O2 -g -fstack-clash=
-protection -Wl,--start-group protocols/libserver_protos.a -Wl,-R/usr/pkg/l=
ib /usr/pkg/lib/libcairo.so /usr/pkg/lib/libpangocairo-1.0.so /usr/pkg/lib/=
libpango-1.0.so /usr/pkg/lib/libharfbuzz.so /usr/pkg/lib/libgobject-2.0.so =
-Wl,-R/usr/pkg/lib /usr/pkg/lib/libglib-2.0.so /usr/lib/libintl.so -Wl,-R/u=
sr/pkg/lib -Wl,-R/usr/pkg/lib /usr/pkg/lib/libwayland-client.so -lm -Wl,-R/=
usr/pkg/lib /usr/pkg/lib/libwayland-cursor.so /usr/pkg/lib/libwlroots-0.20.=
so -Wl,-R/usr/pkg/lib /usr/pkg/lib/libxkbcommon.so -Wl,-R/usr/pkg/lib /usr/=
pkg/lib/libwayland-server.so -Wl,--end-group
ld: clients/labnag.p/labnag.c.o: undefined reference to symbol 'epoll_shim_=
close'
ld: /usr/pkg/lib/libepoll-shim.so.0: error adding symbols: DSO missing from=
command line
[175/178] Generating docs/labwc-theme.5 with a custom command (wrapped by m=
eson to capture output, to feed input)
[176/178] Generating docs/labwc-philosophy.7 with a custom command (wrapped=
by meson to capture output, to feed input)
[177/178] Generating docs/labnag.1 with a custom command (wrapped by meson =
to capture output, to feed input)
[178/178] Linking target labwc
ninja: build stopped: subcommand failed.
*** Error code 1
labnag.c includes epoll-shim's sys/signalfd.h, which pulls in a
function from that library; and later (not visible here) pool-buffer.c
uses shm_open from librt. The attached patch fixes the build for me.
firefox
gmake[3]: Entering directory '/tmp/www/firefox/work/build/toolkit/library/b=
uild'
toolkit/library/build/libxul.so
rm -f ../../../dist/bin/libxul.so
/tmp/www/firefox/work/.cwrapper/bin/c++ -std=3Dgnu++20 -U_FORTIFY_SOURCE -D=
_FORTIFY_SOURCE=3D2 -fstack-protector-strong -fstrict-flex-arrays=3D1 -I/us=
r/pkg/include -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/pkg/include/=
nspr -I/usr/pkg/include/libdrm -I/usr/pkg/include/glib-2.0 -I/usr/pkg/inclu=
de/gio-unix-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/ffmpeg9 =
-I/usr/pkg/include/freetype2 -I/usr/pkg/include/harfbuzz -fno-rtti -pthread=
-fno-sized-deallocation -fno-aligned-new -ffunction-sections -fdata-sectio=
ns -fno-math-errno -fno-exceptions -pipe -fPIC -O2 -D_GLIBCXX_INCLUDE_NEXT_=
C_HEADERS -msse2 -fstack-clash-protection -D__LOCALE_C_ONLY -I/usr/pkg/incl=
ude -I/usr/include -I/usr/pkg/include/libxml2 -I/usr/pkg/include/nspr -I/us=
r/pkg/include/libdrm -I/usr/pkg/include/glib-2.0 -I/usr/pkg/include/gio-uni=
x-2.0 -I/usr/pkg/lib/glib-2.0/include -I/usr/pkg/include/ffmpeg9 -I/usr/pkg=
/include/freetype2 -I/usr/pkg/include/harfbuzz -O2 -fomit-frame-pointer -fu=
nwind-tables -shared -Wl,-z,defs -Wl,--ignore-unresolved-symbol,environ -Wl=
,--gc-sections -Wl,-soname,libxul.so -o ../../../dist/bin/libxul.so -Wl,@/t=
mp/www/firefox/work/build/toolkit/library/build/libxul_so.list -Wl,-R/us=
r/pkg/lib/firefox -Wl,-R/usr/pkg/lib -Wl,-zrelro -Wl,-znow -L/usr/pkg/lib -=
lexecinfo -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib/nspr -Wl,-R/usr/pkg/lib/=
nspr -L/usr/pkg/lib/nss -Wl,-R/usr/pkg/lib/nss -L/usr/pkg/lib/ffmpeg9 -Wl,-=
R/usr/pkg/lib/ffmpeg9 -Wl,--build-id=3Dsha1 -Wl,-z,noexecstack -Wl,-z,text =
-Wl,-z,relro -Wl,-z,now -Wl,-z,nocopyreloc -fstack-protector-strong -Wl,-rp=
ath-link,/tmp/www/firefox/work/build/dist/bin ../../../third_party/angle/t=
ranslator_gn/libtranslator_gn.a ../../../third_party/angle/angle_common_gn/=
libangle_common_gn.a ../../../third_party/angle/angle_common_shader_state_g=
n/libangle_common_shader_state_gn.a ../../../third_party/angle/preprocessor=
_gn/libpreprocessor_gn.a ../../../js/src/build/libjs_static.a ../../../buil=
d/pure_virtual/libpure_virtual.a ../../../x86_64-unknown-netbsd/release/lib=
gkrust.a ../../../dist/bin/libgkcodecs.so ../../../dist/bin/liblgpllibs.so =
=2E./../../dist/bin/libmozsqlite3.so ../../../dist/bin/libmozgtk.so ../../.=
=2E/dist/bin/libmozwayland.so -Wl,--version-script,libxul.so.symbols -L/usr=
/pkg/lib -licui18n -Wl,-R/usr/pkg/lib -licuuc -ldl -lX11 -lXcomposite -lXda=
mage -lXext -lXfixes -lXrandr -lXrender -lpthread -lffi -Wl,-R/usr/pkg/lib/=
nspr -L/usr/pkg/lib/nspr -lplds4 -lplc4 -lnspr4 -lz -lm -Wl,-R/usr/pkg/lib/=
nss -L/usr/pkg/lib/nss -lssl3 -lsmime3 -lnss3 -lnssutil3 -lfreetype -lfontc=
onfig -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lc=
airo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -l=
intl -lwebpdemux -lwebp -Wl,-R/usr/lib -levent -lvpx -lpixman-1 -lxcb-shm -=
lX11-xcb -lXcursor -lXi -lxcb
ld: ../../../ipc/glue/Unified_cpp_ipc_glue2.o: in function `mozilla::ipc::s=
hared_memory::CreateImpl(unsigned long, std::unique_ptr<int, mozilla::detai=
l::FileHandleDeleter>*)':
Unified_cpp_ipc_glue2.cpp:(.text._ZN7mozilla3ipc13shared_memoryL10CreateImp=
lEmPSt10unique_ptrIiNS_6detail17FileHandleDeleterEE+0x9d): undefined refere=
nce to `shm_open'
ld: Unified_cpp_ipc_glue2.cpp:(.text._ZN7mozilla3ipc13shared_memoryL10Creat=
eImplEmPSt10unique_ptrIiNS_6detail17FileHandleDeleterEE+0xcc): undefined re=
ference to `shm_open'
ld: Unified_cpp_ipc_glue2.cpp:(.text._ZN7mozilla3ipc13shared_memoryL10Creat=
eImplEmPSt10unique_ptrIiNS_6detail17FileHandleDeleterEE+0xef): undefined re=
ference to `shm_unlink'
ld: Unified_cpp_ipc_glue2.cpp:(.text._ZN7mozilla3ipc13shared_memoryL10Creat=
eImplEmPSt10unique_ptrIiNS_6detail17FileHandleDeleterEE+0x257): undefined r=
eference to `shm_unlink'
gmake[3]: *** [/tmp/www/firefox/work/firefox-159.0.1/config/rules.mk:489: .=
=2E/../../dist/bin/libxul.so] Error 1
gmake[3]: Leaving directory '/tmp/www/firefox/work/build/toolkit/library/bu=
ild'
gmake[2]: *** [/tmp/www/firefox/work/firefox-159.0.1/config/recurse.mk:79: =
toolkit/library/build/target] Error 2
gmake[2]: Leaving directory '/tmp/www/firefox/work/build'
libxul.so uses shm_open, but doesn't link against librt.
I've added a check for the symbol, which fixes the build for me.
I think both of these are correctness fixes (the labwc one should
probably be done in a nicer way.)
Thomas
--zwv5hsvn5dmvcfjf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="labwc.diff"
Index: wayland/labwc/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/wayland/labwc/Makefile,v
retrieving revision 1.9
diff -u -r1.9 Makefile
--- wayland/labwc/Makefile 11 Nov 2026 11:56:06 -0000 1.9
+++ wayland/labwc/Makefile 26 Nov 2026 21:03:19 -0000
@@ -22,6 +22,11 @@
PKG_SYSCONFSUBDIR= xdg/labwc
INSTALL_MAKE_FLAGS+= rcdir=${EGDIR}
+# labnag.c includes epoll-shim's sys/signalfd.h
+LDFLAGS.NetBSD+= -lepoll-shim
+# pool-buffer.c uses shm_unlink from librt
+LDFLAGS.NetBSD+= -lrt
+
# Fix: [../src/main.c:94] no fonts are available
DEPENDS+= nerd-fonts-Hack-[0-9]*:../../fonts/nerd-fonts-Hack
--zwv5hsvn5dmvcfjf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="firefox2.diff"
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/www/firefox/distinfo,v
retrieving revision 1.599
diff -u -r1.599 distinfo
--- distinfo 5 Nov 2026 03:16:51 -0000 1.599
+++ distinfo 26 Nov 2026 21:49:10 -0000
@@ -9,6 +9,7 @@
SHA1 (patch-browser_app_profile_firefox.js) = 1168ba368c5ffdcf77e330366848466f48a92642
SHA1 (patch-build_gn__processor.py) = c9b2f31787704c3fec466711010ef632199ae385
SHA1 (patch-build_moz.configure_init.configure) = 65deb3c233df0aab81eb1fca05d708e5a4ed169a
+SHA1 (patch-build_moz.configure_libraries.configure) = dc4a449317aacf1dbaec58e0b64503143104b89a
SHA1 (patch-build_moz.configure_rust.configure) = 25ddfacd29cebbc6db005dbe61a2a7446d480678
SHA1 (patch-config_gcc-stl-wrapper.template.h) = 9360a859e71ebfbead97c0bfbb5153cb2184381a
SHA1 (patch-config_makefiles_rust.mk) = 2e1c6093090b5d49700f381ad7f2d64bc9931ea4
Index: patches/patch-build_moz.configure_libraries.configure
===================================================================
RCS file: patches/patch-build_moz.configure_libraries.configure
diff -N patches/patch-build_moz.configure_libraries.configure
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-build_moz.configure_libraries.configure 26 Nov 2026 21:49:10 -0000
@@ -0,0 +1,54 @@
+$NetBSD$
+
+Check for shm_open in librt, needed on at least NetBSD.
+
+--- build/moz.configure/libraries.configure.orig 2026-11-26 21:07:34.327275688 +0000
++++ build/moz.configure/libraries.configure
+@@ -4,6 +4,28 @@
+
+
+ @template
++def check_shm_open(lib=None, when=None):
++ check_msg = "for shm_open"
++ flags = []
++
++ if lib is not None:
++ check_msg += f" in {lib}"
++ flags.append(f"-l{lib}")
++
++ check_when = building_with_gnu_compatible_cc
++ if when is not None:
++ check_when &= when
++
++ return try_link(
++ includes=["sys/types.h", "sys/mman.h", "fcntl.h"],
++ body="shm_open(\"shmtest\", O_RDONLY|O_CREAT, 0444);",
++ check_msg=check_msg,
++ flags=flags,
++ when=check_when,
++ )
++
++
++@template
+ def check_clock_monotonic_support(lib=None, when=None):
+ check_msg = "for clock_gettime(CLOCK_MONOTONIC)"
+ flags = []
+@@ -30,6 +52,9 @@ have_rt_clock_monotonic_support = check_clock_monotoni
+ lib="rt", when=~have_raw_clock_monotonic_support
+ )
+
++have_raw_shm_open = check_shm_open()
++have_rt_shm_open = check_shm_open(lib="rt", when=~have_raw_shm_open)
++
+ set_define(
+ "HAVE_CLOCK_MONOTONIC",
+ have_raw_clock_monotonic_support | have_rt_clock_monotonic_support,
+@@ -39,7 +64,7 @@ set_config(
+ have_raw_clock_monotonic_support | have_rt_clock_monotonic_support,
+ )
+
+-set_config("REALTIME_LIBS", ["-lrt"], when=have_rt_clock_monotonic_support)
++set_config("REALTIME_LIBS", ["-lrt"], when=have_rt_clock_monotonic_support | have_rt_shm_open)
+
+
+ have_res_ninit = try_link(
--zwv5hsvn5dmvcfjf--
Home |
Main Index |
Thread Index |
Old Index