Perl CSV_XS module installation failed using Cygwin - perl

I am having problems installed a CPAN module Text::CSV_XS using Cygwin.
I did a
$ cpan Text::CSV_XS
CPAN: Storable loaded ok (v2.20)
.... Every was good till:.....
Writing Makefile for Text::CSV_XS
cp CSV_XS.pm blib/lib/Text/CSV_XS.pm
/usr/bin/perl.exe /usr/lib/perl5/5.10/ExtUtils/xsubpp -typemap /usr/lib/perl5/5 .10/ExtUtils/typemap CSV_XS.xs > CSV_XS.xsc && mv CSV_XS.xsc CSV_XS.c
gcc-4 -c -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -g3 -fno-strict-aliasing -p ipe -fstack-protector -I/usr/local/include -DUSEIMPORTLIB -O3 -DVERSION=\"0.8 8\" -DXS_VERSION=\"0.88\" "-I/usr/lib/perl5/5.10/i686-cygwin/CORE" CSV_XS.c
/bin/sh: gcc-4: command not found
Makefile:330: recipe for target `CSV_XS.o' failed
make: *** [CSV_XS.o] Error 127
HMBRAND/Text-CSV_XS-0.88.tgz
make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
I installed another module earlier, without problem.
Make is installed
gcc is installed
/bin/sh returns a new shell.
$ /bin/sh
$

Important note: as of this writing, gcc4 is now in the obsolete packages section which is hidden by default in the Cygwin installer.

Fire up the Cygwin packagre manager (setup.exe) and install gcc4. Use the search facility to locate the package in the manager. While you're at it, also install make, autoconf and automake. You'll find all these packages in the devel section.
Then retry, it will succeed, I just tested it:
MiLu#Dago: ~ > cpan Text::CSV_XS
...
Installing /usr/lib/perl5/site_perl/5.10/i686-cygwin/auto/Text/CSV_XS/CSV_XS.bs
Installing /usr/lib/perl5/site_perl/5.10/i686-cygwin/auto/Text/CSV_XS/CSV_XS.dll
Installing /usr/lib/perl5/site_perl/5.10/i686-cygwin/Text/CSV_XS.pm
Installing /usr/share/man/man3/Text.CSV_XS.3pm
Appending installation info to /usr/lib/perl5/5.10/i686-cygwin/perllocal.pod
HMBRAND/Text-CSV_XS-0.88.tgz
/usr/bin/make install -- OK

Related

can't find version.pm while trying to install DBD-Pg-2.19.3 on Centos-7

On Centos 7.
The oracle DBD installed just fine I am having a problem with the Postgresql version.
This is the script I am running:
set -x -e
sudo yum -y install perl-devel
sudo yum -y install perl-DBI
cp ./DBD* /tmp
pushd /tmp
tar xvf DBD-Oracle-1.52.tar
tar xvf DBD-Pg-2.19.3.tar
pushd DBD-Oracle-1.52
perl Makefile.PL
sudo make
sudo make install
popd
pushd DBD-Pg-2.19.3
perl Makefile.PL
sudo make
sudo make install
the postgresql DBD perl Makefile.PL returns
++ perl Makefile.PL
Configuring DBD::Pg 2.19.3
PostgreSQL version: 90224 (default port: 5432)
POSTGRES_HOME: (not set)
POSTGRES_INCLUDE: /usr/include
POSTGRES_LIB: /usr/lib64
OS: linux
Warning: prerequisite Test::More 0.61 not found.
Warning: prerequisite version 0 not found.
Could not eval '
package ExtUtils::MakeMaker::_version;
no strict;
BEGIN { eval {
# Ensure any version() routine which might have leaked
# into this package has been deleted. Interferes with
# version->import()
undef *version;
require version;
"version"->import;
} }
local $VERSION;
$VERSION=undef;
do {
use version; our $VERSION = qv('2.19.3');
};
$VERSION;
' in Pg.pm: Can't locate version.pm in #INC (#INC contains: t/lib /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 9) line 16, <$fh> line 19.
BEGIN failed--compilation aborted at (eval 9) line 16, <$fh> line 19.
WARNING: Setting VERSION via file 'Pg.pm' failed
at /usr/share/perl5/vendor_perl/ExtUtils/MakeMaker.pm line 619.
Using DBI 1.627 (for perl 5.016003 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/auto/DBI/
Writing Makefile for DBD::Pg
++ sudo make
Skip blib/lib/DBD/testme.tmp.pl (unchanged)
Skip blib/lib/Bundle/DBD/Pg.pm (unchanged)
Skip blib/lib/DBD/Pg.pm (unchanged)
gcc -c -I/usr/include -I/usr/lib64/perl5/vendor_perl/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPGLIBVERSION=90224 -DPGDEFPORT=5432 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc -DVERSION=\"undef\" -DXS_VERSION=\"undef\" -fPIC "-I/usr/lib64/perl5/CORE" Pg.c
In file included from Pg.xs:13:0:
Pg.h:36:22: fatal error: libpq-fe.h: No such file or directory
#include "libpq-fe.h"
^
compilation terminated.
make: *** [Pg.o] Error 1
however locate shows:
/common/oracle/tfa/austin/tfa_home/perl/lib/5.22.0/version.pm
/common/oracle/tfa/austin/tfa_home/perl/lib/5.22.0/ExtUtils/MakeMaker/version.pm
/common/orainst/perl/lib/5.22.0/version.pm
/common/orainst/perl/lib/5.22.0/ExtUtils/MakeMaker/version.pm
/opt/oracle/product/18c/dbhomeXE/perl/lib/5.22.0/version.pm
/opt/oracle/product/18c/dbhomeXE/perl/lib/5.22.0/ExtUtils/MakeMaker/version.pm
You need to install the full Perl core. In CentOS 7 this package is called perl-core, and perl is just the interpreter, not suitable if you actually want to use it yourself. The full Perl been renamed to perl (and the interpreter renamed to perl-interpreter) in recent versions of Fedora.
yum install perl-core
Even better is to build your own Perl, so that you can install things into it as you need without messing with the system Perl that may be used by other things and not expect these updates. If you stick to using the system Perl, it's recommended to isolate any modules you install without the package manager using a local::lib or Carton.
It looks like you already have a separate build of Perl, as those paths containing 5.22.0 are not from the system perl in CentOS 7. This installation of Perl will not be managed or related to anything you install with yum unless it's from an Oracle repository. The correct way to install modules that can handle the dependencies for that module is with the cpan client, or other clients like cpanm. Just make sure to run the executable for the Perl you want to install modules into and use.
This is the (current) problem prerequisite Test::More 0.61 not found.
This is the solution https://superuser.com/a/1111321/156111
"
yum install make cpan
Then configure your perl with CPAN. Just enter cpan in the command prompt and answer yes to all interactive questions.
Then update you cpan manager:
#cpan install Bundle::CPAN
#cpan reload cpan
And now install packages of your interest:
#cpan install Test::More
"
If you're happy using the system Perl and its associated Perl library (as you seem to be as you're running yum install perl-DBI) then you can use the pre-packaged version of DBD::Pg.
sudo yum install perl-DBD-Pg
And this will automatically pull in any other RPMs that are required.
DBD::Oracle is harder. A pre-built package is not available (presumably, because Oracle is not open source), but you could probably build your own RPM following the method I described a few years ago. You will need to ensure that the Oracle client libraries (and their associated header files) are already installed.
set -x -e
sudo yum -y install perl-devel
sudo yum -y install perl-DBI
sudo yum -y install perl-version perl-Data-Dumper
sudo yum -y install postgresql-devel
cp ./DBD* /tmp
pushd /tmp
tar xvf DBD-Oracle-1.52.tar
tar xvf DBD-Pg-2.19.3.tar
pushd DBD-Oracle-1.52
perl Makefile.PL
sudo make
sudo make install
popd
pushd DBD-Pg-2.19.3
perl Makefile.PL
sudo make
sudo make install
cd ~/ora2pg
perl Make.PL
sudo make
sudo make install

Can't install XML::Simple on Perlbrew

I'm trying to install XML::Simple under Perlbrew but am hitting an error that seems like it requires root access to fix. However, the whole purpose of using perlbrew (or one of them, at least) is to disassociate your perl environment from the OS installed perl version.
I've installed perlbrew (5.10.1, legacy code requirement) and several modules. It is currently functioning as expected. However, I get an error when trying to install XML::Simple.
$ cpanm XML::Simple
--> Working on XML::Simple
Fetching http://www.cpan.org/authors/id/G/GR/GRANTM/XML-Simple-2.25.tar.gz ... OK
Configuring XML-Simple-2.25 ... OK
==> Found dependencies: XML::SAX::Expat
--> Working on XML::SAX::Expat
Fetching http://www.cpan.org/authors/id/B/BJ/BJOERN/XML-SAX-Expat-0.51.tar.gz ... OK
Configuring XML-SAX-Expat-0.51 ... OK
==> Found dependencies: XML::Parser
--> Working on XML::Parser
Fetching http://www.cpan.org/authors/id/T/TO/TODDR/XML-Parser-2.44.tar.gz ... OK
Configuring XML-Parser-2.44 ... OK
Building and testing XML-Parser-2.44 ... FAIL
! Installing XML::Parser failed. See /home/user1/.cpanm/work/1532923694.18203/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Module 'XML::Parser' is not installed
! Bailing out the installation for XML-SAX-Expat-0.51.
! Installing the dependencies failed: Module 'XML::SAX::Expat' is not installed
! Bailing out the installation for XML-Simple-2.25.
$
Here's the output of the log file (cut down to the pertinent part):
cp Expat.pm ../blib/lib/XML/Parser/Expat.pm
Running Mkbootstrap for Expat ()
chmod 644 "Expat.bs"
"/home/user1/perl5/perlbrew/perls/perl-5.10.1/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Expat.bs ../blib/arch/auto/XML/Parser/Expat/Expat.bs 644
"/home/user1/perl5/perlbrew/perls/perl-5.10.1/bin/perl" "/home/user1/perl5/perlbrew/perls/perl-5.10.1/lib/5.10.1/ExtUtils/xsubpp" -noprototypes -typemap '/home/user1/perl5/perlbrew/perls/perl-5.10.1/lib/5.10.1/ExtUtils/typemap' -typemap /home/user1/.cpanm/work/1532923694.18203/XML-Parser-2.44/Expat/typemap' Expat.xs > Expat.xsc
mv Expat.xsc Expat.c
cc -c -m32 -march=i686 -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.44\" -DXS_VERSION=\"2.44\" -fPIC "-I/home/user1/perl5/perlbrew/perls/perl-5.10.1/lib/5.10.1/x86_64-linux/CORE" Expat.c
Expat.xs:12:19: fatal error: expat.h: No such file or directory
#include <expat.h>
^
compilation terminated.
make[1]: *** [Expat.o] Error 1
make[1]: Leaving directory `/home/user1/.cpanm/work/1532923694.18203/XML-Parser-2.44/Expat'
make: *** [subdirs] Error 2
-> FAIL Installing XML::Parser failed. See /home/user1/.cpanm/work/1532923694.18203/build.log for details. Retry with --force to force install it.
-> FAIL Installing the dependencies failed: Module 'XML::Parser' is not installed
-> FAIL Bailing out the installation for XML-SAX-Expat-0.51.
-> FAIL Installing the dependencies failed: Module 'XML::SAX::Expat' is not installed
-> FAIL Bailing out the installation for XML-Simple-2.25.
~
I have tried installing expat locally via:
wget https://sourceforge.net/projects/expat/files/expat/2.2.4/expat-2.2.4.tar.bz2
tar xjf expat-2.2.4.tar.bz2
cd expat-2.2.4
./configure --prefix=/home/user1/perl5/perlbrew/perls/perl-5.10.1/
make
make install
I've verified that expat.h is in ~/perl5/perlbrew/perls/perl-5.10.1/include. I updated my path to include that location.
Every fix I see is to install expat via the operating system tools (for the various flavors).
The issue is that I don't have root access and while I can technically ask the admin to install it, my project requires a solution that doesn't require root access as it will be copied through multiple environments and servers.
Is there a way to install XML::Simple without expat? Or a way to install expat in perlbrew such that XML::Simple will find it and use it?
Install XML::Parser manually and tell ExtUtils::MakeMaker where to find the C libraries. See INC and LIBS.
cpanm --look XML::Parser
PERLPREFIX=/home/user1/perl5/perlbrew/perls/perl-5.10.1/
perl Makefile.PL INC=-I$PERLPREFIX/include LIBS=-L$PERLPREFIX/lib
make && make test && make install
If you use cpan instead of cpanm, you can make this hands-off and permanent. Set the option makepl_arg, e.g. by running at the CPAN shell prompt):
o conf makepl_arg "INC=-I/home/user1/perl5/perlbrew/perls/perl-5.10.1/include LIBS=-L/home/user1/perl5/perlbrew/perls/perl-5.10.1/lib"
o conf commit
P.S. expat 2.2.5 is out

