Re: [PATCH] ft-hb.c: define _GNU_SOURCE for RTLD_DEFAULT

Behdad Esfahbod <[email protected]> Wed, 4 Jun 2025 11:54:58 -0600
Newsgroups gmane.comp.fonts.freetype.devel
Message-ID <CAF63+7U84Jg95=0nSfVansQ-Wq6x0_wqUrVhEEb+vv6EBZ9Y7Q@mail.gmail.com>
--0000000000009b84550636c2b353
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Werner,

I suggest applying this as well, which is what you describe in my commit
but is not actually done in the code:

```patch
diff --git a/src/autofit/ft-hb.c b/src/autofit/ft-hb.c
index bcb4c932f..3c145d046 100644
--- a/src/autofit/ft-hb.c
+++ b/src/autofit/ft-hb.c
@@ -101,8 +101,11 @@
 #else /* !_WIN32 */

 #  ifdef RTLD_DEFAULT
+#    define FT_RTLD_FLAGS RTLD_LAZY | RTLD_GLOBAL
     lib             =3D RTLD_DEFAULT;
     version_atleast =3D DLSYM( lib, hb_version_atleast );
+#  else
+#    define FT_RTLD_FLAGS RTLD_LAZY
 #  endif

     if ( !version_atleast )
@@ -116,7 +119,7 @@
        * variables, and closing the library will cause them to be
        * invalidated.
        */
-      lib =3D dlopen( FT_LIBHARFBUZZ, RTLD_LAZY | RTLD_GLOBAL );
+      lib =3D dlopen( FT_LIBHARFBUZZ, FT_RTLD_FLAGS );
       if ( !lib )
         goto Fail;
       version_atleast =3D DLSYM( lib, hb_version_atleast );
```



behdad
http://behdad.org/


On Mon, Jun 2, 2025 at 10:36=E2=80=AFPM Werner LEMBERG <[email protected]> wrote:

>
> > RTLD_DEFAULT may be guarded by __USE_GNU which then would lead to build
> > failures. [...]
>
> Thanks for your two patches; I will soon take care of them.
>
>
>     Werner
>
>

--0000000000009b84550636c2b353
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi Werner,</div><div><br></div><div>I suggest applyin=
g this as well, which is what you describe in my commit but is not actually=
 done in the code:</div><div><br></div><div>```patch</div><div>diff --git a=
/src/autofit/ft-hb.c b/src/autofit/ft-hb.c<br>index bcb4c932f..3c145d046 10=
0644<br>--- a/src/autofit/ft-hb.c<br>+++ b/src/autofit/ft-hb.c<br>@@ -101,8=
 +101,11 @@<br>=C2=A0#else /* !_WIN32 */<br>=C2=A0<br>=C2=A0# =C2=A0ifdef R=
TLD_DEFAULT<br>+# =C2=A0 =C2=A0define FT_RTLD_FLAGS RTLD_LAZY | RTLD_GLOBAL=
<br>=C2=A0 =C2=A0 =C2=A0lib =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D R=
TLD_DEFAULT;<br>=C2=A0 =C2=A0 =C2=A0version_atleast =3D DLSYM( lib, hb_vers=
ion_atleast );<br>+# =C2=A0else<br>+# =C2=A0 =C2=A0define FT_RTLD_FLAGS RTL=
D_LAZY<br>=C2=A0# =C2=A0endif<br>=C2=A0<br>=C2=A0 =C2=A0 =C2=A0if ( !versio=
n_atleast )<br>@@ -116,7 +119,7 @@<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 * variabl=
es, and closing the library will cause them to be<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 * invalidated.<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 */<br>- =C2=A0 =C2=A0 =
=C2=A0lib =3D dlopen( FT_LIBHARFBUZZ, RTLD_LAZY | RTLD_GLOBAL );<br>+ =C2=
=A0 =C2=A0 =C2=A0lib =3D dlopen( FT_LIBHARFBUZZ, FT_RTLD_FLAGS );<br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0if ( !lib )<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto =
Fail;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0version_atleast =3D DLSYM( lib, hb_vers=
ion_atleast );</div><div>```</div><div><br></div><div><br></div><div><br></=
div><div><div dir=3D"ltr" class=3D"gmail_signature" data-smartmail=3D"gmail=
_signature">behdad<br><a href=3D"http://behdad.org/" target=3D"_blank">http=
://behdad.org/</a></div></div><br></div><br><div class=3D"gmail_quote gmail=
_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Jun 2, 2025=
 at 10:36=E2=80=AFPM Werner LEMBERG &lt;<a href=3D"mailto:[email protected]">wl@gn=
u.org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:=
1ex"><br>
&gt; RTLD_DEFAULT may be guarded by __USE_GNU which then would lead to buil=
d<br>
&gt; failures. [...]<br>
<br>
Thanks for your two patches; I will soon take care of them.<br>
<br>
<br>
=C2=A0 =C2=A0 Werner<br>
<br>
</blockquote></div>

--0000000000009b84550636c2b353--