Subject: | [PATCH] Bad sequence when OPENSSL_PREFIX is used |
Consider a system that has multiple versions of OpenSSL installed.
When using OPENSSL_PREFIX, it is used to *add* the library path(s) to the required build options and flags, causing a bad call when libraries of a different version are found *before* the version required by OPENSSL_PREFIX.
Without the patch:
$ echo "n" | perl Makefi
le.PL ; grep -- -L Makefile
*** Found OpenSSL-1.0.1i installed in /usr/local/ssl
*** Be sure to use the same compiler and options to compile your OpenSSL, perl,
and Net::SSLeay. Mixing and matching compilers is not supported.
Do you want to run external tests?
These tests *will* *fail* if you do not have network connectivity. [n] Generating a Unix-style Makefile
Writing Makefile for Net::SSLeay
Writing MYMETA.yml and MYMETA.json
# LIBS => [q[-L/usr/local/ssl -L/usr/local/ssl/lib -lssl -lcrypto -lz]]
# These definitions are from config.sh (via /pro/lib/perl5/5.14.2/IA64.ARCHREV_0-LP64-ld/Config.pm).
LDDLFLAGS = -b +vnocompatwarnings -L/pro/local/lib -L/usr/lib/hpux64
LDFLAGS = -L/pro/local/lib +DD64 -L/usr/lib/hpux64
SITEARCHEXP = /pro/lib/perl5/site_perl/5.14.2/IA64.ARCHREV_0-LP64-ld
INSTALLARCHLIB = /pro/lib/perl5/5.14.2/IA64.ARCHREV_0-LP64-ld
INSTALLSITEARCH = /pro/lib/perl5/site_perl/5.14.2/IA64.ARCHREV_0-LP64-ld
PERL_ARCHLIB = /pro/lib/perl5/5.14.2/IA64.ARCHREV_0-LP64-ld
PERL_INC = /pro/lib/perl5/5.14.2/IA64.ARCHREV_0-LP64-ld/CORE
EXTRALIBS = -L/usr/local/ssl -L/usr/local/ssl/lib -lssl -lcrypto -lz
LDLOADLIBS = -L/usr/local/ssl -L/usr/local/ssl/lib -lssl -lcrypto -lz
$(NOECHO) $(ECHO) ' <ARCHITECTURE NAME="IA64.ARCHREV_0-LP64-ld-5.14" />' >> $(DISTNAME).ppd
Note that LDDLFLAGS and LDFLAGS have -L options that, when building, will be placed *IN FRONT OF* what is denoted in EXTRALIBS. If - in this case - /pro/local/lib or /usr/lib/hpux64 feature a libcrypto.so that matches the architecture but not the version (e.g. 0.9.7 or 0.9.8 when compiling against 1.0.1), the build will fail.
The patch below will force the required library paths to precede the default path
$ echo "n" | perl Makefi
le.PL ; grep -- -L Makefile
*** Found OpenSSL-1.0.1i installed in /usr/local/ssl
*** Be sure to use the same compiler and options to compile your OpenSSL, perl,
and Net::SSLeay. Mixing and matching compilers is not supported.
Do you want to run external tests?
These tests *will* *fail* if you do not have network connectivity. [n] Generating a Unix-style Makefile
Writing Makefile for Net::SSLeay
Writing MYMETA.yml and MYMETA.json
# LDDLFLAGS => q[-b +vnocompatwarnings -L/usr/local/ssl -L/usr/local/ssl/lib -L/pro/local/lib -L/usr/lib/hpux64]
# LDFLAGS => q[-L/usr/local/ssl -L/usr/local/ssl/lib -L/pro/local/lib +DD64 -L/usr/lib/hpux64]
# LIBS => [q[-L/usr/local/ssl -L/usr/local/ssl/lib -lssl -lcrypto -lz]]
# These definitions are from config.sh (via /pro/lib/perl5/5.14.2/IA64.ARCHREV_0-LP64-ld/Config.pm).
LDDLFLAGS = -b +vnocompatwarnings -L/usr/local/ssl -L/usr/local/ssl/lib -L/pro/local/lib -L/usr/lib/hpux64
LDFLAGS = -L/usr/local/ssl -L/usr/local/ssl/lib -L/pro/local/lib +DD64 -L/usr/lib/hpux64
SITEARCHEXP = /pro/lib/perl5/site_perl/5.14.2/IA64.ARCHREV_0-LP64-ld
INSTALLARCHLIB = /pro/lib/perl5/5.14.2/IA64.ARCHREV_0-LP64-ld
INSTALLSITEARCH = /pro/lib/perl5/site_perl/5.14.2/IA64.ARCHREV_0-LP64-ld
PERL_ARCHLIB = /pro/lib/perl5/5.14.2/IA64.ARCHREV_0-LP64-ld
PERL_INC = /pro/lib/perl5/5.14.2/IA64.ARCHREV_0-LP64-ld/CORE
EXTRALIBS = -L/usr/local/ssl -L/usr/local/ssl/lib -lssl -lcrypto -lz
LDLOADLIBS = -L/usr/local/ssl -L/usr/local/ssl/lib -lssl -lcrypto -lz
$(NOECHO) $(ECHO) ' <ARCHITECTURE NAME="IA64.ARCHREV_0-LP64-ld-5.14" />' >> $(DISTNAME).ppd
--8<---
--- inc/Module/Install/PRIVATE/Net/SSLeay.pm.org 2014-09-15 15:02:54 +0200
+++ inc/Module/Install/PRIVATE/Net/SSLeay.pm 2014-09-15 15:02:57 +0200
@@ -140,6 +140,10 @@ EOM
}
}
+ if (my $lp = join " " => map { "-L$_" } @{$opts->{lib_paths} || []}) {
+ my $mma = $self->makemaker_args;
+ ($mma->{uc $_} = $Config{$_}) =~ s/-L/$lp -L/ for qw( lddlflags ldflags );
+ }
return $opts;
}
-->8---