Message ID | 20191203001405.12984-1-unixmania@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | package/glibc: drop dependency of utilities on bash | expand |
On Mon, 2 Dec 2019 21:14:05 -0300 unixmania@gmail.com wrote: > From: Carlos Santos <unixmania@gmail.com> > > The dependency was added because ldd uses bash-specific syntax to > localize messages. Add a post-patch hook, instead, to replace the > occurrences of $"foo" by "foo", simply, so the code becomes POSIX > sh compliant if bash is not selected. > > Also set the configuration environment accordingly to replace the > /bin/bash hashbang by /bin/sh. > > Signed-off-by: Carlos Santos <unixmania@gmail.com> I've applied, however I think it would be nice to have this mechanism supported upstream. It can probably be easily added using a check in configure.ac, and the proper autoconf replacement variable when generating elf/ldd.bash. Could you have a look into this ? Thanks! Thomas
On Thu, Dec 5, 2019 at 7:17 PM Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > > On Mon, 2 Dec 2019 21:14:05 -0300 > unixmania@gmail.com wrote: > > > From: Carlos Santos <unixmania@gmail.com> > > > > The dependency was added because ldd uses bash-specific syntax to > > localize messages. Add a post-patch hook, instead, to replace the > > occurrences of $"foo" by "foo", simply, so the code becomes POSIX > > sh compliant if bash is not selected. > > > > Also set the configuration environment accordingly to replace the > > /bin/bash hashbang by /bin/sh. > > > > Signed-off-by: Carlos Santos <unixmania@gmail.com> > > I've applied, however I think it would be nice to have this mechanism > supported upstream. It can probably be easily added using a check in > configure.ac, and the proper autoconf replacement variable when > generating elf/ldd.bash. > > Could you have a look into this ? > > Thanks! I'm working on a patch series to glibc but it requires ATORECONF, which fails because GLIBC_SUBDIR is set to "build" and there configure.ac is not there. I circumvented the problem by using define GLIBC_AUTORECONF cd $(@D) && $(AUTORECONF) || true endef GLIBC_PRE_CONFIGURE_HOOKS = GLIBC_AUTORECONF The "|| true" there is a kludge to ignore this error: Use of uninitialized value $args[0] in split at /work/qemu_x86_64_glibc_eudev/host/bin/autoreconf line 493, <GEN2> line 4. autoheader: warning: missing template: BIND_NOW autoheader: Use AC_DEFINE([BIND_NOW], [], [Description]) autoheader: warning: missing template: DO_STATIC_NSS autoheader: warning: missing template: ENABLE_STACKGUARD_RANDOMIZE autoheader: warning: missing template: ENABLE_STATIC_PIE autoheader: warning: missing template: EXPORT_UNWIND_FIND_FDE autoheader: warning: missing template: HAVE_ASM_SET_DIRECTIVE autoheader: warning: missing template: HAVE_BUILTIN_MEMSET autoheader: warning: missing template: HAVE_BUILTIN_TRAP autoheader: warning: missing template: HAVE_CC_INHIBIT_LOOP_TO_LIBCALL autoheader: warning: missing template: HAVE_CC_NO_STACK_PROTECTOR autoheader: warning: missing template: HAVE_CC_WITH_LIBUNWIND autoheader: warning: missing template: HAVE_EHDR_START autoheader: warning: missing template: HAVE_GCC_IFUNC autoheader: warning: missing template: HAVE_IFUNC autoheader: warning: missing template: HAVE_PT_CHOWN autoheader: warning: missing template: HAVE_SDATA_SECTION autoheader: warning: missing template: HAVE_SECTION_QUOTES autoheader: warning: missing template: HAVE_TUNABLES autoheader: warning: missing template: HAVE_Z_COMBRELOC autoheader: warning: missing template: LINK_OBSOLETE_NSL autoheader: warning: missing template: LINK_OBSOLETE_RPC autoheader: warning: missing template: NO_CTORS_DTORS_SECTIONS autoheader: warning: missing template: NO_HIDDEN autoheader: warning: missing template: STACK_PROTECTOR_LEVEL autoheader: warning: missing template: USE_LDCONFIG autoheader: warning: missing template: USE_MULTIARCH autoheader: warning: missing template: USE_NSCD autoheader: warning: missing template: USE_STAP_PROBE autoreconf: /work/qemu_x86_64_glibc_eudev/host/bin/autoheader failed with exit status: 1 -- Carlos Santos <unixmania@gmail.com>
Hello Carlos, On Sun, 8 Dec 2019 22:38:52 -0300 Carlos Santos <unixmania@gmail.com> wrote: > I'm working on a patch series to glibc but it requires ATORECONF, > which fails because GLIBC_SUBDIR is set to "build" and there > configure.ac is not there. I circumvented the problem by using > > define GLIBC_AUTORECONF > cd $(@D) && $(AUTORECONF) || true > endef > > GLIBC_PRE_CONFIGURE_HOOKS = GLIBC_AUTORECONF > > The "|| true" there is a kludge to ignore this error: > > Use of uninitialized value $args[0] in split at > /work/qemu_x86_64_glibc_eudev/host/bin/autoreconf line 493, <GEN2> Hum, OK. Perhaps another way is to simply have your patch make its way upstream, and wait until the next glibc release to really use it in Buildroot. In the mean time, we can keep the post patch hook that you have implemented and that was merged in Buildroot. What is important is that at some point in the future, there will be an upstream solution. We don't necessarily need to use it immediately in Buildroot. Best regards, Thomas
On Mon, Dec 9, 2019 at 4:53 AM Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > > Hello Carlos, > > On Sun, 8 Dec 2019 22:38:52 -0300 > Carlos Santos <unixmania@gmail.com> wrote: > > > I'm working on a patch series to glibc but it requires ATORECONF, > > which fails because GLIBC_SUBDIR is set to "build" and there > > configure.ac is not there. I circumvented the problem by using > > > > define GLIBC_AUTORECONF > > cd $(@D) && $(AUTORECONF) || true > > endef > > > > GLIBC_PRE_CONFIGURE_HOOKS = GLIBC_AUTORECONF > > > > The "|| true" there is a kludge to ignore this error: > > > > Use of uninitialized value $args[0] in split at > > /work/qemu_x86_64_glibc_eudev/host/bin/autoreconf line 493, <GEN2> > > Hum, OK. Perhaps another way is to simply have your patch make its way > upstream, and wait until the next glibc release to really use it in > Buildroot. In the mean time, we can keep the post patch hook that you > have implemented and that was merged in Buildroot. > > What is important is that at some point in the future, there will be an > upstream solution. We don't necessarily need to use it immediately in > Buildroot. RFE submitted: https://sourceware.org/bugzilla/show_bug.cgi?id=25259
On Mon, 9 Dec 2019 08:41:40 -0300 Carlos Santos <unixmania@gmail.com> wrote: > > Hum, OK. Perhaps another way is to simply have your patch make its way > > upstream, and wait until the next glibc release to really use it in > > Buildroot. In the mean time, we can keep the post patch hook that you > > have implemented and that was merged in Buildroot. > > > > What is important is that at some point in the future, there will be an > > upstream solution. We don't necessarily need to use it immediately in > > Buildroot. > > RFE submitted: https://sourceware.org/bugzilla/show_bug.cgi?id=25259 Thanks a lot! Much appreciated. Thomas
diff --git a/package/glibc/Config.in b/package/glibc/Config.in index b8c2573d96..7b2f246947 100644 --- a/package/glibc/Config.in +++ b/package/glibc/Config.in @@ -11,10 +11,6 @@ endif config BR2_PACKAGE_GLIBC_UTILS bool "Install glibc utilities" - depends on BR2_PACKAGE_BASH help Enabling this option will compile and install the getconf, ldconfig, ldd and locale glibc utilities for the target. - -comment "glibc utilities need bash" - depends on !BR2_PACKAGE_BASH diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk index 8eafa55ae1..1b38f8aedb 100644 --- a/package/glibc/glibc.mk +++ b/package/glibc/glibc.mk @@ -74,10 +74,19 @@ endef endif GLIBC_CONF_ENV = \ - ac_cv_path_BASH_SHELL=/bin/bash \ + ac_cv_path_BASH_SHELL=/bin/$(if $(BR2_PACKAGE_BASH),bash,sh) \ libc_cv_forced_unwind=yes \ libc_cv_ssp=no +# POSIX shell does not support localization, so remove the corresponding +# syntax from ldd if bash is not selected. +ifeq ($(BR2_PACKAGE_BASH),) +define GLIBC_LDD_NO_BASH + $(SED) 's/$$"/"/g' $(@D)/elf/ldd.bash.in +endef +GLIBC_POST_PATCH_HOOKS += GLIBC_LDD_NO_BASH +endif + # Override the default library locations of /lib64/<abi> and # /usr/lib64/<abi>/ for RISC-V. ifeq ($(BR2_riscv),y)