Perl error while installing XML::LibXSLT

I am installing Perl module XML::LibXSLT, and I am getting the errors shown below.
Writing Makefile for XML::LibXSLT
Writing MYMETA.yml and MYMETA.json
cp LibXSLT.pm blib\lib\XML\LibXSLT.pm
E:\Perl\bin\perl.exe E:\Perl\lib\ExtUtils\xsubpp -typemap E:\Perl\lib\ExtUtils\
typemap -typemap typemap LibXSLT.xs > LibXSLT.xsc && E:\Perl\bin\perl.exe -MExt
Utils::Command -e mv -- LibXSLT.xsc LibXSLT.c
E:\Perl\site\bin\gcc.exe -c -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64
-DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTE
XT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DHASATTRIBUTE -fno-strict-aliasing -mms-bit
fields -O2 -DVERSION=\"1.81\" -DXS_VERSION=\"1.81\" "-IE:\Perl\lib\CO
RE" -DHAVE_BLANK -DHAVE_BLANK -DHAVE_EXSLT LibXSLT.c
LibXSLT.xs:12:32: fatal error: libxslt/xsltconfig.h: No such file or directory
compilation terminated.
dmake.exe: Error code 129, while making 'LibXSLT.o'
SHLOMIF/XML-LibXSLT-1.81.tar.gz
E:\Perl\site\bin\dmake.exe -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Any idea to how to rectify this. Please let me know.
Actaully, I am installing this by using
perl -MCPAN -e "CPAN::Shell->force(qw(install XML::LibXSLT));
So, it is getting 'XML-LibXSLT-1.81.tar.gz' automatically and working this with Windows 7.
It would help if you said how you were trying to install the module. Is this cpan or cpanm, or are you doing it manually? It also looks like you're building on a Windows system, is that right?
The immediate problem is that the gcc compiler can't find libxslt/xsltconfig.h. It may be that the download wasn't unpacked correctly, but I see you are trying to build version 1.81 when the latest is 1.82. You should really fetch the latest version before you try to build it.
Sounds like you're missing the headers files for libxslt. Did you install libxslt?
XML::LibXSLT's README:
This module is a fast XSLT library, based on the GNOME libxslt engine
that you can find at http://www.xmlsoft.org/XSLT/
...
A NOTE ON INSTALLATION
The library depends on libxslt. You have to have both the library and
its header files installed (on various Linux/UNIX distributions thay
are usually packaged as libxslt-dev or libxslt-devel). The module can
further make use of libexslt, which is distributed with libxslt, but
on some systems packaged separately. These libraries may have their
own dependencies (usually resolved automatically by the packaging
system).
...

