Why does Perl module Crypt::SSLeay give an error upon loading? - perl

I am trying to get WWW::Mechanize to login to Yahoo using https; however, it requires the use of Crypt::SSLeay for sending over https.
Crypt::SSLeay installed succesfully, and openssl was already installed on the system.
However, it gives the error upon loading:
Can't load '/home/gen19/perl5/lib/perl5/lib/site_perl/5.10.1/i686-linux//auto/Crypt/SSLeay/SSLeay.so' for module Crypt::SSLeay: /home/gen19/perl5/lib/perl5/lib/site_perl/5.10.1/i686-linux//auto/Crypt/SSLeay/SSLeay.so: undefined symbol: PL_sv_undef at /usr/lib/perl5/5.8.0/i386-linux-thread-multi/DynaLoader.pm line 229.
at /home/gen19/lwp4 line 15
Compilation failed in require at /home/gen19/lwp4 line 15.
BEGIN failed--compilation aborted at /home/gen19/lwp4 line 15.
The installation of Crypt::SSLeay was successful, and could recognize the installation of openssl (here):
perl Makefile.PL
=======================================================
Only one OpenSSL installation found at /usr
Consider running 'perl Makefile.PL --default' the next
time Crypt::SSLeay is upgraded to select this directory
automatically thereby avoiding the following prompt.
=======================================================
Which SSL install path do you want to use? [/usr] /home/gen19/ssldir
BUILD INFORMATION
================================================
ssl library: OpenSSL 0.9.8 in /home/gen19/ssldir
ssl header: openssl/ssl.h
libraries: -L/home/gen19/ssldir/lib -lssl -lcrypto -lgcc
include dir: -I/home/gen19/ssldir/include/openssl -I/usr/kerberos/include
================================================
Note (probably harmless): No library found for -lgcc
Writing Makefile for Crypt::SSLeay
The test suite can attempt to connect to public servers
to ensure that the code is working properly. If you are
behind a strict firewall or have no network connectivity,
these tests may fail (through no fault of the code).
Do you want to run the live tests (y/N) ? [N]
NOTE: recently installed Perl v5.10.1 using App::perlbrew, due to LWP::UserAgent's needing it. I installed Crypt::SSLeay using my new version of Perl.
I don't have root priveldiges, as I am doing this on a remote server at school. Please tell me why it's giving the error even though it installed succesfully. I know it has something to do with the shared libraries, but the installation recognized them.
SIDE NOTE: my script works fine if I don't say "use Crypt::SSLeay;" at the start, but it gives the error when I use https that it's not a supported protocol, and needs LWP::protocol::https installed. Installing that always fails.
EDIT: Thanks for your help, CJM. Apparently it was using the old version of Perl when I executed, but now I've fixed that.
It doesn't give that error anymore; however, it still says
Error GETing https://login.yahoo.com/config/login_verify2?&.src=ym: Protocol scheme 'https' is not supported (LWP::Protocol::https not installed) at lwp4 line 14
I thought Crypt::SSLeay was supposed to take care of this.

If you examine the error message, you'll notice it mentions both 5.10.1 and 5.8.0 (in the Perl library paths). This indicates that you're trying to use a module built for one version of Perl with a different version. XS-based Perl modules (i.e. ones that include C code) are not binary compatible between major releases of Perl.
It appears you installed Crypt::SSLeay using Perl 5.10.1, and are trying to use it with 5.8.0. That won't work. Use only Perl 5.10.x with that installation. If you need to use it with Perl 5.8.0 also, install another copy in a different directory.

Related

INSTALL_BASE=~/perl5 -- NOT OK - While installing Perl Module

I am trying to install one of the Perl module in my local system (Windows 7). But its failing to install the module
Here is what its displaying
C:\Windows\system32>perl -MCPAN -e "install Net::SFTP"
Reading 'C:\Users\AppData\Local\.cpan\Metadata'
Database was generated on Sun, 26 May 2019 05:17:03 GMT
Running install for module 'Net::SFTP'
Checksum for C:\Users\AppData\Local\.cpan\sources\authors\id\L\LK\LKINLE
Y\Net-SFTP-0.12.tar.gz ok
Configuring L/LK/LKINLEY/Net-SFTP-0.12.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Warning: prerequisite Math::Int64 0.54 not found.
Warning: prerequisite Net::SSH::Perl 2.12 not found.
The getpwuid function is unimplemented at C:/Perl64/lib/ExtUtils/MakeMaker.pm li
ne 1064.
Warning: No success on command[C:\Perl64\bin\perl.exe Makefile.PL INSTALL_BASE=~
/perl5]
LKINLEY/Net-SFTP-0.12.tar.gz
C:\Perl64\bin\perl.exe Makefile.PL INSTALL_BASE=~/perl5 -- NOT OK
It was working fine before and I have installed couple of modules, don't know what happens suddenly.
Please help me to resolve this. Do I need to make any modifications in config?
You're telling Perl to into ~/perl5. That's not a Windows path, and ExtUtils::MakeMaker is using a unix-specific function (getpwuid) to expand it. Your problem should go away if you use a Windows path.
That said, if you have access to write to C:\Perl64\..., I suggest that you install modules to the default directory by removing INSTALL_BASE=~/perl5.
If you don't have access to write to C:\Perl64\..., I suggest that you install Perl itself in a directly to which you do have access to write, and then I'd install modules to the default directory by removing INSTALL_BASE=~/perl5.
Since you didn't actually specify INSTALL_BASE=~/perl5 on the command line, you are specifying it through the environment (PERL_MM_OPT and PERL_MB_OPT), or in cpan's configuration (o conf from within cpan).

