How can I install XML::LibXML on Ubuntu - perl

Here is the stdout for install:
$sudo cpanm XML::LibXML
--> Working on XML::LibXML
Fetching http://www.cpan.org/authors/id/S/SH/SHLOMIF/XML-LibXML-2.0014.tar.gz ... OK
Configuring XML-LibXML-2.0014 ... N/A
! Configure failed for XML-LibXML-2.0014. See /home/kahmed/.cpanm/build.log for details.
details:
Unpacking XML-LibXML-2.0014.tar.gz
Entering XML-LibXML-2.0014
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.55_02)
Configuring XML-LibXML-2.0014
Running Makefile.PL
enable native perl UTF8
running xml2-config...ok (2.9.0)
Checking for ability to link against xml2...no
Checking for ability to link against libxml2...libxml2, zlib, and/or the Math library (-lm) have not been found.
Try setting LIBS and INC values on the command line
Or get libxml2 from
http://xmlsoft.org/
If you install via RPMs, make sure you also install the -devel
RPMs, as this is where the headers (.h files) are.
Also, you may try to run perl Makefile.PL with the DEBUG=1 parameter
to see the exact reason why the detection of libxml2 installation
failed or why Makefile.PL was not able to compile a test program.
-> N/A
-> FAIL Configure failed for XML-LibXML-2.0014. See /home/kahmed/.cpanm/build.log for details.
i tried installing libxml2 manually, but still getting the same issue.
also, i checked for libxml2-dev:
sudo apt-get install libxml2-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libxml2-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 78 not upgraded.
here is the system info:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.04
Release: 11.04
Codename: natty
uname -a
Linux autobot 2.6.38-8-server #42-Ubuntu SMP Mon Apr 11 03:49:04 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

I think the relevant line is:
Checking for ability to link against libxml2...libxml2, zlib, and/or the Math library (-lm) have not been found.
So, you've covered off libxml. Have you installed the appropriate zlib package? Try:
sudo apt-get install zlib1g-dev
Then try installing XML::LibXML again.

Why do you want to use CPAN for this anyway? It is typically very bad idea to install CPAN packages if you have native packages provided by standard operating system installer.
Ubuntu provides a lot of Perl packages natively, with following naming convention: package name always starts with lib, then Perl package name like XML::LibXML is converted to lower case and :: replaced to dash - (XML::LibXML => xml-libxml), and finally -perl suffix is added. In other words, native package name for XML::LibXML would be libxml-libxml-perl.
So, in your case, you simply run this command and it will pull all necessary dependencies automatically:
sudo apt-get install libxml-libxml-perl
If you don't like this package for any reason you can uninstall it with sudo apt-get remove. If you use CPAN, it is very difficult to uninstall it reliably.

Overlooked the obvious:
sudo apt-get install --reinstall zlibc zlib1g zlib1g-dev
then:
sudo cpanm XML::LibXML
works!

Maybe this is new version. I did:
sudo apt-get install libxml2-dev
After this module builded and installed successfully

Related

Mac M1 Homebrew Perl Carton Net::SSLeay is loading libcrypto in an unsafe way

I'm trying to install Net::SSLeay with Carton.
The installation fails with this message
Configuring Net-SSLeay-1.90 Running Makefile.PL Do you want to run external tests?
These tests *will* *fail* if you do not have network connectivity. [n] n
*** Found LibreSSL-2.8.3 installed in /usr
*** Be sure to use the same compiler and options to compile your OpenSSL, perl, and Net::SSLeay. Mixing and matching compilers is not supported.
Checking if your kit is complete... Looks good
WARNING: /opt/homebrew/Cellar/perl/5.32.1_1/bin/perl is loading libcrypto in an unsafe way -> N/A
I've tried this with system perl, brew perl and multiple perlbrew perls.
Google came up with a temp solution to build homebrew using x86_64 architecture.
This did work for the libcrypto error, but gave me a whole different set of issues including mysql not running anymore.
Other "solutions" that I've tried are symlinking libssl & libcrypto as suggested by numerous other posts, all sadly without success.
Any ideas how to fix this or work around this without having to reinstall all brew packages as x86_64 ?
Quick Workaround
If you are looking for a quick workaround follow these steps.
Run carton bundle to create a vendor cache directory.
Go to cached tarball 'cache/authors/id/C/CH/CHRISN/' and unpack tar -xvzf Net-SSLeay-1.90.tar.gz
Edit Makefile.PL, change my $prefix = find_openssl_prefix(); to
my $prefix = '/opt/homebrew/opt/openssl#1.1'; ** adjust to your openssl location.
Save and create new tarball tar -czvf Net-SSLeay-1.90.tar.gz Net-SSLeay-1.90
Run carton install --cached to use the altered version
Hope this helps anyone in search of workaround
You can solve this in two steps:
upgrade ExtUtils::MakeMaker to at least version 7.58 (e.g. cpanm ExtUtils::MakeMaker)
install openssl via macports (sudo port install openssl) or homebrew (brew install --cask openssl)
After the Monterey update this broke again also on the x86_64 architecture, but just symlinking your latest openssl (where ever it is, depending how you have installed it) seemed to fix this. Example:
$ export OPENSSL_PREFIX=[find your openssl installation]
$ sudo ln -s $OPENSSL_PREFIX/lib/libssl.dylib /usr/local/lib/
$ sudo ln -s $OPENSSL_PREFIX/lib/libcrypto.dylib /usr/local/lib/
Better workaround:
I entered export OPENSSL_PREFIX=/opt/homebrew/opt/openssl#1.1 in my shell and then ran cpan. I checked the code in Makefile.PL and the first thing the function find_openssl_prefix does is to check the OPENSSL_PREFIX environment variable. If it is set, then it the function will return its contents.
Add the variable to your .profile, .cshrc, .bashrc, .zshrc, or whatever rc file your shell uses and you never have to worry about it again!!

