How can I resolve the error "-bash: corelist: command not found"? - perl

I want to find the differences between two versions of Perl using the corelist command line utility.
I tried running the following command:
corelist File::Spec
but I got an error:
-bash: corelist: command not found
How can I resolve this?

The error suggests that corelist is not installed on your machine. If not installed, you can install it via
Ubuntu: sudo apt-get install libmodule-corelist-perl
Centos: Via RPM here
Once you have it installed, you can find the differences between two versions of Perl as follows:
corelist --diff v5.12.0 v5.24.0
If you have problems installing it, there is a web version of corelist available online to which you can refer: http://perlpunks.de/corelist It supports doing differences between Perl versions too.

Related

Cwd.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xde00080)

All Perl modules and 'cpan' stopped working after an upgrade of Ubuntu 16.04 LTS to 18.04 LTS. Every time I run my script it leads to the error
threads.c: loadable library and Perl binaries are mismatched (got handshake key 0xdb00080, needed 0xde00080)
when I try to open cpan it shows
Cwd.c: loadable library and Perl binaries are mismatched (got handshake key 0xdb00080, needed 0xde00080)
I had installed "Cwd", "threads" modules in ubuntu 16.04 where Perl version was 5.22.1, whereas in ubuntu 18.04 the Perl version is 5.26.1.
I tried to remove the old version of modules but failed. I deleted content on ~/.cpan folder.
PS:
Everything works fine in root user.
if I run
sudo su
cpan
works perfectly. But as a normal user, I cant run any perl modules/scripts/cpan.
How do I correct the issue?
How can I re-install cpan or cpan modules?
I tried to reinstall Perl which did not help
sudo apt-get --reinstall install perl
sudo apt-get --reinstall install libcwd-guard-perl
I installed cpan minus, cpan plus which gave the same error.
For solve problem next links can be used:
https://dev.to/foursixnine/about-perl-and-mismatched-binaries-346l
https://metacpan.org/pod/release/DBOOK/App-MigrateModules-0.002/script/perl-migrate-modules
Or in commands: (Replace to your perl5 folder, in my case it was ~/perl5)
mv <perl5> perl5_old
cpan
cpan App::MigrateModules
perl-migrate-modules --from perl5_old /usr/bin/perl
Where perl5 your perl folder, usually in path exists in ENV variable PERL5LIB.
I solved this issue by following https://github.com/Perl/perl5/issues/15861
I ran the command perl -MCPAN -e 'recompile()'
It recompile all the module, at last it worked.

Install perl module Net:SSH2 on redhat/centos 7

As the title says I am trying to install the perl module perl-Net-SSH2. I have tried via yum but get an error that no package is available.
yum install perl-Net-SSH2
I have tried by downloading an rpm file but the only one I can find is for el6 and it complains about the version of perl
yum localinstall perl-Net-SSH2-0.45-4.el6.x86_64.rpm
Requires: perl(:MODULE_COMPAT_5.10.1)
I have tried downloading the source code but get told "Unable to find a working version of library ssh2 in the following directories" even though it is installed. (via yum install libssh2 libssh2-devel)
I have tried via cpan but get the same error "Unable to find a working version of library ssh2 in the following directories"
Any ideas? Google is very sketchy on this and only
OK, I solved this while writing the question. Seeing as information on this is limited I thought it would be worth posting the question anyway. The error message was giving the wrong information in that it was actually gcc that was missing, not libssh2. These are the steps I followed. I've tried to make it as verbatim as possible. I have not verified all these modules are required but this is what I installed before compiling it.
yum install libssh2 libssh2-devel
yum install openssl openssl-devel
yum install perl-Net-SSLeay
yum install gcc
Search for Net::SSH2 in google
Click the link "Net::SSH2 - search.cpan.org"
Download source code (tar.gz file)
Copy it to your redhat 7 machine
tar -xvf Net-SSH2-0.62.tar.gz
cd Net-SSH2-x.xx
perl Makefile.PL
make
make install
Should all be working now, test it with
perl -e 'use Net::SSH2;'

Perl DBD::Oracle Module installation

