LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to force preferred library search path for Apache (https://www.linuxquestions.org/questions/linux-server-73/how-to-force-preferred-library-search-path-for-apache-623690/)

Larry James 02-25-2008 08:32 AM

How to force preferred library search path for Apache
 
Can someone tell me how to force a default path of "/usr/local/" to a new Apache installation.

I just install everything new and keep getting the error message:

libtool: link: cannot find the library `/usr/lib/libgdbm.la'

All Perl and all the libraries and packages have been installed to /usr/local. The libgdbm.la file is in /usr/local/lib.

The system is a brand new hard drive with a new installation of Fedora Core 8. I prefer not to bother with /usr/lib for my custom installations because I don't want to interfere with the already configuration of things such as sendmail and all the other distro defaults.

I have installed the following packages and set them all to point to /usr/local:

perl-5.8.8.tar.gz: /usr/local
httpd-2.2.8.tar.bz2: /usr/local
libtool-1.5.26.tar.gz: /usr/local
gdbm-1.8.3.tar.gz: /usr/local

I set the following link library flag:

export LDFLAGS="-L/usr/local/lib"

I cleaned and attempted to compile apache as such:

make distclean
./configure --libdir=/usr/local/lib
make

The configure completes without errors. The "make" errors with:

libtool: link: cannot find the library `/usr/lib/libgdbm.la'

Is there something else that I can do to force apache to forget /usr/lib and use /usr/local/lib instead?

Thanks in advance for anyone with advice. Is there something hard coded about apache that makes it totally depended on looking at /usr/lib?

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames

forrestt 02-25-2008 10:14 AM

You may need to set LD_RUN_PATH to /usr/local/lib when you are building Apache. You can also set LD_LIBRARY_PATH after you have built something if the libraries are not in the place it is looking for them to point to a new location. For more info read:

http://osr507doc.sco.com/en/tools/cc...dirsearch.html

HTH

Forrest

unSpawn 02-25-2008 10:21 AM

Since he'll be using /usr/local anyway, wouldn't it be easier to just add the path to /etc/ld.so.conf?


Larry James, since you use Fedora (the "Core" part was dropped around 6 IIRC), why not install Apache as RPM? And if you need a custom Apache package maybe first look at compatible repo's? You could also build a package by tweaking the .spec file from the previous httpd-2.2.*.src.rpm. Finally you can install packages in a different path and still have RPMDB take care of things using the "--relocate" switch.

forrestt 02-25-2008 10:38 AM

Quote:

Originally Posted by unSpawn (Post 3069183)
Since he'll be using /usr/local anyway, wouldn't it be easier to just add the path to /etc/ld.so.conf?

I was assuming that he didn't want other things looking at that lib directory for libraries, only the things he was playing with. If you add a file to /etc/ld.so.conf.d pointing at that path, won't it make everything look at that path for libraries?

Forrest

unSpawn 02-25-2008 12:15 PM

Sure but it's not like adding it will fsck things up, only in rare occasions like if you have multiple versions of libraries installed.

endfx 02-25-2008 12:30 PM

If you choose to add /usr/local/lib to /etc/ld.so.conf you should also run ldconfig as well.

Larry James 02-25-2008 09:42 PM

Thanks to everybody for your input. I had already done many of the suggestions. I meant to mention each one of them, but it seems that I left some off. I’ve since studied the suggested links and other suggestions and will present the results.

Quote:

Originally Posted by forrestt (Post 3069173)
You may need to set LD_RUN_PATH to /usr/local/lib when you are building Apache. You can also set LD_LIBRARY_PATH after you have built something if the libraries are not in the place it is looking for them to point to a new location. For more info read:

http://osr507doc.sco.com/en/tools/cc...dirsearch.html

Thanks, Forrest, I did both and studied the URL in detail. I’m still getting the same when I run the “make”.

Quote:

Originally Posted by unSpawn (Post 3069183)
Since he'll be using /usr/local anyway, wouldn't it be easier to just add the path to /etc/ld.so.conf?

Thanks, unSpawn. I forgot to mention that I have the following in my /etc/ld.so.conf file. I also had run ldconfig with many different parameters.

----------------------------
include ld.so.conf.d/*.conf
/usr/local/lib

Quote:

Larry James, since you use Fedora (the "Core" part was dropped around 6 IIRC), why not install Apache as RPM? And if you need a custom Apache package maybe first look at compatible repo's? You could also build a package by tweaking the .spec file from the previous httpd-2.2.*.src.rpm. Finally you can install packages in a different path and still have RPMDB take care of things using the "--relocate" switch.
Apache is already installed on the new Fedora 8 machine. I have a server that has been running since 1993 (starting out with SCO Unix and upgraded numerous time, through Slackware, Red Had, with the last time being Fedora 6 about 4 years ago). My hard drive is dying on the machine. I’m building a fresh machine and would prefer to work with the tar ball as I always have in the past. It it’s resolved that it’s no longer possible, this is something I’ll learn. But if it is, I hope to be able to do it.

I have many custom utilities that I have build on my old machine, and I have always had full control. Maybe I could do the same with the RPM shipped with Fedora. But I would consider it a benefit overall if I could take the packages, configure, compile and build them myself. I feel it would help in the long run when I have to troubleshoot.

Even though I’ve been working with this dilemma, I somehow think it’s something simple that I’m missing. At present it seems like a lot of us are missing what it is that Apache is doing, because as I mentioned, I have done most of the things suggested. I’ve done a lot of reading in the process of trying to figure out the problem.

Again, though I mention I have a number of custom packages I wish to install, at present I haven’t installed anything. I’ve only tried to compile the distribution httpd-2.2.8 tarball the way it’s distributed by pointing the compiler to use the library from a preferred path, /usr/local/lib. They are failing right out of the box.


Quote:

Originally Posted by forrestt (Post 3069208)
I was assuming that he didn't want other things looking at that lib directory for libraries, only the things he was playing with. If you add a file to /etc/ld.so.conf.d pointing at that path, won't it make everything look at that path for libraries?

Thanks again, Forrest. I don’t mind other things seeing the packages I install. I just hoped not to contaminate the default /usr/lib with my custom applications.

The last few lines of the “make” compile:
---------------------------------------
make[3]: Leaving directory `/jah1/exdrive/jer1/jer1/install/apache/httpd-2.2.8/modules/mappers'
make[2]: Leaving directory `/jah1/exdrive/jer1/jer1/install/apache/httpd-2.2.8/modules/mappers'
make[1]: Leaving directory `/jah1/exdrive/jer1/jer1/install/apache/httpd-2.2.8/modules'
Making all in support
make[1]: Entering directory `/jah1/exdrive/jer1/jer1/install/apache/httpd-2.2.8/support'
make[2]: Entering directory `/jah1/exdrive/jer1/jer1/install/apache/httpd-2.2.8/support'
/usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I/install/apache/httpd-2.2.8/srclib/pcre -I. -I/install/apache/httpd-2.2.8/os/unix -I/install/apache/httpd-2.2.8/server/mpm/prefork -I/install/apache/httpd-2.2.8/modules/http -I/install/apache/httpd-2.2.8/modules/filters -I/install/apache/httpd-2.2.8/modules/proxy -I/install/apache/httpd-2.2.8/include -I/install/apache/httpd-2.2.8/modules/generators -I/install/apache/httpd-2.2.8/modules/mappers -I/install/apache/httpd-2.2.8/modules/database -I/usr/local/apr/include/apr-1 -I/install/apache/httpd-2.2.8/modules/proxy/../generators -I/install/apache/httpd-2.2.8/modules/ssl -I/install/apache/httpd-2.2.8/modules/dav/main -prefer-non-pic -static -c htpasswd.c && touch htpasswd.lo
/usr/local/apr/build-1/libtool --silent --mode=link gcc -g -O2 -pthread -L/usr/local/lib -o htpasswd htpasswd.lo -lm /install/apache/httpd-2.2.8/srclib/pcre/libpcre.la /usr/local/apr/lib/libaprutil-1.la -lgdbm -ldb-4.2 -lexpat /usr/local/apr/lib/libapr-1.la -luuid -lrt -lcrypt -lpthread -ldl
libtool: link: cannot find the library `/usr/lib/libgdbm.la'
make[2]: *** [htpasswd] Error 1
make[2]: Leaving directory `/jah1/exdrive/jer1/jer1/install/apache/httpd-2.2.8/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/jah1/exdrive/jer1/jer1/install/apache/httpd-2.2.8/support'
make: *** [all-recursive] Error 1
----------------------------------------------------

I have every suggestion mention so far in this thread set.

The /etc/ld.so.conf file:
/usr/local/lib

The environment variables:
export LD_LIBRARY_PATH=/usr/local/lib
export LD_RUN_PATH=/usr/local/lib
export LDFLAGS="-L/usr/local/lib”

The libgdbm.la exists in the /usr/local/lib directory. I tested a symbolic link in the /usr/lib file to that file and the compile succeeds. I’m going to immediately attempt to continue building the new system with the links. I have many applications that I will be bringing over from the old system. If it were possible to work out why specifying a directory path fails it might solve other issues that I haven’t experienced yet.

I have two Apache directories that I’m testing in an attempt to solve this problem. There’s the /usr/local/apache that I’m using in this immediately workaround (linking the libraries one by one) and /usr/local/apache2 (which is a virgin tarball that I’m trying to accomplishing having it success in compiling with the specified link.

I appreciate all the quick input and suggestions. It’s been a long time since I asked questions on LQ. The way the responses always come in is and always has been phenomenon. Thank you again to everyone for your input.

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames

Larry James 03-04-2008 02:15 PM

I would like to thank everyone visiting this thread and pondering the problem. It turns out it was an SELinux issue. All the set paths are now recognized and configurable.

-- L. James

--
L. D. James
ljames@apollo3.com
www.apollo3.com/~ljames


All times are GMT -5. The time now is 08:25 AM.