From: Jeremie Courreges-Anglas Subject: Re: [Re: mips64 bulk build report] unbreak sysutils/libvirt on octeon To: Klemens Nanni Cc: ports@openbsd.org, Antoine Jacoutot Date: Thu, 22 Jan 2026 15:33:36 +0100 On Wed, Jan 21, 2026 at 10:49:43PM +0000, Klemens Nanni wrote: > 19.01.2026 18:07, visa@openbsd.org пишет: > > bulk build on octeon.ports.openbsd.org > > started on Wed Jan 7 16:47:18 UTC 2026 > > finished at Tue Jan 13 07:12:20 UTC 2026 > > lasted 06D14h25m > > done with kern.version=OpenBSD 7.8-current (GENERIC.MP) #120: Mon Dec 29 00:57:14 MST 2025 > > > > built packages:8646 > > Jan 7:1442 > > Jan 8:1815 > > Jan 9:2029 > > Jan 10:605 > > Jan 11:355 > > Jan 12:398 > > Jan 13:2001 > > > > > > build failures: 81 > > > http://build-failures.rhaalovely.net/mips64/2026-01-07/sysutils/libvirt.log > | FAILED: src/libvirt.so.2.6 > | cc [...] src/util/libvirt_util.a [...] -shared [...] -Wl,-no_warn_duplicate_libraries -Wl,-export-dynamic /usr/local/lib/libglib-2.0.so.4201.15 [...] > | /usr/bin/ld: attempted static link of dynamic object `/usr/local/lib/libglib-2.0.so.4201.15' > > I snipped the long line to highlight what's being linked: a bunch of static libvirt_* > with a bunch of dynamic package libs. > > Neither -static, nor any of the three other arguments mentioned with it in ld.bfd(1) > are used, thuse I don't quite understand why the linker at some point in decides > that a static object is to be produced. > > glib2 is just the first .so and not special here. > > So I pasted the command into a file, turned spaces into newlines and bisected > execution failure by moving only glib2 up until it started complaining about the > second .so, thinking '-shared /.../libglib-...' must work. > > That way I found -Wl,-no_warn_duplicate_libraries to be the culprit, causing all > .so following it to throw above error. See below, > > I have no idea what's going on in the linker here and I won't ask any questions. > Simply skipping this flag on octeon makes it build. > > > Next up was this: > > # make fake > [...] > Stripping target 'src/libvirt.so.2.6'. > Installing src/libvirt-qemu.so.2.3 to /usr/ports/pobj/libvirt-12.0.0/fake-mips64/usr/local/lib > Stripping target 'src/libvirt-qemu.so.2.3'. > Traceback (most recent call last): > File "/usr/local/lib/python3.13/site-packages/mesonbuild/mesonmain.py", line 193, in run > return options.run_func(options) > ~~~~~~~~~~~~~~~~^^^^^^^^^ > File "/usr/local/lib/python3.13/site-packages/mesonbuild/minstall.py", line 888, in run > installer.do_install(datafilename) > ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ > File "/usr/local/lib/python3.13/site-packages/mesonbuild/minstall.py", line 563, in do_install > self.install_targets(d, dm, destdir, fullprefix) > ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/local/lib/python3.13/site-packages/mesonbuild/minstall.py", line 788, in install_targets > self.fix_rpath(outname, t.rpath_dirs_to_remove, install_rpath, final_path, > ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > install_name_mappings, verbose=False) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/local/lib/python3.13/site-packages/mesonbuild/minstall.py", line 348, in fix_rpath > depfixer.fix_rpath(*args, **kwargs) > ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ > File "/usr/local/lib/python3.13/site-packages/mesonbuild/scripts/depfixer.py", line 550, in fix_rpath > fix_elf(fname, rpath_dirs_to_remove, new_rpath, verbose) > ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/local/lib/python3.13/site-packages/mesonbuild/scripts/depfixer.py", line 457, in fix_elf > with Elf(fname, verbose) as e: > ~~~^^^^^^^^^^^^^^^^ > File "/usr/local/lib/python3.13/site-packages/mesonbuild/scripts/depfixer.py", line 150, in __init__ > self.parse_dynsym_strings() > ~~~~~~~~~~~~~~~~~~~~~~~~~^^ > File "/usr/local/lib/python3.13/site-packages/mesonbuild/scripts/depfixer.py", line 276, in parse_dynsym_strings > self.dynsym_strings.append(self.read_str().decode()) > ~~~~~~~~~~~~~^^ > File "/usr/local/lib/python3.13/site-packages/mesonbuild/scripts/depfixer.py", line 238, in read_str > raise RuntimeError('Tried to read past the end of the file') > RuntimeError: Tried to read past the end of the file > > ERROR: Unhandled python exception > > This is a Meson bug and should be reported! > [...] > > > libvirt and libvirt-qemu both build/link, but the latter fails to strip. > With help from tb and jca, we compared their flags in the logs and came > up with -Wl,--version-script=... as pime suspect. > > Again, no idea what the linker is doing, but omitting that flag makes it > strip just fine, so that's what I did. > > > Now packages, but I haven't done any tests. > In turn, sysutils/collectd now packages, which I actually need and tested. > > Feedback? OK? > > Index: patches/patch-meson_build > =================================================================== > RCS file: /cvs/ports/sysutils/libvirt/patches/patch-meson_build,v > diff -u -p -r1.41 patch-meson_build > --- patches/patch-meson_build 4 Nov 2025 07:52:39 -0000 1.41 > +++ patches/patch-meson_build 21 Jan 2026 22:41:08 -0000 > @@ -3,6 +3,13 @@ ld: error: undefined symbol: _Unwind_Res > > Should match b_lundef in meson(1). > > +Skip -Wl,-no_warn_duplicate_libraries on octeon/mips64 to unbreak build: > +/usr/bin/ld: attempted static link of dynamic object `/usr/local/lib/libglib-2.0.so.4201.15' > + > +Skip -Wl,--version-script= on octeon/mips64 to unbreak fake: > +RuntimeError: Tried to read past the end of the file > + This is a Meson bug and should be reported! > + > Index: meson.build > --- meson.build.orig > +++ meson.build > @@ -26,7 +33,22 @@ Index: meson.build > > libvirt_no_indirect = cc.get_supported_link_arguments([ > '-Wl,--no-copy-dt-needed-entries', > -@@ -872,7 +866,7 @@ if not get_option('driver_remote').disabled() > +@@ -573,10 +567,13 @@ libvirt_no_indirect = cc.get_supported_link_arguments( > + libvirt_no_warn_duplicate_libraries = cc.get_supported_link_arguments([ > + '-Wl,-no_warn_duplicate_libraries', > + ]) > ++if host_machine.cpu_family() == 'mips64' > ++libvirt_no_warn_duplicate_libraries = '' > ++endif Could you please disable libvirt_no_warn_duplicate_libraries on openbsd + mips64? That way we don't have to worry about an overly broad patch being pushed upstream. It's probably really just a bug in our binutils-2.17+patches mips64 backend and wouldn't make sense on other operating systems. > + > + if host_machine.system() == 'windows' > + version_script_flags = '-Wl,' > +-elif host_machine.system() == 'darwin' > ++elif host_machine.system() == 'darwin' or host_machine.cpu_family() == 'mips64' Same here! > + # macOS libraries don't support symbol versioning > + version_script_flags = '' > + else > +@@ -872,7 +869,7 @@ if not get_option('driver_remote').disabled() > xdr_dep = cc.find_library('portablexdr', required: get_option('driver_remote')) > elif host_machine.system() in [ 'linux', 'gnu' ] > xdr_dep = dependency('libtirpc', required: get_option('driver_remote')) > @@ -35,7 +57,7 @@ Index: meson.build > xdr_dep = cc.find_library('c', required: get_option('driver_remote')) > else > xdr_dep = dependency('', required: false) > -@@ -960,15 +954,18 @@ if devmapper_dep.found() > +@@ -960,15 +957,18 @@ if devmapper_dep.found() > conf.set('WITH_DEVMAPPER', 1) > endif > > @@ -62,7 +84,7 @@ Index: meson.build > fuse_version = '3.1.0' > fuse_dep = dependency('fuse3', version: '>=' + fuse_version, required: false) > if fuse_dep.found() > -@@ -1906,7 +1903,7 @@ endif > +@@ -1906,7 +1906,7 @@ endif > > driver_modules_flags = [] > if conf.has('WITH_LIBVIRTD') > > -- jca