Message ID | 1414768749-15134-1-git-send-email-jezz@sysmic.org |
---|---|
State | Changes Requested |
Headers | show |
Dear Jérôme Pouiller, On Fri, 31 Oct 2014 16:19:07 +0100, Jérôme Pouiller wrote: > +ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) > +define GENERATE_LD_SO_CONF_FILE > + ls $(TARGET_DIR)/etc/ld.so.conf.d/*.conf > /dev/null 2>&1 && \ > + echo "Usage of /etc/ld.so.conf.d/*.conf files with musl libc is not supported" We should error out here. Does musl supports /etc/ld.so.conf ? If so, then I believe we should simply not use the /etc/ld.so.conf.d/ feature of glibc, and instead keep using /etc/ld.so.conf only, like MySQL was doing. If you don't want to see repeated entries, you can do something like: grep -q "^/usr/lib/mysql$" $(TARGET_DIR)/etc/ld.so.conf || echo "/usr/lib/mysql" >> $(TARGET_DIR)/etc/ld.so.conf We could even imagine having a make function to do that. Best regards, Thomas
On Friday 31 October 2014 16:41:56 Thomas Petazzoni wrote: > Dear Jérôme Pouiller, > > On Fri, 31 Oct 2014 16:19:07 +0100, Jérôme Pouiller wrote: > > +ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) > > +define GENERATE_LD_SO_CONF_FILE > > + ls $(TARGET_DIR)/etc/ld.so.conf.d/*.conf > /dev/null 2>&1 && \ > > + echo "Usage of /etc/ld.so.conf.d/*.conf files with musl libc is not > > supported" > We should error out here. User may fix problem by providing correct file in an overlay. However, I haven't a strong opinion about that. > Does musl supports /etc/ld.so.conf ? I have checked in sources and it seems it doesn't :( . It use a file called /etc/ld-musl-${ARCH}.path (with ARCH={arm,x86,...}). Syntax of this file is same than $LD_LIBRARY_PATH (paths separated with ':'). > If so, then I believe we should > simply not use the /etc/ld.so.conf.d/ feature of glibc, and instead > keep using /etc/ld.so.conf only, like MySQL was doing. > > If you don't want to see repeated entries, you can do something like: > > grep -q "^/usr/lib/mysql$" $(TARGET_DIR)/etc/ld.so.conf || > echo "/usr/lib/mysql" >> $(TARGET_DIR)/etc/ld.so.conf > > We could even imagine having a make function to do that. The two options have their drawbacks. I have no strong opinion.
Jérôme, All, On 2014-10-31 16:19 +0100, Jérôme Pouiller spake thusly: > Signed-off-by: Jérôme Pouiller <jezz@sysmic.org> > --- > toolchain/toolchain.mk | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/toolchain/toolchain.mk b/toolchain/toolchain.mk > index 3f9900b..cd65cfc 100644 > --- a/toolchain/toolchain.mk > +++ b/toolchain/toolchain.mk > @@ -13,6 +13,31 @@ endef > TARGET_FINALIZE_HOOKS += GLIBC_COPY_NSSWITCH_FILE > endif > > +# - glibc can include configuration files at runtime > +# - uclibc does not support "include" feature > +# - musl use /etc/ld-musl-${ARCH}.path file. This file use same syntax > +# than $LD_LIBRARY_PATH. Since there are plenty of corner cases in > +# generation of this file, we prefer to not support it. User can > +# fix the problem by providing file manualy (in a an overlay). > +# > +ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y) > +define GENERATE_LD_SO_CONF_FILE > + echo 'include /etc/ld.so.conf.d/*.conf' > $(TARGET_DIR)/etc/ld.so.conf > +endef > +else > +ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) > +define GENERATE_LD_SO_CONF_FILE > + ls $(TARGET_DIR)/etc/ld.so.conf.d/*.conf > /dev/null 2>&1 && \ > + echo "Usage of /etc/ld.so.conf.d/*.conf files with musl libc is not supported" > +endef > +else # UCLIBC > +define GENERATE_LD_SO_CONF_FILE > + cat $(TARGET_DIR)/etc/ld.so.conf.d/*.conf > $(TARGET_DIR)/etc/ld.so.conf > +endef > +endif > +endif > +TARGET_FINALIZE_HOOKS += GENERATE_LD_SO_CONF_FILE I think it would be much better to not support this glibcism. I can only see one use-case for that: - the package installs such a file in its install procedure => we should provide a post-install hook to move the content of this file into /etc/ld.so.conf As Thomas P. said, we can provide a macro to ease doing that. I propose something slightly different, because 'grep -q' is not portable and I do not like 'echo': # Add a path in $(1) to /etc/ld.so.conf define UPDATE_LD_SO_CONF grep -E '^$(1)$$' $(TARGET_DIR)/etc/ld.so.conf >/dev/null 2>&1 || \ printf '%s\n' '$(1)' >>$(TARGET_DIR)/etc/ld.so.conf endef which you could then call like that: define FOO_UPDATE_LD_SO_CONF $(call UPDATE_LD_SO_CONF,/usr/lib/foo) endef FOO_POST_TARGET_INSTALL_HOOKS += FOO_UPDATE_LD_SO_CONF Alternatively, we could include that in the pakage infra: FOO_LD_SO_CONF_PATHS = /usr/lib/foo /usr/lib/foo/bar and the infra would look at that variable, and if set, add all the paths to /et/ld/so/conf. I thionk the pkg-infra solution is a bit overkill, given we currently do not have that much packages that use that (well, only mysql needs it), but the macro would not be very much justified either. So, I just NAK this feature. Regards, Yann E. MORIN. > # Install the gconv modules > ifeq ($(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY),y) > GCONV_LIBS = $(call qstrip,$(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_LIST)) > -- > 1.9.1 >
Hi Jérôme, On Fri, Oct 31, 2014 at 04:19:07PM +0100, Jérôme Pouiller wrote: > Signed-off-by: Jérôme Pouiller <jezz@sysmic.org> > --- > toolchain/toolchain.mk | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/toolchain/toolchain.mk b/toolchain/toolchain.mk > index 3f9900b..cd65cfc 100644 > --- a/toolchain/toolchain.mk > +++ b/toolchain/toolchain.mk > @@ -13,6 +13,31 @@ endef > TARGET_FINALIZE_HOOKS += GLIBC_COPY_NSSWITCH_FILE > endif > > +# - glibc can include configuration files at runtime > +# - uclibc does not support "include" feature > +# - musl use /etc/ld-musl-${ARCH}.path file. This file use same syntax > +# than $LD_LIBRARY_PATH. Since there are plenty of corner cases in s/than/as/ > +# generation of this file, we prefer to not support it. User can > +# fix the problem by providing file manualy (in a an overlay). Redundant "a". baruch
diff --git a/toolchain/toolchain.mk b/toolchain/toolchain.mk index 3f9900b..cd65cfc 100644 --- a/toolchain/toolchain.mk +++ b/toolchain/toolchain.mk @@ -13,6 +13,31 @@ endef TARGET_FINALIZE_HOOKS += GLIBC_COPY_NSSWITCH_FILE endif +# - glibc can include configuration files at runtime +# - uclibc does not support "include" feature +# - musl use /etc/ld-musl-${ARCH}.path file. This file use same syntax +# than $LD_LIBRARY_PATH. Since there are plenty of corner cases in +# generation of this file, we prefer to not support it. User can +# fix the problem by providing file manualy (in a an overlay). +# +ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y) +define GENERATE_LD_SO_CONF_FILE + echo 'include /etc/ld.so.conf.d/*.conf' > $(TARGET_DIR)/etc/ld.so.conf +endef +else +ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y) +define GENERATE_LD_SO_CONF_FILE + ls $(TARGET_DIR)/etc/ld.so.conf.d/*.conf > /dev/null 2>&1 && \ + echo "Usage of /etc/ld.so.conf.d/*.conf files with musl libc is not supported" +endef +else # UCLIBC +define GENERATE_LD_SO_CONF_FILE + cat $(TARGET_DIR)/etc/ld.so.conf.d/*.conf > $(TARGET_DIR)/etc/ld.so.conf +endef +endif +endif +TARGET_FINALIZE_HOOKS += GENERATE_LD_SO_CONF_FILE + # Install the gconv modules ifeq ($(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY),y) GCONV_LIBS = $(call qstrip,$(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_LIST))
Signed-off-by: Jérôme Pouiller <jezz@sysmic.org> --- toolchain/toolchain.mk | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)