Could someone guide me how to install the Perl DBD::Oracle module?
Here is what I have done so far:
Platform: RHEL 5.8 64 bit
Installed Perl DBI package
Installed Oracle Instant client for Linux 64 bit (basi + sdk + sqlplus component for the instant client
Have set the correct $ORACLE_HOME and $LD_LIBRARY_PATH
Then when I do perl Makefile.pl it fails with the following error:
I'm having trouble finding your Oracle version number... trying harder
WARNING: I could not determine Oracle client version so I'll just
default to version 8.0.0.0. Some features of DBD::Oracle may not work.
Oracle version based logic in Makefile.PL may produce erroneous results.
You can use "perl Makefile.PL -V X.Y.Z" to specify a your client version.
Oracle version 8.0.0.0 (8.0)
DBD::Oracle no longer supports Oracle client versions before 9.2
Try a version before 1.25 for 9 and 1.18 for 8! at Makefile.PL line 271.
The instant client version: 11.1.0
The DBD::Oracle version is 1.44
If you have installed successfully with the Oracle instant client, then could you please let me know what am I missing?
Is it possible to install DBD::Oracle without using the Oracle instant client?
Install if missing ExtUtils-MakeMaker module (sudo yum install perl-ExtUtils-MakeMaker)
Install Perl DBI module ($ yum install perl-DBI)
Manually install below three RPMs for Oracle instant client (from Instant Client Downloads for Linux x86-64. The example is for v11.2.0.3.0-1: adapt the commands below to the actual version.)
oracle-instantclient11.2-basic-11.2.0.3.0-1
oracle-instantclient11.2-devel-11.2.0.3.0-1
oracle-instantclient11.2-sqlplus-11.2.0.3.0-1
I am using 64 bit Linux box, so select your RPM filenames accordingly. Something like sudo yum -y install oracle-instantclient*rpm should do)
set below variables:
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
MacOS users will need:
DYLD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/
Also add ORACLE_HOME to your PATH variable.
download DBD::Oracle from CPAN
untar the module and run below commands in given sequence:
perl Makefile.PL
make
sudo make install
In case you get complaints about missing gcc you can (temporarily) install it and then remove it.
DONE !!!
Issues I had faced were due to the wrong LD_LIBRARY_PATH. I had set it to /usr/lib/oracle/11.2/client64 whereas the correct value is /usr/lib/oracle/11.2/client64/lib.
Certainly, this was a great learning for a newbie like me.
you can also read my article How to install DBD::Oracle which contains all the steps required to install DBD::Oracle CPAN module, which is not a straightforward installation. The purpose is to reduce headache and turn it into a repeatable process.
Here's what I did on CentOS 7.2 using yum packages and CPAN. This assumes you're using Oracle version 12.1 but I would imagine most versions will work this way.
Install Oracle Instant Client
yum install oracle-instantclient12.1-basic-12.1.0.2.0-1 oracle-instantclient12.1-devel-12.1.0.2.0-1 oracle-instantclient12.1-sqlplus-12.1.0.2.0-1
Copy demo make files
The install expects the *.mk file to be in /usr/share/oracle/12.1/client64 but the yum package install puts them in /usr/share/oracle/12.1/client64/demo.
sudo cp /usr/share/oracle/12.1/client64/demo/* /usr/share/oracle/12.1/client64
Modify .bashrc
Add the following lines to your ~/.bashrc
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
export PATH=$ORACLE_HOME:$PATH
Now source the file
source ~/.bashrc
Update CPAN and DBI
Update CPAN and DBI to the latest
cpan> install CPAN
cpan> reload cpan
cpan> install DBI
Install DBD::Oracle
cpan> install DBD::Oracle
A little addition to slayedbylucifer answer. I had the same problem like mentioned in the question. I've done all the steps described by slayedbylucifer. But still I got the problem like mentioned here:
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /opt/oracle/app/oracle/product/11.2.0/client_1/lib//libclntsh.so when searching for -lclntsh
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lclntsh
So I created the following symbolic link:
ln -s /opt/oracle/app/oracle/product/<YOUR_ORACLE_VERSION>/client_1/lib/libclntsh.so $ORACLE_HOME/libclntsh.so*
After that step the error from above (cannot find -lclntsh) was fixed. The execution of the make command was without any errors.
The only problem I still have is that I don't understand why this symbolic link is necessary.

How to install XML::Parser without expat-devel?

XML::Parser fails to build on a quite fresh 64-bit Debian box. After issuing cpan XML::Parser, cpan fails with lots of errors about Expat.c and Expat.xs:
[...]
Expat.xs:2182: error: ‘CallbackVector’ has no member named ‘skip_until’
Expat.c: In function ‘XS_XML__Parser__Expat_Do_External_Parse’:
Expat.c:2904: error: ‘XML_Parser’ undeclared (first use in this function)
Expat.c:2904: error: expected ‘;’ before ‘parser’
Expat.xs:2194: error: ‘parser’ undeclared (first use in this function)
make[1]: *** [Expat.o] Error 1
make[1]: Leaving directory `/root/.cpan/build/XML-Parser-2.41-rpV6ok/Expat'
make: *** [subdirs] Error 2
TODDR/XML-Parser-2.41.tar.gz
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Message at the start of the output explains that expat-devel is needed for building.
Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' package with your
OS package manager. See 'README'.
But expat-devel is not in Debian repository.
Is it possible to get over this without need to build/install expat from source?
The package you want to install is named libexpat1-dev. You could also just install libxml-parser-perl via apt-get. Or if you really want to install via CPAN try installing the Debian packages dependencies first via apt-get build-dep libxml-parser-perl.
libexpat1-dev contains both libexpat and expat.h, which are both mentioned in the message as well:
If expat is installed, but in a non-standard directory, then use the
following options to Makefile.PL:
EXPATLIBPATH=... To set the directory in which to find libexpat
EXPATINCPATH=... To set the directory in which to find expat.h
Installing libexpat1-dev seems to solve the problem:
$ aptitude install libexpat1-dev
There is always the manual method - to build/install expat from source.
(This example shows installing to an alternative location for XAMPP | LAMPP)
Download from:
http://sourceforge.net/projects/expat/files/expat/
tar zxf /[where-ever]/expat-2.1.0.tar.gz -C /tmp
cd /tmp/expat-2.1.0
/opt/lampp/bin/perl ./configure --prefix=/opt/lampp LDFLAGS=-L/opt/lampp/lib
make
make install
http://search.cpan.org - search for and download - XML::Parser
tar zxf /[where-ever]/XML-Parser-2.41.tar.gz -C /tmp
cd /tmp/XML-Parser-2.41
/opt/lampp/bin/perl ./Makefile.PL EXPATLIBPATH=/opt/lampp/lib EXPATINCPATH=/opt/lampp/include
make
make test
make install
Work like a charm in Ubuntu 15.04. The only thing that I need is install Perl XML Parser with:
sudo apt-get install libxml-parser-perl
And following the instructions here, I was able to import successfully all my ratings into Rhythmbox. Now, the only work that I need to do is create again the smart play lists, that is nothing compared with my entire libray ratings.
Today I had the same issue wanting to complile the new GIMP 2.9.4 beta on OSX 10.8 and the aid of homebrew.
First install perl
brew install perl
Then the XML::Parser module by going into the perl shell with
perl -MCPAN -e shell
And inside the shell install XML::Parser by typing
install XML::Parser
Exit shell
exit
Now, verify it has been installed successfully. If everything is ok, you will not see an error.
perl -e "require XML::Parser"
If the ./configure still fails missing XML::Parser, then intltools is not using the perl you have installed. Looking at the script tells me it does the test with $INTLTOOL_PERL -e "require XML::Parser". Trying a echo $INTLTOOL_PERL gave out nothing, so the magic is to set it with
export $INTLTOOL_PERL=perl
Now run ./configure again.
None of the above methods worked for me. I had the right environment variables setup but they were somehow not picked up by cpanm that I use to install perl modules. Expat was also installed.
Here is what I did to overcome the same problem that OP is reporting.
This is very close to what #LadyBuzz suggested.
Download the XML::Parser from cpan.org
Extract the tarball into directory and descend to it.
Open the Makefile.pl and edit the first lines to actually have the absolute paths to both: EXPATLIBPATH and EXPATINCPATH
Save the Makefile.pl, go up one level and create a new tarball with the Makefile.pl that you just edited.
Execute cpanm on the newly created tarball.
This resulted in successful installation of the module.

Why can't I install DBD::mysql so I can use it with Maatkit?

I'm trying to install Maatkit following the maatkit instructions. I can't get past having to install DBD::mysql. "Warning: prerequisite DBD::mysql 1 not found."
When I try to install DBD::mysql from cpan, I get very helpful "make had returned bad status, install seems impossible".
Perl is "v5.8.8 built for darwin-thread-multi-2level", the one that came with OS X. I also tried building from source with same result.
We need more of the error message. Most likely, you are missing the MySQL client development files. I don't know how to install these on OSX. Also see this older post on OSX 10.5.2 , in which some other failures with the mysql client libraries are found.
Possibly post this question with more parts of your error message at perlmonks.org, if stackoverflow doesn't allow for convenient pasting of your make session or rather the last 20 or 10 lines of it.
Some more Googling with site:perlmonks.org also finds this post which has some more details on things to watch out for when installing DBD::MySQL. Depending on how comfortable you feel with the installation, you might want to manually run the tests, supplying a test database and test user or even skip testing the module.
After a bit more googling, this worked for me:
sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
sudo ln -s /usr/local/mysql/include /usr/local/mysql/include/mysql
sudo perl -MCPAN -e 'install Bundle::DBD::mysql'
press enter a bunch of times, then in your maatkit folder:
perl Makefile.PL
sudo make install
and you'll find the mk-* programs in /usr/local/bin/
You will want to install MySQL first. I usually use the binary packages they provide for OS X. The packages do include the headers and MySQL client libraries which DBD::MySQL requires. Once the MySQL package is installed, DBD::MySQL should install without issue.
Here is my output:
$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Warning: prerequisite DBD::mysql 1 not found.
Writing Makefile for maatkit
$ mysql --version
mysql Ver 14.12 Distrib 5.0.51b, for apple-darwin9.0.0b5 (i686) using readline 5.0
I notice that there are in effect DBD::MySQL packages in the fink repositories. For example:
ayaz#ayazs-macbook$ fink list | grep -i 'dbd-mysql'
dbd-mysql-pm586 3.0008-10 Perl5 Database Interface to MySQL
dbd-mysql-pm588 3.0008-10 Perl5 Database Interface to MySQL
Perhaps installing through fink one of those packages may help alleviate your troubles.
Also, and I cannot be certain of this, you may want to install for MySQL-5.x (if you have that version installed) the mysql15-dev and mysql15-shlibs packages. I installed those through fink thus:
$ sudo fink --use-binary-dist install mysql15-dev