From dev-return-5354-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Tue Jan 08 00:39:01 2002 Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 27457 invoked by uid 500); 8 Jan 2002 00:39:00 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 27445 invoked from network); 8 Jan 2002 00:39:00 -0000 Message-ID: From: "MATHIHALLI,MADHUSUDAN (HP-Cupertino,ex1)" To: "'dev@httpd.apache.org'" Cc: dev@apr.apache.org Subject: RE: Run-time linking paths via LDFLAGS on Linux with gcc. Date: Mon, 7 Jan 2002 16:38:59 -0800 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N This is a very good point.. (+1 for the idea if it counts). We face a similar problem here on HPUX also.. Our requirement is slightly different.. For ex. during my build, i pickup the system libraries from /usr/madhum/lib/system.. In the end-user environment, the system libraries are loaded in /usr/lib.. There's a easy method of telling the binary to pickup the system libraries from /usr/lib at the link time by passing certain flags to the linker.. We run into a similar problem that Justin is facing, and we get-around the problem in a ugly manner by hacking the generated scripts/makefiles to introduce these flags during the linking phase :-(.. I'd also be interested in knowing if there's a better method to solve this. -Madhu -----Original Message----- From: Justin Erenkrantz [mailto:jerenkrantz@ebuilt.com] Sent: Sunday, January 06, 2002 10:41 PM To: dev@httpd.apache.org Cc: dev@apr.apache.org Subject: Run-time linking paths via LDFLAGS on Linux with gcc. gcc on Linux is brain-dead w.r.t. run-time link paths. In order to add any run-time search dir, you must specify "-Wl,-rpath " to add a dir via gcc. However, libtool only recognizes "-R" or "-rpath" as the link path options. So, these two options are completely incompatible. (FWIW, gcc on Solaris recognizes -R natively, so it isn't a problem there - -R works for both gcc and libtool - probably why I've skirted the issue for so long.) I usually add the Berkeley DB libraries so APR-util finds it (SVN requires that apr-util links against db-4.0.14 which is different than what is in my /usr/lib): CPPFLAGS="-I/pkg/db-4.0.14/include" \ LDFLAGS="-L/pkg/db-4.0.14/lib -Wl,-rpath /pkg/db-4.0.14/lib" \ ./configure ...... If we specify "-Wl,-rpath", we fail at link-time when building the binaries, since libtool does not understand -Wl,-rpath. However, if you specify "-R" instead of -Wl,-rpath, we will fail at configure-time in httpd since configure will try to link with LDFLAGS and gcc will say that "-R" is unrecognized. This is a complete Catch-22. The question is what to do about it. I have some ideas, but I'd like to hear what other people think. I won't prejudice you all with my proposed solutions because I think they are all a bit unelegant. (I'm also curious if we end up with what I already have.) It looks technically feasible, but my solutions turn into a complete mess. Hint: we can't just handle this in httpd as we must build all of the subprojects (apr, apr-util, pcre) with the proper conversion. It just sucks. But, my builds are completely broken on Linux with -rpath LDFLAGS. So, we need some sort of solution. (IMHO, ldconfig isn't a solution since it requires root access.) -- justin