Redhat Linux 6.5 Perl GD CPAN Module yum

when i try to install "GD" (perl -e shell -MCPAN ->(next step) cpan[1]> install GD) on Redhat 6.5 i got the error:
->
CPAN.pm: Building L/LD/LDS/GD-2.53.tar.gz
UNRECOVERABLE ERROR
Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.
If you want to try to compile anyway, please rerun this script with the option --ignore_missing_gd.
Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
CPAN: YAML loaded ok (v0.90)
LDS/GD-2.53.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- 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
Failed during this command:
LDS/GD-2.53.tar.gz : writemakefile NO '/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status 512
<-
I tryed to install "libgd 2.0.28 or higher" but don't find this in "yum".
locate libgd (shows):
/usr/lib64/libgd.so.2
/usr/lib64/libgd.so.2.0.0
Does anyone know an advice?
Many perl modules are available already built and packaged for RHEL and derivatives such as CentOS. In the case of perl-GD, it seems it is available in the CentOS in the base repo even though it is not in the RHEL repo.
However you can still use the Centos repo by adding it to your yum configuration. Create a file /etc/yum.repos.d/cantos.repo containing:
[centos]
name=CentOS $releasever - $basearch
baseurl=http://mirror.centos.org/centos-6/6/os/$basearch/
enabled=0
gpgcheck=0
After which you should be able to install perl-GD
yum install --enablerepo centos perl-GD
It looks as though the current version of perl-GD for centos is 2.44.
If you do need a newer version that that, you will either need to find a 3rd party yum repo which has the later version of libgd available, or compile it from source. In a quick google I could not find the former, so I would recommend you download the latest source package and install that.
You need the package gd-devel then rebuild the GD module.

Linux: How to install DBD::Pg module?