XML::Parser refusing to install

I've been trying to install XML::Simple on Ubuntu 12.10 for the past two hours or so and have officially run out of ideas. It's failing at the XML::Parser.
I've done an
sudo apt-get install expat
and it still did not work. Here's the error I've been getting:
make[1]: Entering directory `/home/<user>/.cpan/build/XML-Parser-2.41-MCLo7T/Expat'
cp Expat.pm ../blib/lib/XML/Parser/Expat.pm
/usr/bin/perl /usr/share/perl/5.14.2/ExtUtils/xsubpp -noprototypes -typemap /usr/share /perl/5.14/ExtUtils/typemap -typemap typemap Expat.xs > Expat.xsc && mv Expat.xsc Expat.c
cc -c -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fstack-protector -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -DVERSION=\"2.41\" -DXS_VERSION=\"2.41\" -fPIC "-I/usr/lib/perl/5.14/CORE" Expat.c
Expat.xs:12:19: fatal error: expat.h: No such file or directory
compilation terminated.
make[1]: *** [Expat.o] Error 1
make[1]: Leaving directory `/home/sclarawu/.cpan/build/XML-Parser-2.41-MCLo7T/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
Seems to be telling me that it's unable to find expat.h, but I'm not sure why or how, considering expat is installed? I tried to apt expat-devel, but it appears not to be a package in apt. Any ideas would be greatly appreciated. :)
EDIT: I seemed to have been simply trying to install the wrong package. -.- It's always the little things. Much thanks to those who answered!
Another way to get to the same information which #Moritz Bunkus has pointed out above.
ubuntu:~$ apt-cache search expat
expat - XML parsing C library - example application
libexpat1 - XML parsing C library - runtime library
libexpat1-dev - XML parsing C library - development kit
The third one in the result set is what you are looking for.
Adding to the other answers, here's how to install the expat dependency on CentOS/RHEL:
yum install expat-devel
You need to install the Expat library and its development headers. For DebUbuntu this means libexpat1-dev as well as those distros often split their libraries into two packages: one for the runtime components (shared libraries, data files, general documentation), one for the development components (static libraries, header files, development documentation).
Just in case, using Debian Jessie I had to install libexpat1-dev by executing apt-get install libexpat1-dev
I only managed to install it by downloading it from cpan and manually editing the Makefile.pl inside to correctly pointing to the EXPATLIBPATH and EXPATINCPATH.
See this post for more detailed instructions.

