Hello. During a rebuild of all packages in unstable, several packages failed to build with a similar error message: Compiler ldc2 cannot compile programs. For a sample full build log you can look at the build log for dcontainers in reproducible-builds: https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/dcontainers.html I'm reporting this against ldc because it looks like a bug in ldc, not in the individual packages, but I'm not 100% sure, so please reassign if appropriate. I've put all the packages failing in this way which I found in the affects field. Thanks.
Hi,
thanks for the report. This is not a bug in ldc, but a regression in
meson 1.12.0, so I'm reassigning it accordingly.
Meson passes the dpkg-buildflags LDFLAGS (-Wl,-z,relro) verbatim to
ldc2 in the compiler sanity check, without translating them to the
LDC/DMD syntax (-L=-z -L=relro). ldc2 rejects the GNU-style flag and
meson reports the misleading "Compiler ldc2 cannot compile programs":
Sanity check compiler command line: ldc2 -of=sanity_check_for_d.exe \
sanity_check_for_d.d -release -wi -g -O2 -fcf-protection=full
-Wl,-z,relro ...
ldc2: Unknown command line argument '-Wl,-z,relro'.
../meson.build:1:0: ERROR: Compiler ldc2 cannot compile programs.
Note that in the very same log meson's own linker detection does use
the correct syntax (`ldc2 -L=--version ... -L=-z -L=relro`); only the
sanity check path is broken.
The cause is in DCompiler._sanity_check_compile_args() in
mesonbuild/compilers/d.py: it appends the external link args from
get_external_link_args() without passing them through
unix_args_to_native(), which is what performs the GNU -> LDC/DMD
translation. Sanity check external args were introduced in 1.12.0
(upstream commit 797decc3e), hence the regression.
Minimal reproducer (sid chroot, meson 1.12.0-2, ldc 1:1.42.0-2):
$ cat > meson.build <<'EOT'
project('t', 'd')
executable('t', 'main.d')
EOT
$ echo 'void main(){}' > main.d
$ LDFLAGS=-Wl,-z,relro meson setup build
../meson.build:1:0: ERROR: Compiler ldc2 cannot compile programs.
Without LDFLAGS it succeeds, and with meson 1.11.1 it succeeds as
well (there the sanity check command line carries no external args at
all). This matches the failures observed in the archive: all the
affected packages failed with meson 1.12.0, while e.g. the last
successful rebuild of sambamba on reproducible-builds was done with
meson 1.11.1.
This was already reported upstream from Fedora (same -Wl,-z,relro
coming from the rpm build flags) as
https://github.com/mesonbuild/meson/issues/16115
and fixed on master by
https://github.com/mesonbuild/meson/pull/16166
commit 8ffb200b70ac75c468c5da4a9693675ac97f2e22
"d: pass link arguments through unix_args_to_native"
The fix is a one-liner and is not part of any upstream release yet
(latest tag is still 1.12.0), so it would need to be cherry-picked
into the Debian package:
--- a/mesonbuild/compilers/d.py
+++ b/mesonbuild/compilers/d.py
@@ -402,6 +402,7 @@ def _sanity_check_source_code(self) -> str:
def _sanity_check_compile_args(self, sourcename: str, binname: str
) -> T.Tuple[T.List[str],
T.List[str]]:
args, largs = super()._sanity_check_compile_args(sourcename,
binname)
+ largs = self.unix_args_to_native(largs)
largs.extend(self._get_target_arch_args())
return args, largs
I applied exactly this on top of the meson 1.12.0-2 package in a sid
chroot and the sanity check then gets `-L=-z -L=relro` and passes, so
the D packages configure again.
Thanks.
We believe that the bug you reported is fixed in the latest version of meson, which is due to be installed in the Debian FTP archive. A summary of the changes between this version and the previous one is attached. Thank you for reporting the bug, which will now be closed. If you have further comments please address them to 1146259@bugs.debian.org, and the maintainer will reopen the bug report if appropriate. Debian distribution maintenance software pp. Jussi Pakkanen <jussi.pakkanen@mailbox.org> (supplier of updated meson package) (This message was generated automatically at their request; if you believe that there is a problem with it please contact the archive administrators by mailing ftpmaster@ftp-master.debian.org) Format: 1.8 Date: Wed, 16 Sep 2026 11:45:58 +0300 Source: meson Architecture: source Version: 1.12.0-3 Distribution: unstable Urgency: medium Maintainer: Jussi Pakkanen <jussi.pakkanen@mailbox.org> Changed-By: Jussi Pakkanen <jussi.pakkanen@mailbox.org> Closes: 1146259 Changes: meson (1.12.0-3) unstable; urgency=medium . * Add ldc bug fix. Closes: #1146259. Checksums-Sha1: 6471e1cf1dea0d05f2fe18b3f2edef1deec1b74e 3530 meson_1.12.0-3.dsc 5cbe245353c15451c2ac480d2a02140da79704de 17268 meson_1.12.0-3.debian.tar.xz b369defa381d60c0f74986fd96d6cbe37c96eec3 29240 meson_1.12.0-3_source.buildinfo Checksums-Sha256: 7844be8da77a4571b573b0edb37581f31040e02e0bbc792cd81b453d8320649e 3530 meson_1.12.0-3.dsc c5713e9835937614dac3ac8acf0aec04785cf733dfb7a25b11f24a1d8e2383b4 17268 meson_1.12.0-3.debian.tar.xz 1f3d3583173f0e83bacf6fcaaf9cefe531b14440516b48305c93fd8cde2e9972 29240 meson_1.12.0-3_source.buildinfo Files: 9c9d52bae606554aa9941658f48ca46b 3530 devel optional meson_1.12.0-3.dsc 86cbb3dacec8e28d639dc2902d6a9897 17268 devel optional meson_1.12.0-3.debian.tar.xz 0cf27c4c6a196f6e0a010335a26f6380 29240 devel optional meson_1.12.0-3_source.buildinfo -----BEGIN PGP SIGNATURE----- iQJPBAEBCgA5FiEEGeLW2bRtjapiiPh3wk5jG6ux/nAFAmqqWA0bHGp1c3NpLnBh a2thbmVuQG1haWxib3gub3JnAAoJEMJOYxursf5woHgP/1jZjwInYmSPH/3Af+8b yys2ozjYweyHSsM2dLcCuPwGX5xw7/EB7JTRPNDiH5Bxqd5QxIsNqBH9ednQPXg5 cQ0ugF/WpWB4XfEyNaMXkOa7FXwi4wZyWzRvb8yFAVzHy9mQ7vwWJtDdq4/3t0g2 /JnShfF35K80CE1zN2sfqHQutkqOyYYNLx+2LqcdwPWLn4ps+yuDAhdvEtA1R45L KN5xyu2WDhma++wtRJb+y0YKDSbnuV+U6RxfjD182ji0UsN19oMpXpfk/5vSeTwE IOfXEHMgCi001VRw6Z118Za/3YqvEwak9HPiv0T+kquKUbYytT7LswnjUT/GxZ92 9GlwSUxkthYIkGzJJTvRY1uIZchAKxO3dbozu8Do7Nk3S9Omo2IzXU+SwBr4tewc wJUU9ouQz1GZN2AXO/YQ64z/JtJFGQDPWCErD5cDSQz899/GMcl0jEevs+IeaRXq eBMeVURCUOOcZmyQ2SyDky2eNcWlQK+WVnIPupu9zkPXzdCURR+4+854Q41FyOOO CyuPE41zQtElJKz58ZjA2mjStzNHyeB3ZiMmxjUSLQ6AbkIDtPd+gHbYw2RZBXss tdk/kkgEDrrc5jNWoLfwx6UMSWnmCD3q4O/jHYiLD0QVOlvle7+oH/musKP0jHBT 7VpBDBcecNnSzaoRGVvEFWa+ =l9C3 -----END PGP SIGNATURE-----