Skip Menu |

This queue is for tickets about the Crypt-SSLeay CPAN distribution.

Report information
The Basics
Id: 28431
Status: resolved
Priority: 3/
Queue: Crypt-SSLeay

People
Owner: nanis [...] runu.moc.invalid
Requestors: info [...] gknw.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Crypt-SSLeay-0.56 build issues on Win32 platform
Date: Mon, 23 Jul 2007 14:20:49 +0200
To: bug-Crypt-SSLeay [...] rt.cpan.org
From: Guenter Knauf <info [...] gknw.de>
Hi David, I did some more hacking around, and fixed some build whoes on Win32 when build with MSVC / ActivePerl: - added option to specify static linking (since its often a mess to depend on external DLLs) - added support for relative paths to OpenSSL directory - moved "$dir/inc32/openssl/opensslv.h" to top place to avoid wrong detection of "$dir/crypto/opensslv.h" because this file is at least in OpenSSL 0.9.8e always present. here's my unified diff against Makefile.PL from Crypt-SSLeay-0.56 (also attached): --- Makefile.PL.orig Mon Jul 23 13:03:21 2007 +++ Makefile.PL Mon Jul 23 14:02:54 2007 @@ -9,11 +9,12 @@ eval "use ExtUtils::MakeMaker::Coverage"; $@ or print "Adding testcover target\n"; -use vars qw($opt_default $opt_libpath); +use vars qw($opt_default $opt_libpath $opt_static); GetOptions( "default", \$opt_default, "lib=s", \$opt_libpath, + "static", \$opt_static, ); $opt_default ||= $ENV{CRYPT_SSLEAY_DEFAULT}; @@ -139,12 +140,12 @@ # external tools probably expect \ and not / for path separators $SSL_DIR =~ tr{/}{\\}; - # default to drive C: - $SSL_DIR = "c:$SSL_DIR" if $SSL_DIR !~ /\A[a-z]:/i; + # default to drive C: if no relative path + $SSL_DIR = "c:$SSL_DIR" if ($SSL_DIR !~ /\A[a-z]:|^../i); my $inc = $pkg_config->{inc}; $inc =~ tr{/}{\\}; - $inc !~ /^[a-z]:/i and $inc = "c:$inc"; + $inc !~ /^[a-z]:|^../i and $inc = "c:$inc"; push @INC_FLAGS, "-I$inc"; push @INC_FLAGS, "-I$SSL_DIR\\inc32" if -d "$SSL_DIR/inc32"; @@ -157,10 +158,14 @@ elsif(-d "$SSL_DIR/lib") { push @LIB_FLAGS, "-L$SSL_DIR\\lib"; } - elsif(-d "$SSL_DIR/out32dll") { + elsif(-d "$SSL_DIR/out32dll" && !$opt_static) { # patch from Ben Laurie push @LIB_FLAGS, "-L$SSL_DIR\\out32dll"; } + elsif(-d "$SSL_DIR/out32" && $opt_static) { + # patch from Ben Laurie + push @LIB_FLAGS, "-L$SSL_DIR\\out32"; + } else { # Allow developers to point at OpenSSL source... push @LIB_FLAGS, "-L$SSL_DIR"; @@ -287,8 +292,8 @@ my $inc_dir; my $version_file; for ( - "$dir/crypto/opensslv.h", # cygwin32 builds "$dir/inc32/openssl/opensslv.h", # old win32 builds + "$dir/crypto/opensslv.h", # cygwin32 builds "$dir/include/openssl/opensslv.h", "$dir/include/opensslv.h", "$dir/include/crypto.h" thanks, Guenter.
--- Makefile.PL.orig Mon Jul 23 13:03:21 2007 +++ Makefile.PL Mon Jul 23 14:02:54 2007 @@ -9,11 +9,12 @@ eval "use ExtUtils::MakeMaker::Coverage"; $@ or print "Adding testcover target\n"; -use vars qw($opt_default $opt_libpath); +use vars qw($opt_default $opt_libpath $opt_static); GetOptions( "default", \$opt_default, "lib=s", \$opt_libpath, + "static", \$opt_static, ); $opt_default ||= $ENV{CRYPT_SSLEAY_DEFAULT}; @@ -139,12 +140,12 @@ # external tools probably expect \ and not / for path separators $SSL_DIR =~ tr{/}{\\}; - # default to drive C: - $SSL_DIR = "c:$SSL_DIR" if $SSL_DIR !~ /\A[a-z]:/i; + # default to drive C: if no relative path + $SSL_DIR = "c:$SSL_DIR" if ($SSL_DIR !~ /\A[a-z]:|^../i); my $inc = $pkg_config->{inc}; $inc =~ tr{/}{\\}; - $inc !~ /^[a-z]:/i and $inc = "c:$inc"; + $inc !~ /^[a-z]:|^../i and $inc = "c:$inc"; push @INC_FLAGS, "-I$inc"; push @INC_FLAGS, "-I$SSL_DIR\\inc32" if -d "$SSL_DIR/inc32"; @@ -157,10 +158,14 @@ elsif(-d "$SSL_DIR/lib") { push @LIB_FLAGS, "-L$SSL_DIR\\lib"; } - elsif(-d "$SSL_DIR/out32dll") { + elsif(-d "$SSL_DIR/out32dll" && !$opt_static) { # patch from Ben Laurie push @LIB_FLAGS, "-L$SSL_DIR\\out32dll"; } + elsif(-d "$SSL_DIR/out32" && $opt_static) { + # patch from Ben Laurie + push @LIB_FLAGS, "-L$SSL_DIR\\out32"; + } else { # Allow developers to point at OpenSSL source... push @LIB_FLAGS, "-L$SSL_DIR"; @@ -287,8 +292,8 @@ my $inc_dir; my $version_file; for ( - "$dir/crypto/opensslv.h", # cygwin32 builds "$dir/inc32/openssl/opensslv.h", # old win32 builds + "$dir/crypto/opensslv.h", # cygwin32 builds "$dir/include/openssl/opensslv.h", "$dir/include/opensslv.h", "$dir/include/crypto.h"
Subject: Re: [rt.cpan.org #28431] Crypt-SSLeay-0.56 build issues on Win32 platform
Date: Mon, 23 Jul 2007 14:28:34 +0200
To: bug-Crypt-SSLeay [...] rt.cpan.org
From: David Landgren <david [...] landgren.net>
Guenter Knauf via RT wrote: Show quoted text
> Mon Jul 23 08:20:32 2007: Request 28431 was acted upon. > Transaction: Ticket created by info@gknw.de > Queue: Crypt-SSLeay > Subject: Crypt-SSLeay-0.56 build issues on Win32 platform > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: info@gknw.de > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=28431 > > > > Hi David, > I did some more hacking around, and fixed some build whoes on Win32 when build with MSVC / ActivePerl: > - added option to specify static linking (since its often a mess to depend on external DLLs) > - added support for relative paths to OpenSSL directory > - moved "$dir/inc32/openssl/opensslv.h" to top place to avoid wrong detection of "$dir/crypto/opensslv.h" because this file is at least in OpenSSL 0.9.8e always present.
Wonderful! Thank-you for this excellent work. I shall roll this up into the distribution and push a new version out the door. David
Subject: Re: [rt.cpan.org #28431] Crypt-SSLeay-0.56 build issues on Win32 platform
Date: Mon, 23 Jul 2007 20:56:23 +0200
To: bug-Crypt-SSLeay [...] rt.cpan.org
From: Guenter Knauf <info [...] gknw.de>
Hi David, Show quoted text
> Wonderful! Thank-you for this excellent work. I shall roll this up into > the distribution and push a new version out the door.
I'm really sorry, but I failed to reply to this thread, and posted instead a new one! I realized that the second when I hit the send button - but that was of course too late.... Please take #28437 now as recent patch, and together with #28432 would be way cool to see that in a new release! thanks, Guen. best regards, Guenter Knauf Novell CNE, NetWare Developer Show quoted text
__________________________________________________________________ GK Netzwerktechnik http://www.gknw.de/
__________________________________________________________________
Subject: Re: [rt.cpan.org #28431] Crypt-SSLeay-0.56 build issues on Win32 platform
Date: Wed, 25 Jul 2007 08:14:02 +0200
To: bug-Crypt-SSLeay [...] rt.cpan.org
From: David Landgren <david [...] landgren.net>
Guenter Knauf via RT wrote: Show quoted text
> Queue: Crypt-SSLeay > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=28431 > > > Hi David,
>> Wonderful! Thank-you for this excellent work. I shall roll this up into >> the distribution and push a new version out the door.
> I'm really sorry, but I failed to reply to this thread, and posted instead a new one! > I realized that the second when I hit the send button - but that was of course too late.... > Please take #28437 now as recent patch, and together with #28432 would be way cool to see that in a new release!
Don't worry about the number of tickets created. I'll either merge them or just deal with them separately. Above all, your contribution is highly valued, doesn't matter how you post it! Thanks, David
Hello Guenter, I'm looking at your patch right now, and I'm a bit puzzled over the change you've made: $SSL_DIR !~ /\A[a-z]:/i to $SSL_DIR !~ /\A[a-z]:|^../i If we first consider that \A is merely a better ^, we can rewrite that change as $SSL_DIR !~ /\A(?:[a-z]:|..)/i so we default to "c:\openssl" if it contains one or two characters? What are you trying to say here? Thanks, David
On Mon Jul 23 08:20:32 2007, info@gknw.de wrote: Show quoted text
> Hi David, > I did some more hacking around, and fixed some build whoes on Win32 > when build with MSVC / ActivePerl: > - added option to specify static linking (since its often a mess to > depend on external DLLs)
Hmm, I can believe that, however, I'm not sure about the proposed patch: - elsif(-d "$SSL_DIR/out32dll") { + elsif(-d "$SSL_DIR/out32dll" && !$opt_static) { # patch from Ben Laurie push @LIB_FLAGS, "-L$SSL_DIR\\out32dll"; } + elsif(-d "$SSL_DIR/out32" && $opt_static) { + # patch from Ben Laurie + push @LIB_FLAGS, "-L$SSL_DIR\\out32"; + } In other words elsif(-d "$SSL_DIR/out32dll" && !$opt_static) { push @LIB_FLAGS, "-L$SSL_DIR\\out32dll"; } becomes elsif(-d "$SSL_DIR/out32dll" && !$opt_static) { push @LIB_FLAGS, "-L$SSL_DIR\\out32dll"; } elsif(-d "$SSL_DIR/out32" && $opt_static) { push @LIB_FLAGS, "-L$SSL_DIR\\out32"; } I don't understand the $opt_static negation (or not) in the conditionals. It makes me wonder what is supposed to happen in the cases of elsif(-d "$SSL_DIR/out32dll" && $opt_static) { # do what here? } elsif(-d "$SSL_DIR/out32" && !$opt_static) { # and here? } That is, I'd like to see all the bases covered. Thanks, David
Subject: Re: [rt.cpan.org #28431] Crypt-SSLeay-0.56 build issues on Win32 platform
Date: Tue, 31 Jul 2007 14:08:38 +0200
To: bug-Crypt-SSLeay [...] rt.cpan.org
From: Guenter Knauf <info [...] gknw.de>
Hi David, Show quoted text
> I'm looking at your patch right now, and I'm a bit puzzled over the > change you've made:
Show quoted text
> $SSL_DIR !~ /\A[a-z]:/i
Show quoted text
> to
Show quoted text
> $SSL_DIR !~ /\A[a-z]:|^../i
Show quoted text
> If we first consider that \A is merely a better ^, we can rewrite that > change as
Show quoted text
> $SSL_DIR !~ /\A(?:[a-z]:|..)/i
Show quoted text
> so we default to "c:\openssl" if it contains one or two characters? What > are you trying to say here?
I want to catch relative paths which start with '..'; probably I'm wrong here, and the dots need to be escaped which I forgot... I want to be '..\..\openssl' become a valid path; currently with your latest version of Makefile.PL from CVS I get (same as before): BUILD INFORMATION ================================================ ssl library: OpenSSL 0.9.8 in c:..\..\openssl-0.9.8e ssl header: openssl/ssl.h libraries: -Lc:..\..\openssl-0.9.8e -lssleay32 -llibeay32 include dir: -Ic:..\..\openssl-0.9.8e\inc32 ================================================ where you can see that the 'c:' is prepended which is wrong for a relative path; I f.e. work on the e: drive, and this causes then that openssl isnt found. greets, Guenter.
Subject: Re: [rt.cpan.org #28431] Crypt-SSLeay-0.56 build issues on Win32 platform
Date: Tue, 31 Jul 2007 14:16:07 +0200
To: bug-Crypt-SSLeay [...] rt.cpan.org
From: Guenter Knauf <info [...] gknw.de>
Hi David, Show quoted text
>> - added option to specify static linking (since its often a mess to >> depend on external DLLs)
Show quoted text
> Hmm, I can believe that, however, I'm not sure about the proposed patch:
Show quoted text
> - elsif(-d "$SSL_DIR/out32dll") { > + elsif(-d "$SSL_DIR/out32dll" && !$opt_static) { > # patch from Ben Laurie > push @LIB_FLAGS, "-L$SSL_DIR\\out32dll"; > } > + elsif(-d "$SSL_DIR/out32" && $opt_static) { > + # patch from Ben Laurie > + push @LIB_FLAGS, "-L$SSL_DIR\\out32"; > + }
Show quoted text
> In other words
Show quoted text
> elsif(-d "$SSL_DIR/out32dll" && !$opt_static) { > push @LIB_FLAGS, "-L$SSL_DIR\\out32dll"; > }
Show quoted text
> becomes
Show quoted text
> elsif(-d "$SSL_DIR/out32dll" && !$opt_static) { > push @LIB_FLAGS, "-L$SSL_DIR\\out32dll"; > } > elsif(-d "$SSL_DIR/out32" && $opt_static) { > push @LIB_FLAGS, "-L$SSL_DIR\\out32"; > }
Show quoted text
> I don't understand the $opt_static negation (or not) in the > conditionals. It makes me wonder what is supposed to happen in the cases > of
Show quoted text
> elsif(-d "$SSL_DIR/out32dll" && $opt_static) { > # do what here? > } > elsif(-d "$SSL_DIR/out32" && !$opt_static) { > # and here? > }
well, if you build OpenSSL for Win32 with MSVC then the static libs are put into ./out32, and the DLL libs are in ./out32dll; so I do either use the one or the other path depending on $opt_static. Show quoted text
> That is, I'd like to see all the bases covered.
hmm, what do you mean here? there are only two cases: static vs. dynamic linking. Or do you mean same for Linux platform? Sure that would make sense too I think; I've read in the forum that folks have their probs too on Linux with dynamic linking: http://www.cpanforum.com/posts/2786 and static linking would probably help them either..... that would then be something like linking against libssl.so vs. libssl.a I guess... greets, Guenter.
On Tue Jul 31 08:08:17 2007, info@gknw.de wrote: Show quoted text
> Hi David, >
> > I'm looking at your patch right now, and I'm a bit puzzled over the > > change you've made:
>
> > $SSL_DIR !~ /\A[a-z]:/i
>
> > to
>
> > $SSL_DIR !~ /\A[a-z]:|^../i
>
> > If we first consider that \A is merely a better ^, we can rewrite
> that
> > change as
>
> > $SSL_DIR !~ /\A(?:[a-z]:|..)/i
>
> > so we default to "c:\openssl" if it contains one or two characters?
> What
> > are you trying to say here?
> I want to catch relative paths which start with '..'; > probably I'm wrong here, and the dots need to be escaped which I > forgot...
Ok, that makes sense. Yes, they need to be escaped (I thought you were trying to match drive-letter full-colon or something). Show quoted text
> I want to be '..\..\openssl' become a valid path; currently with your > latest version of Makefile.PL from CVS I get (same as before): > > BUILD INFORMATION > ================================================ > ssl library: OpenSSL 0.9.8 in c:..\..\openssl-0.9.8e > ssl header: openssl/ssl.h > libraries: -Lc:..\..\openssl-0.9.8e -lssleay32 -llibeay32 > include dir: -Ic:..\..\openssl-0.9.8e\inc32 > ================================================ > > where you can see that the 'c:' is prepended which is wrong for a > relative path; > I f.e. work on the e: drive, and this causes then that openssl isnt > found.
Ok. Now I understand. I'll get that sorted out. Thanks, David
On Tue Jul 31 08:15:46 2007, info@gknw.de wrote: Show quoted text
> Hi David,
> >> - added option to specify static linking (since its often a mess to > >> depend on external DLLs)
>
> > Hmm, I can believe that, however, I'm not sure about the proposed
> patch: >
> > - elsif(-d "$SSL_DIR/out32dll") { > > + elsif(-d "$SSL_DIR/out32dll" && !$opt_static) { > > # patch from Ben Laurie > > push @LIB_FLAGS, "-L$SSL_DIR\\out32dll"; > > } > > + elsif(-d "$SSL_DIR/out32" && $opt_static) { > > + # patch from Ben Laurie > > + push @LIB_FLAGS, "-L$SSL_DIR\\out32"; > > + }
>
> > In other words
>
> > elsif(-d "$SSL_DIR/out32dll" && !$opt_static) { > > push @LIB_FLAGS, "-L$SSL_DIR\\out32dll"; > > }
>
> > becomes
>
> > elsif(-d "$SSL_DIR/out32dll" && !$opt_static) { > > push @LIB_FLAGS, "-L$SSL_DIR\\out32dll"; > > } > > elsif(-d "$SSL_DIR/out32" && $opt_static) { > > push @LIB_FLAGS, "-L$SSL_DIR\\out32"; > > }
>
> > I don't understand the $opt_static negation (or not) in the > > conditionals. It makes me wonder what is supposed to happen in the
> cases
> > of
>
> > elsif(-d "$SSL_DIR/out32dll" && $opt_static) { > > # do what here? > > } > > elsif(-d "$SSL_DIR/out32" && !$opt_static) { > > # and here? > > }
> > well, if you build OpenSSL for Win32 with MSVC then the static libs > are put into ./out32, and the DLL libs are in ./out32dll; so I do > either use the one or the other path depending on $opt_static.
Aha, I see now. It makes sense, but the conditionals as they are don't make the meaning clear. I think I'd like to see something like my $dir = $opt_static ? "$SSL_DIR/out32dll" : "$SSL_DIR/out32"; if (-d $dir) { push @LIB_FLAGS, "-L$dir"; } Show quoted text
> > That is, I'd like to see all the bases covered.
> hmm, what do you mean here? there are only two cases: static vs. > dynamic linking.
Indeed. It was just the (a && b) condition and the (c && !b) condition that confused me. I was wondering if (a && !b) or (c && b) could be possible. I think my snippet above shows a better clarity of purpose. Do you agree that its meaning is easier to follow? Show quoted text
> Or do you mean same for Linux platform? Sure that would make sense too > I think; > I've read in the forum that folks have their probs too on Linux with > dynamic linking: > http://www.cpanforum.com/posts/2786 > and static linking would probably help them either.....
Hmmm, you have a point there... Show quoted text
> that would then be something like linking against libssl.so vs. > libssl.a I guess... > > greets, Guenter.
Thanks for your feedback, it is most appreciated. David
I have uploaded 0.56_01 to CPAN. It will be available on a mirror near you, tomorrow. Can you take it for a spin and let me know what you think? I have yet to include the network test switch, but I'll get that in before 0.57 is released. Thanks, David
Subject: Re: [rt.cpan.org #28431] Crypt-SSLeay-0.56 build issues on Win32 platform
Date: Sun, 12 Aug 2007 23:14:09 +0200
To: bug-Crypt-SSLeay [...] rt.cpan.org
From: Guenter Knauf <info [...] gknw.de>
Hi David, Show quoted text
Show quoted text
> I have uploaded 0.56_01 to CPAN. It will be available on a mirror near > you, tomorrow.
Show quoted text
> Can you take it for a spin and let me know what you think? I have yet to > include the network test switch, but I'll get that in before 0.57 is > released.
ok. Have just tested a bit: - Win32 builds now fine so far; tested both dynamic and static linking. - The NetWare patch (#28432) has a typo: --- SSL.pm.orig Mon Jul 30 20:33:26 2007 +++ SSL.pm Sun Aug 12 22:01:48 2007 @@ -24,7 +24,7 @@ } sub _alarm_set { - return if $^O eq 'MSWin32' or $^O eq 'Netware'; + return if $^O eq 'MSWin32' or $^O eq 'NetWare'; alarm(shift); } other than that it looks ok. Another small issue might be some signed<->unsigned warnings which I get on Win32: SSLeay.xs(294) : warning C4018: '>' : signed/unsigned mismatch SSLeay.xs(298) : warning C4018: '>=' : signed/unsigned mismatch SSLeay.xs(301) : warning C4018: '>' : signed/unsigned mismatch SSLeay.xs(333) : warning C4018: '>' : signed/unsigned mismatch SSLeay.xs(341) : warning C4018: '>' : signed/unsigned mismatch SSLeay.xs(349) : warning C4018: '<' : signed/unsigned mismatch however for Linux and NetWare with gcc I dont see these - but instead these: SSLeay.c: In function ‘XS_Crypt__SSLeay__CTX_new’: SSLeay.c:118: warning: unused variable ‘packname’ SSLeay.xs: In function ‘XS_Crypt__SSLeay__CTX_use_pkcs12_file’: SSLeay.xs:175: warning: suggest parentheses around assignment used as truth value SSLeay.c: In function ‘XS_Crypt__SSLeay__Conn_new’: SSLeay.c:395: warning: unused variable ‘packname’ SSLeay.c: In function ‘XS_Crypt__SSLeay__CTX_use_pkcs12_file’: SSLeay.c:287: warning: ‘RETVAL’ may be used uninitialized in this function the parentheses and the uninitialized warnings I could easily fix; however since I have not that much insight to the XS stuff I'm unsure if its valid to just remove the lines 99 and 228 in SSLeay.xs with the 'packname' assignment; I did that for a test, and it still compiled fine. Attached patches to fix the other above mentioned warnings. greets, Guenter.
--- SSLeay.xs.orig Fri Mar 02 20:39:18 2007 +++ SSLeay.xs Sun Aug 12 23:00:56 2007 @@ -172,7 +172,8 @@ STACK_OF(X509) *ca = NULL; PKCS12 *p12; CODE: - if (fp = fopen(filename, "rb")) { + RETVAL = 0; + if ((fp = fopen(filename, "rb"))) { p12 = d2i_PKCS12_fp(fp, NULL); fclose (fp); @@ -291,14 +292,14 @@ if (items > 3) { offset = SvIV(ST(3)); if (offset < 0) { - if (-offset > blen) + if (-offset > (int)blen) croak("Offset outside string"); offset += blen; } - else if (offset >= blen && blen > 0) + else if (offset >= (int)blen && blen > 0) croak("Offset outside string"); } - if (len > blen - offset) + if (len > (int)blen - offset) len = blen - offset; } else { @@ -330,7 +331,7 @@ if (items > 3) { offset = SvIV(ST(3)); if (offset < 0) { - if (-offset > blen) + if (-offset > (int)blen) croak("Offset outside string"); offset += blen; } @@ -338,7 +339,7 @@ * (offset - blen) NUL bytes, but it will probably * seldom happen. */ - while (offset > blen) { + while (offset > (int)blen) { sv_catpvn(sv, "\0", 1); blen++; } @@ -346,7 +347,7 @@ if (len < 0) croak("Negative length"); - SvGROW(sv, offset + len + 1); + SvGROW(sv, (unsigned int)(offset + len + 1)); buf = SvPVX(sv); /* it might have been relocated */ n = SSL_read(ssl, buf+offset, len);
--- SSL.pm.orig Mon Jul 30 20:33:26 2007 +++ SSL.pm Sun Aug 12 22:01:48 2007 @@ -24,7 +24,7 @@ } sub _alarm_set { - return if $^O eq 'MSWin32' or $^O eq 'Netware'; + return if $^O eq 'MSWin32' or $^O eq 'NetWare'; alarm(shift); }
Sorry for the lack of action on your two tickets in the previous weeks. I was on holidays, then there was YAPC::Europe and then a couple of important bugs came up. These have been fixed and a new release issued. I hope to wrap these last items up soon. Thanks for your patience, David
Hello: I believe code to solve these issues was added to Makefile.PL as of 0.57_01. I did make some changes in Makefile.PL but I believe I retained the fixes requested and submitted for this report. So, please do check out 0.57_04, available at http://search.cpan.org/~nanis/Crypt-SSLeay-0.57_04/ and let me know if there are any problems. Thank you. -- Sinan