perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [PATCH] Dynamic linking on Cygwin
Date Wed, 27 Apr 2005 14:43:22 GMT
Nick *** wrote:
> Note that this patch doesn't fix the dynamic linking entirely, but does 75% of the job.
> The problem with cygwin is that it behaves like windows (it's a posix layer over windows
after all). 
> That's why we need to supply all symbols during linking time just like on win32, by adding
-lapr-0 -laprutil-0 and -lhttpd. On windows, Apache supplies all the three libraries and it's
easy to link, but on cygwin apache doesn't play nice and doesn't supply libhttpd.
> My patch adds libapr and libaprutil. Also, I have a workaround for libhttpd, but currently
I'm thinking on how to implement it.

Thanks Nick. But please test for me the patch below. I've just changed the 
way you've generated the flags to make the dealing with space separators 
less painful for the eyes and replaced the hardcoded -lmod_perl with
"-l$self->{MP_LIBNAME}". Though I can't test it.

Index: Changes
===================================================================
--- Changes     (revision 164866)
+++ Changes     (working copy)
@@ -12,6 +12,15 @@

  =item 1.999_23-dev

+improving DSO support on cygwin. The problem with cygwin is that it
+behaves like windows (it's a posix layer over windows after
+all). That's why we need to supply all symbols during linking time
+just like on win32, by adding -lapr-0 -laprutil-0 and -lhttpd. On
+windows, Apache supplies all the three libraries and it's easy to
+link, but on cygwin apache doesn't play nice and doesn't supply
+libhttpd.  Nick's patch adds libapr and libaprutil. [Nick ***
+<doink123@abv.bg>]
+
  improve the diagnostics when detecting mp2 < 1.999022, tell the user
  which files and/or dirs need to be removed [Stas]

Index: lib/Apache2/Build.pm
===================================================================
--- lib/Apache2/Build.pm        (revision 164832)
+++ lib/Apache2/Build.pm        (working copy)
@@ -464,6 +464,10 @@
          $ldopts .= $self->gtop_ldopts;
      }

+    if (CYGWIN && $self->is_dynamic) {
+        $ldopts .= join ' ', '', $self->apru_link_flags;
+    }
+
      $config->{ldflags} = $ldflags; #reset

      # on Irix mod_perl.so needs to see the libperl.so symbols, which
@@ -1050,7 +1054,9 @@

      return @apru_link_flags if @apru_link_flags;

-    for ($self->apr_config_path, $self->apu_config_path) {
+    # first use apu_config_path and then apr_config_path in order to
+    # resolve the symbols right during linking
+    for ($self->apu_config_path, $self->apr_config_path) {
          if (my $link = $_ && -x $_ && qx{$_ --link-ld --libs}) {
              chomp $link;
              if ($self->httpd_is_source_tree) {
@@ -1801,6 +1807,20 @@
      $flags;
  }

+sub otherldflags_cygwin {
+    my $self = shift;
+    my $flags = $self->otherldflags_default;
+
+    unless ($self->{MP_STATIC_EXTS}) {
+        $flags .= join " ", '',
+            $self->apru_link_flags,
+            '-L' . $self->file_path('src/modules/perl'),
+            "-l$self->{MP_LIBNAME}";
+    }
+
+    $flags;
+}
+
  sub typemaps {
      my $self = shift;
      my @typemaps = ();


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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message