How to diagnose dll load problem for Perl Module Lab::VISA

I have successfully installed (i.e without errors or warnings) as per the instructions:
https://metacpan.org/pod/distribution/Lab-VISA/lib/Lab/VISA/Installation.pod
But when I try to run the example script I get:
Can't load 'C:/Dwimperl/perl/site/lib/auto/Lab/VISA/VISA.dll' for module
Lab::VISA: load_file:The specified module could not be found at
C:/Dwimperl/perl/lib/DynaLoader.pm line 190.
at C:/Dwimperl/perl/site/lib/Lab/VISA.pm line 11
Compilation failed in require at VISA Test.pl line 3.
BEGIN failed--compilation aborted at VISA Test.pl line 3.
Googling this suggests the there is something wrong with VISA.dll. This is generated during the install of the module, so I guess it is something in my environment. But my limited knowledge means I am not sure where to start. And I cannot seem to find a help contact or forum for Lab::VISA module.
It is mentioned in metacpan :
On 64-bit windows one needs a 32-bit version of perl with GNU binutils version <= 2.24. Otherwise linking with the NI-VISA library will fail. The reason for this are the following bugs in the GNU binutils:
binutils bug 16598
binutils bug 17910
These are fixed in the most recent version of the binutils. Once this version (2.26) is included in Strawberry Perl, it should be possible to use a 64-bit version of perl.
It is not possible to use either 32-bit or 64-bit versions of Strawberry Perl 5.22 as this version uses binutils 2.25.
So if you have WIN 64 , you need to install binutils
binutils bug 16598 : https://sourceware.org/bugzilla/show_bug.cgi?id=16598
and binutils bug 17910 : https://sourceware.org/bugzilla/show_bug.cgi?id=17910
Notice : don't forget to always read documentations

CPAN install module meet make file not ok issue

I'm trying to run this script on my computer (MAC)
http://mkweb.bcgsc.ca/color-summarizer/?download
It's the first time in my life touching the terminal... so you understand that I ask very basic questions. please do forgive me...
basically when i execute the script, I would always get this kind of message :
Can't locate Imager/File/GIF.pm in #INC (you may need to install the
Imager::File::GIF module) (#INC contains:
/Applications/colorsummarizer/colorsummarizer-0.77/bin/lib
/Applications/colorsummarizer/colorsummarizer-0.77/bin/../lib
/Applications/colorsummarizer/colorsummarizer-0.77/bin
/Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18
/Network/Library/Perl/5.18/darwin-thread-multi-2level
/Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2/darwin-thread-
multi-2level /Library/Perl/Updates/5.18.2
/System/Library/Perl/5.18/darwin-thread-multi-2level
/System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-
thread-multi-2level /System/Library/Perl/Extras/5.18) at
/Library/Perl/5.18/darwin-thread-multi-2level/Imager.pm line 1677.
And so I use :
sudo cpan install Imager::File::GIF
for example. But the I get this :
Warning (mostly harmless): No library found for -lgif
GIF: Test code failed: Can't link/include 'gif_lib.h', 'stdio.h',
'errno.h', 'string.h', 'gif'
OS unsupported: GIF libraries or headers not found
Warning: No success on command[/usr/bin/perl Makefile.PL]
TONYC/Imager-File-GIF-0.91.tar.gz
/usr/bin/perl Makefile.PL -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites
And ! it seems like even when I appear to install something successfully, The system ask me to re-install them again and again and again...
Maybe I did some very fundamental mistakes ?
Thanks a lot for your attention
The issue identified by the following message is not harmless at all, actually:
Warning (mostly harmless): No library found for -lgif
GIF: Test code failed: Can't link/include 'gif_lib.h', 'stdio.h',
'errno.h', 'string.h', 'gif'
The module uses libgif to do all the heavy work, but it's not installed. Furthermore, the installation procedure needs the library's header files.
Imager::File::GIF provides GIF file format support for Imager.
It requires libgif to be installed, including development headers.
For Linux distributions this typically requires installation of the
associated -dev or -devel package.
Installing the required library and header files might be as simple as asking your OS's package manager to install libgif-dev or libgif-devel.
Try to just install Imager like this, it might be all you need:
sudo cpan Imager
After that it could open gifs for me.