Postgres DB is already installed. I'm not using system perl I have installed another perl in "/srv/data203806/Migration/CPAN/localperl/bin". When I'm trying to install, It is asking for PATH TO pg_config:
[root1#frmrszvwb023 bin]# ./cpan install DBD::Pg
Reading '/root/.cpan/Metadata'
Database was generated on Fri, 07 Mar 2014 03:53:02 GMT
Running install for module 'DBD::Pg'
Running make for T/TU/TURNSTEP/DBD-Pg-3.0.0.tar.gz
Checksum for /root/.cpan/sources/authors/id/T/TU/TURNSTEP/DBD-Pg-3.0.0.tar.gz ok
CPAN.pm: Building T/TU/TURNSTEP/DBD-Pg-3.0.0.tar.gz
Configuring DBD::Pg 3.0.0
Path to pg_config?
No POSTGRES_HOME defined, cannot find automatically
Warning: No success on command[/srv/data203806/MUXmh-Migration/CPAN/localperl/bin/perl Makefile.PL]
'YAML' not installed, will not store persistent state
TURNSTEP/DBD-Pg-3.0.0.tar.gz
/srv/data203806/MUXmh-Migration/CPAN/localperl/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
Please help me to install DBD::Pg? How to get path to pg_config?
Just ran into this issue, and on Ubuntu 16.04 Xenial the package you're looking for is:
apt-get install libdbd-pg-perl
You have to install libpq-dev, e.g. on Ubuntu:
sudo apt-get install libpq-dev
On CentOS/RH you can fix it by installing perl-DBD-Pg package with yum
sudo yum install perl-DBD-Pg
From the README:
INSTALLATION:
Before installing, please use the "cpansign -v" program to
cryptographically verify that your copy of DBD::Pg is complete and
valid. The program "cpansign" is part of Module::Signature, available
from CPAN.
By default Makefile.PL uses App::Info to find the location of the
PostgreSQL library and include directories. However, if you want to
control it yourself, define the environment variables POSTGRES_INCLUDE
and POSTGRES_LIB, or define just POSTGRES_HOME. Note that if you have
compiled PostgreSQL with SSL support, you must define the POSTGRES_LIB
environment variable and add "-lssl" and "-lcrypto" to it, like this:
export POSTGRES_LIB="/usr/local/pgsql/lib -lssl -lcrypto"
The usual steps to install DBD::Pg:
perl Makefile.PL
make
make test
make install
Do steps 1 to 2 as a normal user, not as root!
If the script cannot find the pg_config information itself, it will
ask you for the path to it. Enter the complete path to the pg_config
file here, including the name of the file itself.
If you want to use a module, read the documentation.
Before installing perl module, you must install client for accessing Postgres DB. I just install server and header files:
sudo apt-get install postgresql
sudo apt-get install libpq-dev
You can try:
locate pg_config
This will show something like:
/usr/pgsql-10/bin/pg_config
/usr/pgsql-10/include/ecpg_config.h
/usr/pgsql-10/include/ecpg_config_x86_64.h
Then run:
POSTGRES_HOME=/usr/pgsql-10 ./cpan install DBD::Pg
UPD
If you still encounter issues with pg_config, you may need to add it to your PATH, e.g.:
export PATH=$PATH:/usr/pgsql-x.x/bin
where x.x is your version, such as /usr/pgsql-9.2./bin.
Fedora 29, plenv, perl v5.18.0
Once I got plenv working, I was able to install DBD::Pg with cpanm using these commands:
sudo dnf install postgresql postgresql-devel
cpanm --quiet --notest DBD::Pg
For ArchLinux (or any Distro using Pacman):
pacman -S perl-dbd-pg
For my Ubuntu 22 worked this:
sudo apt install build-essential
sudo apt install cpanminus
sudo apt-get install -y postgresql-server-dev-all
sudo cpanm DBD::Pg

Cannot install perl module Apache2::Const in ubuntu

I am having problem with installing perl module Apache2::Const.
When i am trying to install it using cpan.pm it shows the following error
Warning: Cannot install Apache2::Const, don't know what it is.
I am using Ubuntu 12.04, Apache/2.2.22 ,Perl 5.14.
Apache2::Const is part of mod_perl.
If you are using the ubuntu-provided apache, you probably just want to:
sudo apt-get install libapache2-mod-perl2
Looking at this website
http://ubuntuforums.org/archive/index.php/t-1747708.html
try:
apt-get install apache2-mpm-prefork
I just spent an hour on the exact same problem on Ubuntu 12.04, and finally figured it out. I had already installed libapache2-mod-perl2 :
$ sudo apt-get install libapache2-mod-perl2
Reading package lists... Done
Building dependency tree
Reading state information... Done
libapache2-mod-perl2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Nonetheless, I kept getting the same error when I tried to install the Apache2::Const module via cpan:
$ cpan Apache2::Const
Going to read '/home/jdoe/.cpan/Metadata'
Database was generated on Sun, 27 Apr 2014 08:29:02 GMT
Warning: Cannot install Apache2::Const, don't know what it is.
Try the command
i /Apache2::Const/
to find objects with matching identifiers.
I finally figured out that Apache2::Const is already installed (in binary I suppose) when libapache2-mod-perl2 is installed:
$ perl -MApache2::Const < /dev/null
$
Therefore Apache2::Const is not supposed to be installed using cpan.

Getting WebKit bindings to work with Perl and gkt2

I need to use WebKit in my perl + gtk2 application. Found a package Gtk2::WebKit on CPAN, but can't get it working.
cpan> install Gtk2::WebKit
gives following output:
Package webkit-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `webkit-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'webkit-1.0' found
at inc/Module/Install/PRIVATE/WebKit.pm line 24
*** can not find package webkit-1.0
*** check that it is properly installed and available in PKG_CONFIG_PATH
at inc/Module/Install/PRIVATE/WebKit.pm line 24
No 'Makefile' created'YAML' not installed, will not store persistent state
FLORA/Gtk2-WebKit-0.09.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Failed during this command:
FLORA/Gtk2-WebKit-0.09.tar.gz : writemakefile NO -- No 'Makefile' created
It looks as if cpan wasn't able to find webkit, but I'm not sure how to fix that (my first time using perl and cpan).
Env: perl 5.12.4, ubuntu 11.10
Install libwebkitgtk-devel: sudo apt-get install libwebkitgtk-devel.
sudo apt-get install libwebkitgtk-dev
For Debian/Ubuntu and similar, the package name to install is libwebkitgtk-dev.
For OpenSuse and other RPM-based systems, the package name is libwebkitgtk-devel.