All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] How do you add to library path?
@ 2012-04-26 17:42 Grant Edwards
  2012-04-26 20:12 ` Bernhard Reutner-Fischer
  2012-04-27 22:18 ` Arnout Vandecappelle
  0 siblings, 2 replies; 7+ messages in thread
From: Grant Edwards @ 2012-04-26 17:42 UTC (permalink / raw)
  To: buildroot

What's the right way to permanently add a directory to the search path
for dynamic libraries?  (Preferably at build-time, rather than at
run-time.)

I've added the directory path to /etc/ld.so.conf using a post-build
script. But, that file seems to be ignored at boot time (and there is
no "ldconfig" to run even if I wanted to).

I suppose I could set LD_LIBRARY_PATH globally, but for performance
reasons, I'd prefer that the new path went into /etc/ld.so.cache. [I'm
not sure how one sets a global environment variable anyway.]

There have been several threads about this in the past, but none of
them seemed to offer any answers...

-- 
Grant Edwards               grant.b.edwards        Yow! I want a VEGETARIAN
                                  at               BURRITO to go ... with
                              gmail.com            EXTRA MSG!!

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

* [Buildroot] How do you add to library path?
  2012-04-26 17:42 [Buildroot] How do you add to library path? Grant Edwards
@ 2012-04-26 20:12 ` Bernhard Reutner-Fischer
  2012-04-27 22:18 ` Arnout Vandecappelle
  1 sibling, 0 replies; 7+ messages in thread
From: Bernhard Reutner-Fischer @ 2012-04-26 20:12 UTC (permalink / raw)
  To: buildroot

On 26 April 2012 19:42, Grant Edwards <grant.b.edwards@gmail.com> wrote:
> What's the right way to permanently add a directory to the search path
> for dynamic libraries? ?(Preferably at build-time, rather than at
> run-time.)
>
> I've added the directory path to /etc/ld.so.conf using a post-build
> script. But, that file seems to be ignored at boot time (and there is
> no "ldconfig" to run even if I wanted to).
>
> I suppose I could set LD_LIBRARY_PATH globally, but for performance
> reasons, I'd prefer that the new path went into /etc/ld.so.cache. [I'm
> not sure how one sets a global environment variable anyway.]
>
> There have been several threads about this in the past, but none of
> them seemed to offer any answers...

$ grep -A8 config\ LDSO_CACHE extra/Configs/Config.in
config LDSO_CACHE_SUPPORT
	bool "Enable library loader cache (ld.so.conf)"
	depends on HAVE_SHARED
	default y
	help
	  Enable this to make use of /etc/ld.so.conf, the shared library loader
	  cache configuration file to support for non-standard library paths.
	  After updating this file, it is necessary to run 'ldconfig' to update
	  the /etc/ld.so.cache shared library loader cache file.
$ make help | grep util
  utils			- build target utilities
  hostutils		- build host utilities (see utils)
  install_utils		- install target utilities
  install_hostutils	- install host utilities

Generally speaking, you can globally export variables for sh in e.g.
/etc/profile

HTH,

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

* [Buildroot] How do you add to library path?
  2012-04-26 17:42 [Buildroot] How do you add to library path? Grant Edwards
  2012-04-26 20:12 ` Bernhard Reutner-Fischer
@ 2012-04-27 22:18 ` Arnout Vandecappelle
  2012-04-28 10:44   ` Michael S. Zick
  2012-04-28 14:53   ` Grant Edwards
  1 sibling, 2 replies; 7+ messages in thread
From: Arnout Vandecappelle @ 2012-04-27 22:18 UTC (permalink / raw)
  To: buildroot

On Thursday 26 April 2012 19:42:01 Grant Edwards wrote:
> What's the right way to permanently add a directory to the search path
> for dynamic libraries?  (Preferably at build-time, rather than at
> run-time.)

 You could use the -rpath linker option, but that risks conflicts with
libraries installed on the host (the linker puts rpath in front of the
library search path, disregarding the sysroot, so if a library with the
same name exists in that path on the host, the linker will link with that
one instead of the cross-compiled one).

 Regards,
 Arnout

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
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:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

* [Buildroot] How do you add to library path?
  2012-04-27 22:18 ` Arnout Vandecappelle
@ 2012-04-28 10:44   ` Michael S. Zick
  2012-04-28 11:15     ` Bernhard Reutner-Fischer
  2012-04-28 14:53   ` Grant Edwards
  1 sibling, 1 reply; 7+ messages in thread
From: Michael S. Zick @ 2012-04-28 10:44 UTC (permalink / raw)
  To: buildroot

On Fri April 27 2012, Arnout Vandecappelle wrote:
> On Thursday 26 April 2012 19:42:01 Grant Edwards wrote:
> > What's the right way to permanently add a directory to the search path
> > for dynamic libraries?  (Preferably at build-time, rather than at
> > run-time.)
> 
>  You could use the -rpath linker option, but that risks conflicts with
> libraries installed on the host (the linker puts rpath in front of the
> library search path, disregarding the sysroot, so if a library with the
> same name exists in that path on the host, the linker will link with that
> one instead of the cross-compiled one).
>

At a guess (untried by myself), it might be possible to use objcopy to
add/change the rpath information __after__ the build is otherwise complete.

I.E: For the case where the rpath information added is for the target's use,
rather than the build host's use.

I do not know for certain if objcopy can access or change the rpath 
information field in an object, I have never seen or read about it being done.

Mike

>  Regards,
>  Arnout
> 

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

* [Buildroot] How do you add to library path?
  2012-04-28 10:44   ` Michael S. Zick
@ 2012-04-28 11:15     ` Bernhard Reutner-Fischer
  2012-04-28 14:13       ` Arnout Vandecappelle
  0 siblings, 1 reply; 7+ messages in thread
From: Bernhard Reutner-Fischer @ 2012-04-28 11:15 UTC (permalink / raw)
  To: buildroot

Hi,

There is chpath (sp?) to change the rpath later on.
This is something completely different to turning on ld.so.cache support,
though.

HTH,

On 28 Apr 2012 12:44, "Michael S. Zick" <minimod@morethan.org> wrote:

On Fri April 27 2012, Arnout Vandecappelle wrote:
> On Thursday 26 April 2012 19:42:01 Grant Edwards...
At a guess (untried by myself), it might be possible to use objcopy to
add/change the rpath information __after__ the build is otherwise complete.

I.E: For the case where the rpath information added is for the target's use,
rather than the build host's use.

I do not know for certain if objcopy can access or change the rpath
information field in an object, I have never seen or read about it being
done.

Mike

>  Regards,
>  Arnout

>


_______________________________________________
buildroot mailing list
buildroot at busybox.net
ht...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120428/67fca940/attachment.html>

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

* [Buildroot] How do you add to library path?
  2012-04-28 11:15     ` Bernhard Reutner-Fischer
@ 2012-04-28 14:13       ` Arnout Vandecappelle
  0 siblings, 0 replies; 7+ messages in thread
From: Arnout Vandecappelle @ 2012-04-28 14:13 UTC (permalink / raw)
  To: buildroot

On Saturday 28 April 2012 13:15:05 Bernhard Reutner-Fischer wrote:
> There is chpath (sp?) to change the rpath later on.

 Nice one!  It's called chrpath and is part of Debian [1] and Ubuntu.  The upstream seems to have vanished.

 There's also patchelf [2] which has a git repository.

 As to objcopy: I didn't find anything in the man page...

 Regards,
 Arnout

[1] http://packages.debian.org/source/sid/chrpath
[2] http://nixos.org/patchelf.html
-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
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:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

* [Buildroot] How do you add to library path?
  2012-04-27 22:18 ` Arnout Vandecappelle
  2012-04-28 10:44   ` Michael S. Zick
@ 2012-04-28 14:53   ` Grant Edwards
  1 sibling, 0 replies; 7+ messages in thread
From: Grant Edwards @ 2012-04-28 14:53 UTC (permalink / raw)
  To: buildroot

On 2012-04-27, Arnout Vandecappelle <arnout@mind.be> wrote:
> On Thursday 26 April 2012 19:42:01 Grant Edwards wrote:
>> What's the right way to permanently add a directory to the search path
>> for dynamic libraries?  (Preferably at build-time, rather than at
>> run-time.)
>
>  You could use the -rpath linker option, but that risks conflicts with
> libraries installed on the host (the linker puts rpath in front of the
> library search path, disregarding the sysroot, so if a library with the
> same name exists in that path on the host, the linker will link with that
> one instead of the cross-compiled one).

Thanks, that's an interesting option.  For now I've set
LD_LIBRARY_PATH. That seems sub-optimal, since the libraries are
always going to be in a location that's known at build-time.  I'll
take a look at the rpath option (and the other related methods).

-- 
Grant

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

end of thread, other threads:[~2012-04-28 14:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-26 17:42 [Buildroot] How do you add to library path? Grant Edwards
2012-04-26 20:12 ` Bernhard Reutner-Fischer
2012-04-27 22:18 ` Arnout Vandecappelle
2012-04-28 10:44   ` Michael S. Zick
2012-04-28 11:15     ` Bernhard Reutner-Fischer
2012-04-28 14:13       ` Arnout Vandecappelle
2012-04-28 14:53   ` Grant Edwards

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.