Subject: Re: libraries problem
To: Rakhesh Sasidharan <rakhesh@cse.iitd.ernet.in>
From: Erik Huizing <huizing@cpsc.ucalgary.ca>
List: netbsd-users
Date: 03/14/2001 10:20:19
I think the correct way is to specify -L/usr/pkg/lib
To get /usr/pkg/include in the include path, add -I/usr/pkg/include to
the compile line.
Some packages, like pthreads will actually require
-I/usr/pkg/pthreads/include
LD_LIBRARY_PATH is used when the program is acutally run, so the OS knows
where to go looking for libraries if if doesn't find them in the standard
places.
Hope that helps.
The first rule of Fight Club is: You Do Not Talk About Fight Club.
// Erik Huizing huizing@cpsc.ucalgary.ca
// www.cpsc.ucalgary.ca/~huizing
On Wed, 14 Mar 2001, Rakhesh Sasidharan wrote:
>
> Hi,
>
> If I have libraries installed in /usr/pkg/lib, how do I ensure that
> programs find them while compiling ?
>
> I know that LD_LIBRARY_PATH should do the trick, but it doesn't quite work
> for me. For example, I do:
>
> [root@NetBSD](cucipop-1.31)# export LD_LIBRARY_PATH=/usr/pkg/lib/
> [root@NetBSD](cucipop-1.31)# ls -al /usr/pkg/lib/libdb2*
> -rw-r--r-- 1 root wheel 372542 Dec 24 05:51 /usr/pkg/lib/libdb2.a
> -r--r--r-- 1 root wheel 642 Dec 24 05:51 /usr/pkg/lib/libdb2.la
> lrwxr-xr-x 1 root wheel 13 Dec 24 05:51 /usr/pkg/lib/libdb2.so -> libdb2.so.2.7
> lrwxr-xr-x 1 root wheel 13 Dec 24 05:51 /usr/pkg/lib/libdb2.so.2 -> libdb2.so.2.7
> -r--r--r-- 1 root wheel 285728 Dec 24 05:51 /usr/pkg/lib/libdb2.so.2.7
>
> And then:
>
> [root@NetBSD](cucipop-1.31)# gmake install
> cc -O -DUSE_DB cucipop.o authenticate.o atotime.o locking.o xcreat.o dbops.o hsort.o simplecrypt.o md5/md5c.o -o cucipop -lcrypt -ldb2
> /usr/bin/ld: cannot open -ldb2: No such file or directory
> collect2: ld returned 1 exit status
> gmake: *** [cucipop] Error 1
>
> The error went of when I linked the above libd2 libraries to /usr/lib (OR
> used the -L/usr/pkg/lib to cc), but what is The Right Way (TM) to do it
> :) ?
>
> Similarly, if I have include files lying in /usr/pkg/include, how do I get
> programs to use that ?
>
>
> Regards.
> __
> Rakhesh Sasidharan rakhesh at cse.iitd.ac.in
>
>