bugzilla | perl module installation nightmare: no cc, is gcc OK?

I am trying to install Bugzilla. I don't recall it being so difficult. We have a ubuntu server on the cloud, and at first I attempted to install through the rackspace UI. This didn't work, so I ssh'ed in and actually downloaded the tarball to do it the old-fashioned way.
However, it appears there are three perl modules having install problems. I have tried everything I know to get them to install, and am at a loss. I've tried googling for some answers, but I am either not using the correct terminology or this is truly unique to my situation.
The three offending perl modules failing the checksetup.pl:
/usr/bin/perl install-module.pl DateTime
/usr/bin/perl install-module.pl DateTime::TimeZone
/usr/bin/perl install-module.pl Template
When I attempt to install any of them, they fail miserably, apparently because the cc compiler is not installed (see below). When I checked for a cc package under APT, I could only find gcc. Will that be sufficient, and will I need to alias gcc to cc in order for these installs to work?
/usr/bin/perl /usr/local/share/perl/5.10.1/ExtUtils/xsubpp -typemap /usr/share/perl/5.10/ExtUtils/typemap Stash.xs > Stash.xsc && mv Stash.xsc Stash.c
cc -c -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -DVERSION=\"2.22\" -DXS_VERSION=\"2.22\" -fPIC "-I/usr/lib/perl/5.10/CORE" Stash.c
/bin/sh: cc: not found
make[1]: *** [Stash.o] Error 127
make[1]: Leaving directory `/root/.cpan/build/Template-Toolkit-2.22-xzQg_q/xs'
make: *** [subdirs] Error 2
ABW/Template-Toolkit-2.22.tar.gz
/usr/bin/make -- NOT OK
Skipping test because of notest pragma
Running make install
Make had returned bad status, install seems impossible
You shouldn't compile Perl with one compiler (cc) and then compile modules with another compiler or compiler build (gcc) unless you happen to know their compatible. I find it very hard to believe that Ubuntu provided a Perl built with a compiler they don't provide.
Then there's the issue that you're installing unmanaged modules into a distro-managed Perl. That's... less than ideal.
The simplest solution is probably:
apt-get install \
libdatetime-perl \
libdatetime-timezone-perl \
libtemplate-perl
Another solution is to install a local build of Perl, perhaps using perlbrew.
Personally, I never use the system Perl. It's there for the system's needs first (not mine), and that causes problems. In this case, since the distro does provide the packages you need, it should be fine to just install those packages.
Just Install GCC and then Perl.To install the gcc package in the Debian/Ubuntu Linux distribution, enter the following command in a terminal:
> apt-get install gcc make linux-headers-$(uname -r)
I went ahead and installed the gcc package, and the installs completed. Whew. It has been a long time...