Subject: Re: pkgsrc/Solaris: LD_LIBRARY_PATH
To: None <pkgsrc-users@NetBSD.org>
From: Mehul N. Sanghvi <mehul.sanghvi@gmail.com>
List: pkgsrc-users
Date: 08/03/2007 22:59:15
Tobias Nygren said the following on 8/3/2007 9:11 PM:
> On Fri, 03 Aug 2007 19:29:26 -0400
> "Mehul N. Sanghvi" <mehul.sanghvi@gmail.com> wrote:
> 
>> 'allo,
>>
>>       Every time I build something in pkgsrc, I get a linking error for 
>> libiconv.  I usually end up doing an explicit export of LD_LIBRARY_PATH and 
>> including /usr/pkg/lib in it.  Is there some variable I can set in my mk.conf 
>> file that will ensure that I don't have to remember to do this each time ?
>>
> 
> pkgsrc is supposed to encode the runpath into the binaries and if that
> doesn't happen it is a bug. What version of Solaris are you on, what
> architecture, what compiler and which ld(1) is the compiler using?
> If you changed any of those you probably need to rebuild the
> libtool-base package.
> 

I am using Solaris 9/SPARC platform.  The compiler is gcc from 
/usr/pkg/gcc3/bin and ld(1) is the standard Solaris ld(1) from /usr/ccs/bin. 
Doing a simple thing like '/usr/pkg/gcc3/bin/gcc -v' will give me the following:

% type gcc
gcc is hashed (/usr/pkg/gcc3/bin/gcc)

% gcc -v
ld.so.1: gcc: fatal: libiconv.so.2: open failed: No such file or directory
Killed

% ldd /usr/pkg/gcc3/bin/gcc
       libiconv.so.2 =>         (file not found)
       libc.so.1 =>     /usr/lib/libc.so.1
       libdl.so.1 =>    /usr/lib/libdl.so.1
       /usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1


I have a gcc compiler in /usr/local/bin which seems to work fine though:

% /usr/local/bin/gcc -v
Reading specs from /usr/local/lib/gcc/sparc-sun-solaris2.8/3.4.1/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as 
--with-ld=/usr/ccs/bin/ld --disable-nls --disable-libgcj --enable-languages=c,c++
Thread model: posix
gcc version 3.4.1

% ldd /usr/local/bin/gcc
         libiconv.so.2 =>         /usr/local/lib/libiconv.so.2
         libc.so.1 =>     /usr/lib/libc.so.1
         libdl.so.1 =>    /usr/lib/libdl.so.1
         /usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1


Now if I provide the LD_LIBRARY_PATH here is what happens:

% export LD_LIBRARY_PATH=/usr/pkg/lib:/usr/lib:/usr/ccs/lib

% type gcc
gcc is hashed (/usr/pkg/gcc3/bin/gcc)

% gcc -v
Reading specs from /usr/pkg/gcc3/lib/gcc-lib/sparc-sun-solaris2/3.3.6/specs
Configured with: ./configure --prefix=/usr/pkg/gcc3 --host=sparc-sun-solaris2 
--enable-shared --enable-languages=c
Thread model: posix
gcc version 3.3.6

> Does the linker error happen in the libiconv package or in some
> package that depends on it?
> 

This happens in packages that depend on libiconv.  As far as I can tell, 
libiconv is the only library that this seems to be happening with.

cheers,

     mehul

-- 
Mehul N. Sanghvi
email: mehul.sanghvi@gmail.com