From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: buildroot@buildroot.org
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [Buildroot] [PATCH] toolchain/external: remove libcrypt from glibc
Date: Tue, 9 Apr 2024 23:56:40 +0200 [thread overview]
Message-ID: <ZhW5mPPJpbhA1D0i@landeda> (raw)
In-Reply-To: <20240408205742.1422545-1-yann.morin.1998@free.fr>
All,
On 2024-04-08 22:57 +0200, Yann E. MORIN spake thusly:
> Note: this commit only deals with glibc and its internal libcrypt (or
> lack thereof); other C libraries, musl and uClibc-NG, are not considered.
[--SNIP--]
> So, we remove from staging whatever could be used to compile and link
> with libcrypt. We however keep the SO_NAME file, if it exists, and we
> also install it in target/, for those pre-built binaries that may be
> linked with it [1]. The glibc SO_NAME has always been libcrypt.so.1, so
> this is what we copy exactly, to avoid copying the libxcrypt one, which
> is libcrypt.so.2.
>
> [0] that could happen if a toolchain provider tried to be helpful and
> suplies a toolchain with libxcrypt to be trasnparent to users, in which
> case that would conflict with ours...
>
> [1] if such a prebuilt binary (executable or library) is used with a
> glibc 2.39 or later toolchain, it will obviously not work at all.
> libxcrypt is supposed to be a drop-in replacement for glibc's libcrypt,
> so we could look into symlinking libcrypt.so.1 to libcrypt.so.2. In a
> later patch, maybe...
>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Applied to master, with the fixes pointed out by Thomas, thanks.
Regards,
Yann E. MORIN.
> ---
> .../pkg-toolchain-external.mk | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index ddf1d70ab4..9b0652c4e5 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -120,7 +120,7 @@ TOOLCHAIN_EXTERNAL_LIBS += libssp.so.*
> endif
>
> ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
> -TOOLCHAIN_EXTERNAL_LIBS += libc.so.* libcrypt.so.* libdl.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.*
> +TOOLCHAIN_EXTERNAL_LIBS += libc.so.* libdl.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.*
> ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
> TOOLCHAIN_EXTERNAL_LIBS += libpthread.so.*
> ifneq ($(BR2_PACKAGE_GDB)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),)
> @@ -129,8 +129,23 @@ endif # gdbserver
> endif # ! no threads
> endif
>
> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
> +# uClibc, though mono-lib, still has a separate libcrypt as a stub
> +TOOLCHAIN_EXTERNAL_LIBS += libcrypt.so.*
> +endif
> +
> ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
> TOOLCHAIN_EXTERNAL_LIBS += libnss_files.so.* libnss_dns.so.* libmvec.so.* libanl.so.*
> +# Note: explicitly do copy libcrypt*.so.* even for glibc: it is not the same
> +# SONAME as the one from libxcrypt, so no conflict, but some prebuilt binaries
> +# may have it in their DT_NEEDED. However, do remove the headers, static lib,
> +# and symlink to avoid conflict, as they are not needed at buildtime.
> +TOOLCHAIN_EXTERNAL_LIBS += libcrypt.so.1
> +define TOOLCHAIN_EXTERNAL_GLIBC_NO_LIBCRYPT
> + rm -f $(STAGING_DIR)/usr/include/crypt.h \
> + $(STAGING_DIR)/usr/lib/libcrypt.so \
> + $(STAGING_DIR)/usr/lib/libcrypt.a
> +endef
> endif
>
> ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y)
> @@ -599,6 +614,7 @@ define $(2)_INSTALL_STAGING_CMDS
> $$(TOOLCHAIN_WRAPPER_INSTALL)
> $$(TOOLCHAIN_EXTERNAL_CREATE_STAGING_LIB_SYMLINK)
> $$(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS)
> + $$(TOOLCHAIN_EXTERNAL_GLIBC_NO_LIBCRYPT)
> $$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
> $$(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT)
> $$(TOOLCHAIN_EXTERNAL_FIXUP_PRETTY_PRINTER_LOADER)
> --
> 2.44.0
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2024-04-09 21:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 20:57 [Buildroot] [PATCH] toolchain/external: remove libcrypt from glibc Yann E. MORIN
2024-04-09 19:51 ` Thomas Petazzoni via buildroot
2024-04-09 20:35 ` Yann E. MORIN
2024-04-09 21:56 ` Yann E. MORIN [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZhW5mPPJpbhA1D0i@landeda \
--to=yann.morin.1998@free.fr \
--cc=buildroot@buildroot.org \
--cc=fontaine.fabrice@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox