Subject: Re: NetBSD packages and LD_LIBRARY_PATH
To: Joerg Sonnenberger <>
From: Hauke Fath <>
List: tech-pkg
Date: 10/26/2005 16:27:01
Am 26.10.2005 um 10:32 Uhr +0200 schrieb Joerg Sonnenberger:
>  > >> >> !echo $LD_LIBRARY_PATH
>  > >>/opt/matlabr14/sys/os/glnx86:/opt/matlabr14/bin/glnx86:/opt/matlabr14/extern/lib/glnx86:/opt/matlabr14/sys/java/jre/glnx86/jre1.5.0/lib/i386/native_threads:/opt/matlabr14/sys/java/jre/glnx86/jre1.5.0/lib/i386/client:/opt/matlabr14/sys/java/jre/glnx86/jre1.5.0/lib/i386
>>  >> >>
>>  >
>>  >That's the reason why I normally install the programs completely under
>>  >/usr/pkg/emul :-)

Doesn't make a difference here, see below.

>  > That's a WA^Weducated guess, since I haven't actually done a
>>  re-install of Matlab to /usr/pkg/emul/linux/opt, but -- wouldn't the
>>  paths in LD_LIBRARY_PATH show up just the same since a linux binary
>>  sets them up against the emulation root?

I guessed wrongly: The paths are valid 'native NetBSD' paths in both 
cases. The matlab binary is called by a 60 KB shell wrapper that sets 
up paths and things, and calls other tools - all native. Invoking it 
with the Linux /bin/sh doesn't make a difference, though.

>It means that LD_LIBRARY_PATH would point into nowhere for non-Linux
>binaries, so it would be effectively ignored.

No, see above: In both cases, the LD_LIBRARY_PATH that a NetBSD 
binary sees points to existing shared libraries. Some applications 
apparently cannot resist to pick them up.

>  > >Have you looked at using chrpath to eliminiate the need for the
>>  >LD_LIBRARY_PATH in Matlab?
>  > Would that keep it from handing the LD_LIBRARY_PATH (which is set up
>>  in the matlab startup script) over to a spawned shell?
>If you change the matlab binary/ies to have embedded RPATH entries, you
>wouldn't need to set LD_LIBRARY_PATH at all.

I don't feel like messing with Matlab's guts (partly scripted native 
base OS tools, partly Linux binaries) because of that, thank you.  ;)

If there is no global switch for disabling LD_LIBRARY_PATH, a wrapper 
script is it.


/~\  The ASCII Ribbon Campaign                    Hauke Fath
\ /    No HTML/RTF in email	        Institut für Nachrichtentechnik
  X     No Word docs in email	                  TU Darmstadt
/ \  Respect for open standards              Ruf +49-6151-16-3281