Mailing List Archive

issues with current libtool.m4 in macOS 11.x
Hello,

A few days ago I sent a patch to update libtool.m4 out of the blue.
The reason for this update is that the current libtool.m4 doesn't
support macOS 11.x properly which means libgcrypt is linked with the
option flat_namespace.

This shouldn't be a problem except when using dlopen with RTLD_LAZY |
RTLD_LOCAL mode. When using this mode dyld will fail with this error:

dyld: lazy symbol binding failed: Symbol not found:
__gcry_check_version Referenced from: /usr/local/lib/libgcrypt.dylib
Expected in: flat namespace

dyld: Symbol not found: __gcry_check_version Referenced from:
/usr/local/lib/libgcrypt.dylib Expected in: flat namespace

More details about why this happens can be found in this thread:

https://developer.apple.com/forums//thread/689991

I found this issue while trying to use guile-gcrypt in Guile 3.0.7.
Since guile 3.0.6, dlopen is used with RTLD_LAZY | RTLD_LOCAL.

Also, it seems libgpg-error has the same issue. It would be fantastic
if you could update both, with or without my patch.

Thank you so much in advance,

Aleix

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: issues with current libtool.m4 in macOS 11.x [ In reply to ]
Hello,

Aleix Conchillo FlaquƩ wrote:
> A few days ago I sent a patch to update libtool.m4 out of the blue.
> The reason for this update is that the current libtool.m4 doesn't
> support macOS 11.x properly which means libgcrypt is linked with the
> option flat_namespace.

Thank you for your report. I created a ticket to track this issue:

https://dev.gnupg.org/T5610

If our purpose is to minimize the changes of GnuPG and its friends, I
think that the change could be minimized like the following.

diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 8795701..a83d3f1 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1054,7 +1054,7 @@ _LT_EOF
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
10.[[012]]*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- 10.*)
+ 10.*|11.*)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
esac
;;
--

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Re: issues with current libtool.m4 in macOS 11.x [ In reply to ]
On Tue, Sep 21, 2021 at 12:28 AM NIIBE Yutaka <gniibe@fsij.org> wrote:
>
> Hello,
>
> Aleix Conchillo FlaquƩ wrote:
> > A few days ago I sent a patch to update libtool.m4 out of the blue.
> > The reason for this update is that the current libtool.m4 doesn't
> > support macOS 11.x properly which means libgcrypt is linked with the
> > option flat_namespace.
>
> Thank you for your report. I created a ticket to track this issue:
>
> https://dev.gnupg.org/T5610
>

Thank you!

> If our purpose is to minimize the changes of GnuPG and its friends, I
> think that the change could be minimized like the following.
>
> diff --git a/m4/libtool.m4 b/m4/libtool.m4
> index 8795701..a83d3f1 100644
> --- a/m4/libtool.m4
> +++ b/m4/libtool.m4
> @@ -1054,7 +1054,7 @@ _LT_EOF
> _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
> 10.[[012]]*)
> _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
> - 10.*)
> + 10.*|11.*)
> _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
> esac
> ;;
> --

With this it seems we will get the same issue when macOS releases 12.x
(whenever that is). Should we use what new libtool.m4 does instead? It
basically improves version detection and makes it generic for future
macOS versions (it keeps the same linking options as before, so no big
risks I believe).

diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 8795701e..77d62f75 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1045,16 +1045,11 @@ _LT_EOF
_lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
darwin1.*)
_lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined
${wl}suppress' ;;
- darwin*) # darwin 5.x on
- # if running on 10.5 or later, the deployment target defaults
- # to the OS version, if on x86, and 10.4, the deployment
- # target defaults to 10.4. Don't you love it?
- case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
- 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- 10.[[012]]*)
+ darwin*)
+ case ${MACOSX_DEPLOYMENT_TARGET},$host in
+ 10.[[012]],*|,*powerpc*)
_lt_dar_allow_undefined='${wl}-flat_namespace
${wl}-undefined ${wl}suppress' ;;
- 10.*)
+ *)
_lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
esac
;;

_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel