On Mon, 18 Dec 2023, Jake Drahos wrote:
On 12/18/23 01:35, Richard Biener wrote:
On Fri, 15 Dec 2023, Jake Drahos wrote:
The OBS build of LDC does not currently package libdruntime.a or libphobos2.a in any (sub)package. This means that there isn't a way of building a statically-linked D program with LDC short of building a new runtime and phobos to link against.
Since static libs can be a delicate topic and static lib bloat best avoided for obvious reasons, I decided it'd be best to ask on the mailing list first instead of just putting together a pull request. Has there been any discussion on it as it applies to LDC (or other applicable compilers)? My position would be that the core runtime and stdlib for a compiler clearly count as an "exceptional case" to offer a -devel-static.
The GCC based D compiler has those available.
Richard.
It looks like -static is also broken for GDC, at least on Tumbleweed (__tls_get_addr undefined), but I haven't dug into it in detail.
Indeed, I can see that. __tls_get_addr is supposed to be resolved via
relaxation, not sure why that doesn't work here. Ah, there's an
explicit call in libdruntime and not a TLS relocation - that's not
going to work. I filed a bugreport upstream,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113081
Now, I can see that -static-libphobos works (with a Hello World), this
leaves a dynamic executable but the D runtime linked statically (there
isn't a -static-libdruntime but the executable doesn't seem to reference
that).
Not sure if you need a fully static executable.
Richard.
--
Richard Biener