Error install IO::Pty perl

install IO::Pty cpan
Tty.xs:54:23: sys/ioctl.h: No such file or directory
Tty.xs: In function `make_safe_fd':
Tty.xs:225: error: `F_DUPFD' undeclared (first use in this function)
Tty.xs:225: error: (Each undeclared identifier is reported only once
Tty.xs:225: error: for each function it appears in.)
dmake.exe: Error code 129, while making 'Tty.o'
TODDR/IO-Tty-1.10.tar.gz
C:\Perl\site\bin\dmake.exe -- NOT OK
no SFTP module is getting install.
First, that distribution is called IO::Tty (which contains an IO::Pty module).
You seem to be missing some header files for a C library your module is linking to. You would have to install the headers beforehand. However… ioctl is Unix-specific and a part of the operating system. It is also notoriously unportable.
I could not find any reports of a IO::Tty install working on Windows, so it seems you can't use that module on Windows (without a Cygwin environment). As it happens this is also what the IO::Tty documentation says:
Windows is now supported, but ONLY under the Cygwin environment, see http://sources.redhat.com/cygwin/.

Why can't DynaLoader.pm load SSleay.dll for Net::SSLeay and Crypt::SSLeay?

I have Perl v5.10. I am trying to install Net::SSLeay 1.30 and Crypt::SSLeay 0.57.
I have already installed OpenSSL 0.9.8e.
For Net::SSLeay 1.30 I followed these steps:
perl Makefile.PL -windows C:\openssl
nmake
nmake test -- test fails
nmake install
perl test.pl
but I got an fatal error as:
D:\perl\Net_SSLeay.pm-1.30>perl -w test.pl
1..20
Can't load 'D:/perl/site/lib/auto/Net/SSLeay/SSLeay.dll' for module Net::SSLeay: load_file:The specified module could not be found at D:/perl/lib/DynaLoader.pm line 203.
at test.pl line 25
Compilation failed in require at test.pl line 25.
BEGIN failed--compilation aborted at test.pl line 25.
I got the same results for Crypt::SSLeay 0.57.
Randy Kobes has an answer for this on the Perl Win32 mailing list. Does your PATH environment variable contain the directory that contains libeay32.dll or ssleay32.dll?
There are many other answers that you can find in Google too. In cases like these, I take the whole error message and shove it into the Google search bar. I start cutting out parts of the error message, such as the specific paths, until I get some search results. This almost always works for me since I'm rarely the first person to have a problem.
Shared libs often have external dependencies, and on some operating systems those dependencies need to be immediately fulfilled when the first shared library is loaded, like your SSLeay.dll, which usually needs the two crypto libs. On linux you can check with ldd the run-time behavior, if all libs are found.
To debug this add the env var PERL_DL_DEBUG=5, like set PERL_DL_DEBUG=5 and try again or use the external tool depends.exe to see what dll's exactly are missing.
I had a similar problem with Windows Par::Packer. The resulting myprogram.exe had trouble loading rurban's hint with PERL_DL_DEBUG
Can't load 'temp\7e717f68.xs.dll' for module Crypt::SSLeay: load_file:Das angegebene Modul wurde nicht gefunden at <embedded>/DynaLoader.pm line 193.
at <embedded>/PAR/Heavy.pm line 95.
I was not able to find out which dlls to include with pp. After these hints I was simply looking to the dll-file with a hex editor and found this string: libgcc_s_dw2-1.dll - this was the dll to include into my "compiled" exe-program:
pp -M Crypt::SSLeay ^
-l c:/strawberry/perl/vendor/lib/auto/Crypt/SSLeay/SSLeay.xs.dll ^
-l c:/strawberry/c/bin/libgcc_s_dw2-1.dll ....
I'm having this same problem with a fresh install of Strawberry Perl 5.30. Googling the error just gives a bunch of unanswered, or half answered questions. Rurban is pointing in the right direction with using depends.exe. Opening ssleay.xs.dll and waiting for it to finishing throwing errors shows 5 main dll's that it depends on. 2 of which are windows core dll's, and 3 from openssl and perl. In the strawberry install, the 2 dll's related to crypto are in the [perlinstallpath]\c\bin folder. Add this to your windows %PATH% variable and it will start working.