On Sunday, 11 January 2026 at 14:56:07 UTC, Mike Parker wrote:
__Link errors in LDC__
Bastiaan's second issue was an LDC linking problem after
upgrading the front end. He didn’t expect a full answer on the
call and would need to work on a reduction.
[...]
He said the error mentioned "conflicting weak external
definition". He'd only seen it a few times and had forgotten
the context.
What turned out to be the issue was that I was using the "include
imports" flag (`-i`) wrong. We have a lot of library code in a
grab bag that various programs include from, and the -i flag
relieves us from having to otherwise manage or define
dependencies. None of these modules were in a D package though,
and thus the -i flag was effective on *all* imports, also those
imported from Dub packages and their dependencies. Dub already
takes care of linking in Dub packages, so those modules would be
linked twice. This would occasionally cause link errors but not
always, and the errors would appear and disappear with different
compilers and compiler versions. Understanding only half of the
problem, I was using exclusions (`-i=-dub_package`) to patch over
these errors, which doesn't scale, is flaky and is obviously not
how you are meant to use this.
The solution was to move our library modules into a D package,
and use only one flag with the package name (`-i=d_package`).
-- Bastiaan.