[Issue 24389] importC: Building zlib in Phobos with importC fails on FreeBSD 14

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 13 20:28:17 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24389

--- Comment #8 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to Iain Buclaw from comment #3)
> (In reply to Jonathan M Davis from comment #0)
> > This is not an issue on the latest release of dmd - 2.070 - but it is an
> > issue on master. It looks like with 2.070, we're still building zlib in
> You mean 2.107 is ok? 2.108-dev is not?

Yes, sorry. 2.107 is fine - for the Phobos build - whereas dmd master is not -
presumably because dmd master is using importC for zlib, whereas 2.107 is not.
However, 2.107 fails the simplified test case of just #including stdlib.h, so
the importC issue is there regardless.

(In reply to Iain Buclaw from comment #6)
> Support can be simply added to the parser, but I can't see DMD doing
> anything but ignore or error about it being there.

I'm not sure what dmd should be doing here, but as far as the Phobos build
goes, either dmd needs to be able to handle the __asm__ that FreeBSD 14 is
using in stdlib.h and do the correct thing for zlib to work, or we're not going
to be able to build zlib with importC on FreeBSD 14 (and thus can't build it
with importC in general unless we're doing something different for FreeBSD).

It doesn't look like qsort_r is being used by anything in Phobos right now, so
I don't think that the __asm__ has to actually work in this case in order to
build zlib, though __asm__ like this could definitely pop up again in the
future, since this is something that FreeBSD will sometimes do to change what's
being linked (usually to fix compatibility issues). I don't know if other OSes
do the same.

Either way, obviously, the closer that we can get to actually using the __asm__
properly, the better, and gdc and ldc are clearly in a much better position for
that.

--


More information about the Digitalmars-d-bugs mailing list