All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig
@ 2015-10-22  8:22 Bjørn Forsman
  2015-10-22  8:22 ` [Buildroot] [PATCH 2/2] Makefile: add -C flag " Bjørn Forsman
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Bjørn Forsman @ 2015-10-22  8:22 UTC (permalink / raw)
  To: buildroot

Without this, the -f path argument is ignored:

 $ strace -f -s128 /sbin/ldconfig -r /home/vagrant/buildroot/output/target -f /home/vagrant/buildroot/output/target/etc/ld.so.conf |& grep "ld\.so\.conf"
 execve("/sbin/ldconfig", ["/sbin/ldconfig", "-r", "/home/vagrant/buildroot/output/target", "-f", "/home/vagrant/buildroot/output/target/etc/ld.so.conf"], [/* 61 vars */]) = 0
 execve("/sbin/ldconfig.real", ["/sbin/ldconfig.real", "-r", "/home/vagrant/buildroot/output/target", "-f", "/home/vagrant/buildroot/output/target/etc/ld.so.conf"], [/* 61 vars */]) = 0
 write(2, "Warning: ignoring configuration file that cannot be opened: /home/vagrant/buildroot/output/target/etc/ld.so.conf", 112Warning: ignoring configuration file that cannot be opened: /home/vagrant/buildroot/output/target/etc/ld.so.conf) = 112

Proof that using root-relative path -f path (/etc/ld.so.conf, without
$(TARGET_DIR) in front) picks up the correct file:

 $ strace -f -s128 /sbin/ldconfig -r /home/vagrant/buildroot/output/target -f /etc/ld.so.conf |& grep "ld\.so\.conf"
 execve("/sbin/ldconfig", ["/sbin/ldconfig", "-r", "/home/vagrant/buildroot/output/target", "-f", "/etc/ld.so.conf"], [/* 61 vars */]) = 0
 execve("/sbin/ldconfig.real", ["/sbin/ldconfig.real", "-r", "/home/vagrant/buildroot/output/target", "-f", "/etc/ld.so.conf"], [/* 61 vars */]) = 0
 lstat("/home/vagrant/buildroot/output/target/etc/ld.so.conf", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
 open("/home/vagrant/buildroot/output/target/etc/ld.so.conf", O_RDONLY) = 3

Tested on Ubuntu 14.04.

 $ /sbin/ldconfig --version
 ldconfig (Ubuntu EGLIBC 2.19-0ubuntu6.6) 2.19
 ...

$(TARGET_CROSS)ldconfig behaves differently (at least the ldconfig I
tested, which was built by Buildroot) and should not have root-relative
-f path. If it does, it will pick up host /etc/ld.so.conf file.

Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index dd8959f..61ce1f9 100644
--- a/Makefile
+++ b/Makefile
@@ -607,7 +607,7 @@ endif
 					-f $(TARGET_DIR)/etc/ld.so.conf; \
 	else \
 		/sbin/ldconfig -r $(TARGET_DIR) \
-			       -f $(TARGET_DIR)/etc/ld.so.conf; \
+			       -f /etc/ld.so.conf; \
 	fi
 	( \
 		echo "NAME=Buildroot"; \
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 2/2] Makefile: add -C flag for /sbin/ldconfig
  2015-10-22  8:22 [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig Bjørn Forsman
@ 2015-10-22  8:22 ` Bjørn Forsman
  2015-10-22 21:19 ` [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path " Arnout Vandecappelle
  2015-12-29 20:32 ` Thomas Petazzoni
  2 siblings, 0 replies; 7+ messages in thread
From: Bjørn Forsman @ 2015-10-22  8:22 UTC (permalink / raw)
  To: buildroot

Needed when building in a FHS chroot on NixOS[1]. Without it, ldconfig
tries to open a directory in the nix store. Being explicit fixes it.

Tested that it doesn't regress on Ubuntu 14.04.

[1] I know, it's an uncommon setup :-)

Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 61ce1f9..ff812f3 100644
--- a/Makefile
+++ b/Makefile
@@ -607,6 +607,7 @@ endif
 					-f $(TARGET_DIR)/etc/ld.so.conf; \
 	else \
 		/sbin/ldconfig -r $(TARGET_DIR) \
