Subject: Re: LD_LIBRARY_PATH and apache
To: Sam Carleton <sam@linux-info.net>
From: Miguel Mendez <flynn@energyhq.homeip.net>
List: netbsd-help
Date: 12/25/2002 15:33:32
On Wed, 25 Dec 2002 09:26:03 -0500
Sam Carleton <sam@linux-info.net> wrote:

Hi and Merry Xmas to all btw :)

> Folks,
> 
> First off, I can never remeber the name of the enviornement
> variable, if memory serves, it is LD_LIBRARY_PATH.  Well, all
> the same...  I have writen a CGI program for apache.  I am
> using some libraries in /usr/pkg/lib.  When apache tries to
> run the CGI program, it isn't able to find the libraries.
> What is the best way to tell Apache to search /usr/pkg/lib.

I coded a simple counter some time ago that uses libpng, this is the
Makefile I used:

---------
# $Id: Makefile,v 1.3 2001/07/28 02:37:50 flynn Exp $

OBJECTS= gethits.o nrg_counter.o png_io.o
CFLAGS+= -I/usr/pkg/include

all:    $(OBJECTS)
        $(CC) -o nrg_counter $(OBJECTS) -L/usr/pkg/lib -Wl,-rpath -Wl,/usr/pkg/lib -lpng
                        
clean:
        rm -f $(OBJECTS) *.core
---------

Note the -Wl options that instruct the linker to hardcode the library
location, that way you don't need to set LD_LIBRARY_PATH, it just works (tm) 

Cheers,
-- 
        Miguel Mendez - flynn@energyhq.homeip.net
        GPG Public Key :: http://energyhq.homeip.net/files/pubkey.txt
        EnergyHQ :: http://www.energyhq.tk
        Of course it runs NetBSD!