Brad Lanam wrote:
On Fri, Jan 02, 2004 at 12:53:18PM -0800, Stas Bekman wrote:

Before we try to fix EU::MakeMaker, how about this workaround patch?


Your patch works.

www:sadm$ ldd `find . -name 'APR.so'`
    libapr-0.so.0 =>         /export/apache2_dev/lib/libapr-0.so.0
    [...]
    libaprutil-0.so.0 =>     /export/apache2_dev/lib/libaprutil-0.so.0
    libexpat.so.0 =>         /usr/local/lib/libexpat.so.0
    [...]

    I'm picking up my expat library rather than Apache's.
    This could be a potential problem for some people.

    This happens because LDDLFLAGS is in the command line
    before LIBS, and -R/usr/local/lib is first in the run
    time search path.

    Now that I know what the problems are and what's causing
    them, I can work around the various issues.

    I think in the long term, to handle multiple Apache installations
    on the same machine, you will need to address the issue
    of which set of Apache libraries mod_perl uses.  Ideally, it
    should use the same libraries the apache daemon is using, so
    you'll either have to set the LD_LIBRARY_PATH/LD_RUN_PATH
    environment variable at startup, or dynamically load them
    like perl does.

How about the following trickery. It arranges that LDDFLAGS will come after LIBS, making sure that apache's -Rpath will come in first. This is untested.


Index: xs/APR/APR/Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/APR/APR/Makefile.PL,v
retrieving revision 1.18
diff -u -r1.18 Makefile.PL
--- xs/APR/APR/Makefile.PL      5 Nov 2003 08:29:17 -0000       1.18
+++ xs/APR/APR/Makefile.PL      2 Jan 2004 22:08:07 -0000
@@ -6,10 +6,18 @@
 use Apache::Build ();
 use Config;

-use constant WIN32 => Apache::Build::WIN32;
+use constant WIN32   => Apache::Build::WIN32;
+use constant SOLARIS => $^O eq 'solaris';
+
+my %args = (
+    'NAME'        => 'APR',
+    'VERSION_FROM' => 'APR.pm',
+);

 my $libs = '';
-if (my $apr_bindir = ModPerl::BuildMM::build_config()->apr_bindir()) {
+my $build = ModPerl::BuildMM::build_config();
+
+if (my $apr_bindir = $build->apr_bindir()) {

     # XXX: this works only with libapr 0.9.2+
     my $ext = WIN32 ? '.bat' : '';
@@ -24,8 +32,16 @@
     $libs =~ s{(\w+)\.lib}{-l$1}g;
 }

-ModPerl::BuildMM::WriteMakefile(
-    'NAME'        => 'APR',
-    'VERSION_FROM' => 'APR.pm',
-    'LIBS'         => [$libs],
-);
+if (SOLARIS && $libs) {
+    # -R makes sure that these paths will be used
+    $libs =~ s{-L(\S+)}{-L$1 -R$1}g;
+    # make sure that perl lddflags will come after libs from apache,
+    # so that -R paths from apache will come in first
+    my $lddflags = $build->perl_config('lddlflags');
+    $libs .= " $lddflags";
+    $args{LDDLFLAGS} = ''; # so that MM won't re-add LDDFLAGS
+}
+
+$args{LIBS} = [$libs] if $libs;
+
+ModPerl::BuildMM::WriteMakefile(%args);


__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to