+			       -C /etc/ld.so.cache \
 			       -f /etc/ld.so.conf; \
 	fi
 	( \
-- 
2.5.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig
  2015-10-22  8:22 [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig Bjørn Forsman
  2015-10-22  8:22 ` [Buildroot] [PATCH 2/2] Makefile: add -C flag " Bjørn Forsman
@ 2015-10-22 21:19 ` Arnout Vandecappelle
  2015-10-23  7:12   ` Bjørn Forsman
  2015-12-29 20:32 ` Thomas Petazzoni
  2 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2015-10-22 21:19 UTC (permalink / raw)
  To: buildroot

On 22-10-15 10:22, Bj?rn Forsman wrote:
> Without this, the -f path argument is ignored:
> 
>  $ strace -f -s128 /sbin/ldconfig -r /home/vagrant/buildroot/output/target -f /home/vagrant/buildroot/output/target/etc/ld.so.conf |& grep "ld\.so\.conf"
>  execve("/sbin/ldconfig", ["/sbin/ldconfig", "-r", "/home/vagrant/buildroot/output/target", "-f", "/home/vagrant/buildroot/output/target/etc/ld.so.conf"], [/* 61 vars */]) = 0
>  execve("/sbin/ldconfig.real", ["/sbin/ldconfig.real", "-r", "/home/vagrant/buildroot/output/target", "-f", "/home/vagrant/buildroot/output/target/etc/ld.so.conf"], [/* 61 vars */]) = 0
>  write(2, "Warning: ignoring configuration file that cannot be opened: /home/vagrant/buildroot/output/target/etc/ld.so.conf", 112Warning: ignoring configuration file that cannot be opened: /home/vagrant/buildroot/output/target/etc/ld.so.conf) = 112
> 
> Proof that using root-relative path -f path (/etc/ld.so.conf, without
> $(TARGET_DIR) in front) picks up the correct file:
> 
>  $ strace -f -s128 /sbin/ldconfig -r /home/vagrant/buildroot/output/target -f /etc/ld.so.conf |& grep "ld\.so\.conf"
>  execve("/sbin/ldconfig", ["/sbin/ldconfig", "-r", "/home/vagrant/buildroot/output/target", "-f", "/etc/ld.so.conf"], [/* 61 vars */]) = 0
>  execve("/sbin/ldconfig.real", ["/sbin/ldconfig.real", "-r", "/home/vagrant/buildroot/output/target", "-f", "/etc/ld.so.conf"], [/* 61 vars */]) = 0
>  lstat("/home/vagrant/buildroot/output/target/etc/ld.so.conf", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
>  open("/home/vagrant/buildroot/output/target/etc/ld.so.conf", O_RDONLY) = 3
> 
> Tested on Ubuntu 14.04.
> 
>  $ /sbin/ldconfig --version
>  ldconfig (Ubuntu EGLIBC 2.19-0ubuntu6.6) 2.19
>  ...
> 
> $(TARGET_CROSS)ldconfig behaves differently (at least the ldconfig I
> tested, which was built by Buildroot) and should not have root-relative
> -f path. If it does, it will pick up host /etc/ld.so.conf file.

 This makes me worried that it will do the wrong thing on some other build
hosts. In fact, using /sbin/ldconfig is fundamentally broken since we can't be
sure that it's compatible with the target dynamic linker.


 Regards,
 Arnout

> 
> Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index dd8959f..61ce1f9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -607,7 +607,7 @@ endif
>  					-f $(TARGET_DIR)/etc/ld.so.conf; \
>  	else \
>  		/sbin/ldconfig -r $(TARGET_DIR) \
> -			       -f $(TARGET_DIR)/etc/ld.so.conf; \
> +			       -f /etc/ld.so.conf; \
>  	fi
>  	( \
>  		echo "NAME=Buildroot"; \
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig
  2015-10-22 21:19 ` [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path " Arnout Vandecappelle
@ 2015-10-23  7:12   ` Bjørn Forsman
  2015-10-23  8:26     ` Thomas Petazzoni
  0 siblings, 1 reply; 7+ messages in thread
From: Bjørn Forsman @ 2015-10-23  7:12 UTC (permalink / raw)
  To: buildroot

On 22 October 2015 at 23:19, Arnout Vandecappelle <arnout@mind.be> wrote:
> This makes me worried that it will do the wrong thing on some other build
> hosts. In fact, using /sbin/ldconfig is fundamentally broken since we can't be
> sure that it's compatible with the target dynamic linker.

If you don't want to apply this patch, that is totally fine. It just
fixes a warning I saw while debugging an issue that ended up being
fixed by the next patch:

[PATCH 2/2] Makefile: add -C flag for /sbin/ldconfig

The 2nd patch is the one I really care about, it currently blocks me
from running Buildroot in my preferred environment.

If you want to completely remove use of (host) /sbin/ldconfig, that's fine too.

Just tell me what to do :-)

- Bj?rn

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig
  2015-10-23  7:12   ` Bjørn Forsman
@ 2015-10-23  8:26     ` Thomas Petazzoni
  2015-10-23 12:06       ` Bjørn Forsman
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Petazzoni @ 2015-10-23  8:26 UTC (permalink / raw)
  To: buildroot

Dear Bj?rn Forsman,

On Fri, 23 Oct 2015 09:12:02 +0200, Bj?rn Forsman wrote:

> If you want to completely remove use of (host) /sbin/ldconfig, that's fine too.
> 
> Just tell me what to do :-)

We need to completely remove the ldconfig stuff, since it simply cannot
work. However, there is at least one package (mysql) that installs
libraries in a non-standard location (/usr/lib/mysql) and relies on
ld.so.conf for the dynamic linker to find them. I believe we need to
fix MySQL so that it installs its libraries in /usr/lib, and then get
rid of all the ldconfig/ld.so.conf stuff.

Or, alternatively, see how to get it working with an init script which
runs ldconfig at boot time. But then you have to look at how uClibc and
musl handle this, and implement a solution that works for all three C
libraries.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig
  2015-10-23  8:26     ` Thomas Petazzoni
@ 2015-10-23 12:06       ` Bjørn Forsman
  0 siblings, 0 replies; 7+ messages in thread
From: Bjørn Forsman @ 2015-10-23 12:06 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

On 23 October 2015 at 10:26, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Dear Bj?rn Forsman,
>
> On Fri, 23 Oct 2015 09:12:02 +0200, Bj?rn Forsman wrote:
>
>> If you want to completely remove use of (host) /sbin/ldconfig, that's fine too.
>>
>> Just tell me what to do :-)
>
> We need to completely remove the ldconfig stuff, since it simply cannot
> work. However, there is at least one package (mysql) that installs
> libraries in a non-standard location (/usr/lib/mysql) and relies on
> ld.so.conf for the dynamic linker to find them. I believe we need to
> fix MySQL so that it installs its libraries in /usr/lib, and then get
> rid of all the ldconfig/ld.so.conf stuff.
>
> Or, alternatively, see how to get it working with an init script which
> runs ldconfig at boot time. But then you have to look at how uClibc and
> musl handle this, and implement a solution that works for all three C
> libraries.

Sounds like a bigger task than I planned... :-/  (I'm afraid to break things.)

Would it be possible to merge "[PATCH 2/2] Makefile: add -C flag for
/sbin/ldconfig" as a stop-gap fix for my build problem then?

- Bj?rn

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig
  2015-10-22  8:22 [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig Bjørn Forsman
  2015-10-22  8:22 ` [Buildroot] [PATCH 2/2] Makefile: add -C flag " Bjørn Forsman
  2015-10-22 21:19 ` [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path " Arnout Vandecappelle
@ 2015-12-29 20:32 ` Thomas Petazzoni
  2 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni @ 2015-12-29 20:32 UTC (permalink / raw)
  To: buildroot

Bj?rn,

On Thu, 22 Oct 2015 10:22:30 +0200, Bj?rn Forsman wrote:

> $(TARGET_CROSS)ldconfig behaves differently (at least the ldconfig I
> tested, which was built by Buildroot) and should not have root-relative
> -f path. If it does, it will pick up host /etc/ld.so.conf file.
> 
> Signed-off-by: Bj?rn Forsman <bjorn.forsman@gmail.com>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

As we discussed previously, our ldconfig handling is broken. So we are
simply planning to remove entirely. I have just posted a patch to this
effect:

	https://patchwork.ozlabs.org/patch/561618/

The idea is that from now on, packages are expected to install
libraries in path that are in the default search path of the dynamic
linker.

Consequently, I've marked your patches as Superseded. If you find any
package that doesn't work properly following our ldconfig removal, do
not hesitate to let us know.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-29 20:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22  8:22 [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path for /sbin/ldconfig Bjørn Forsman
2015-10-22  8:22 ` [Buildroot] [PATCH 2/2] Makefile: add -C flag " Bjørn Forsman
2015-10-22 21:19 ` [Buildroot] [PATCH 1/2] Makefile: use root-relative -f path " Arnout Vandecappelle
2015-10-23  7:12   ` Bjørn Forsman
2015-10-23  8:26     ` Thomas Petazzoni
2015-10-23 12:06       ` Bjørn Forsman
2015-12-29 20:32 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.