Cannot install Date::Calc perl module - perl

I'm running Solaris on my machine and I would need to install the Date::Calc perl module in order for one of my scripts to work.
When I run the following command:
sudo perl -MCPAN -e 'install Date::Calc'
I get the following error:
Tests succeeded but one dependency not OK (Bit::Vector)
STBEY/Date-Calc-6.3.tar.gz
[dependencies] -- NA
Running make install
make test had returned bad status, won't install without force
I have no prior experience in Perl development, so I have no clue about what the error might be or where to get more information.
What should I do to fix this?
When trying to install Bit::Vector first, i.e. when running the following command:
sudo perl -MCPAN -e 'install Bit::Vector'
i get the following error message:
Checking if your kit is complete...
Looks good
Writing Makefile for Bit::Vector
Writing patchlevel.h for /usr/bin/perl (5.012003)
cp lib/Bit/Vector/Overload.pm blib/lib/Bit/Vector/Overload.pm
cp Vector.pm blib/lib/Bit/Vector.pm
cp Vector.pod blib/lib/Bit/Vector.pod
cp lib/Bit/Vector/Overload.pod blib/lib/Bit/Vector/Overload.pod
cp lib/Bit/Vector/String.pod blib/lib/Bit/Vector/String.pod
cp lib/Bit/Vector/String.pm blib/lib/Bit/Vector/String.pm
cc -c -DPTR_IS_LONG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV -xO4 -DVERSION=\"7.2\" -DXS_VERSION=\"7.2\" -KPIC "-I/usr/perl5/5.12/lib/i86pc-solaris-64int/CORE" BitVector.c
sh: line 1: cc: not found
*** Error code 127
make: Fatal error: Command failed for target `BitVector.o'
STBEY/Bit-Vector-7.2.tar.gz
/usr/bin/make -- NOT OK
'YAML' not installed, will not store persistent state
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
I installed gcc via the following commands (as adviced here):
pkg install gcc-45
pkg install system/header
but I still get the same error when trying to install Bit::Vector. Indeed, when I type cc on the command-line, I get the command not found error. When I type gcc, however, I get gcc: no input files.

The error means that Bit::Vector (a dependency of Date::Calc) failed to install for some reason. Bit::Vector requires compiling C code, which means your CPAN configuration will need access to the C compiler and libraries (and headers) that were used to build your perl.
From what I understand, that can sometimes be painful on Solaris.
If you have another C compiler available, you might consider building and installing a local Perl using perlbrew.

So it turns out that the only option is to install the Oracle Solaris Studio prior to installation of new perl modules which need to compile C code.
From a related discussion at Oracle Solaris forum:
CC modification in /usr/perl5/5.12/lib/i86pc-solaris-64int/Config.pm
will not resolve the compilation issue. New errors will be produced
and some part will not use this variable.
By default, this method to build modules will use perl compiled
options. And in this case, as we used Oracle Studio, this software
will be required because some options are not available with gcc.
I tried with Oracle Studio, and the compilation was done successfully.
If you want to use gcc, then this will be very tricky to modify
several perl config files. An another method is to compile manually
each necessary modules after you customize each Makefile.

Related

Issue while installing DBI Perl module via CPAN prompt on Solaris 11

I am getting error "sh: cc: not found" when I try to install DBI module from CPAN prompt. Is there any way to resolve this? I have already installed gcc compiler from gnu site.
$ which gcc
/bin/gcc
$
and environment variable is already set like this cc=gcc
But, still I got this error:
cc -c -I/usr/gnu/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV -xO3 -DVERSION=\"1.643\" -DXS_VERSION=\"1.643\" -KPIC "-I/usr/perl5/5.12/lib/sun4-solaris-64int/CORE" -DDBI_NO_THREADS Perl.c
sh: cc: not found
*** Error code 127
make: Fatal error: Command failed for target `Perl.o'
Current working directory /root/.cpan/build/DBI-1.643-2
TIMB/DBI-1.643.tar.gz
/usr/bin/make -- NOT OK
Failed during this command:
TIMB/DBI-1.643.tar.gz : make NO
In order to avoid any binary incompatibilities, Perl expects all C code to be compiled with the same compiler as was used to build Perl itself. It looks like you're using the standard Solaris installation of Perl. That will have been built with the Solaris C compiler, not with gcc (you can check by running perl -V:cc).
So you're going to need the Solaris C compiler installed in order to install any CPAN modules that require C code to be compiled.
It's been years (decades probably) since I used Solaris. Is there no standardised package repository that you can use to install extra packages - something like RedHat's rpm?

Circos error: REQUIRED MODULE IS MISSING

I clearly have Clone in my list of Perl modules. Why am I getting this error?
I am running Perl 5.16 on Mac OS X v10.8 (Mountain Lion).
lraven$ cat run.out
*** REQUIRED MODULE IS MISSING ***
You are missing the Perl module Clone. Use CPAN to install it as described in this tutorial
http://www.circos.ca/documentation/tutorials/configuration/perl_and_modules
lraven$ instmodsh
Installed modules are:
App::cpanminus
Bundle::NetSNMP
Clone
Config::General
DBI
ExtUtils::MakeMaker
...
I have tried re-installing from a .tar file, but I get the error:
dyld: lazy symbol binding failed: Symbol not found: _Perl_Gthr_key_ptr
There are many questions online about this error, but few solutions...
I was getting the same error. Finally got things to work using the command.
sudo perl -MCPAN -e 'install Clone'
You may encounter some additional errors from missing Perl modules. In a few cases I could only install libraries from within the shell. These were (Font:TTF and Text::Format)
I installed these by running
sudo perl -MCPAN -e shell
>install Font:TTF
>install Text::Format

Desperately in need of help compiling Font::FreeType CPAN module with Strawberry Perl

For literally days now, I have been scouring the web, and cursing and tearing my hair out, trying to compile Font::FreeType with dmake for dwimperl-5.14.2.1-v7-32bit (Strawberry Perl 5.14.2.1). For openers, there are several bugs in the FreeType.xs file for which I found a patch at Bug #32713 for Font-FreeType: patch for Font-FreeType-0.03. Lovely. The last update for this module is 11 Sep 2004 (note the day) so it is dead for sure, but I need it for using REAL fonts with perlcairo. So I am determined (desperate) to get it working. So far I have had no problems using cpan with the exception of this module. In fact Strawberry Perl is the only Windows perl I have used that actually works right out of the box with CPAN. This is obviously a rogue module. Even *nix users have had problems with it.
I read How do I fix Perl's Font::FreeType compilation errors? but no help there so I think a new thread is justified.
Number found where operator expected at Makefile.PL line 17, near "my $font_filename = catfile($data_dir, '5"
(Might be a runaway multi-line '' string starting on line 9)
(Do you need to predeclare my?)
Makefile.pl:
1 use ExtUtils::MakeMaker;
2 use File::Spec::Functions;
3
4 WriteMakefile(
5 NAME => 'Font::FreeType',
6 AUTHOR => 'Geoff Richards <qef#laxan.com>',
7 VERSION_FROM => 'lib/Font/FreeType.pm',
8 LIBS => [ '-lfreetype' ],
9 INC => '-I/usr/include/freetype2',
10 NO_META => 1,
11 );
12
13
14 # Generate a listing of the characters in the BDF test font, for checking
15 # that the library can find them all. See t/10metrics_5x7bdf.t
16 my $data_dir = catdir(qw( t data ));
17 my $font_filename = catfile($data_dir, '5x7.bdf');
This runs just fine using perl so what is dmake's problem? If I just run it with perl, dmake will re-run it. I can't figure out how to get dmake to just use what's there and I find no REAL documenation on dmake, just the useless help and man page (at least useless to me).
I tried adding a trailing slash to $data_dir but same error. Finally I just set $font_filename to the complete path. Crude, I know, but it works.
So this now creates FreeType.c but now there are path problems:
gcc -c -I/usr/include/freetype2 -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields -s -O2 -DVERSION=\"0.03\" -DXS_VERSION=\"0.03\" "-IC:\Dwimperl\perl\lib\CORE" FreeType.c
FreeType.xs:19:22: fatal error: ft2build.h: No such file or directory
FreeType.c contains:
#include <ft2build.h>
#include FT_FREETYPE_H
I tried changing include paths in Makefile.pl but I really don't know the "proper" way to do that:
WriteMakefile(
.
LIBS => '-LC:/gtk/lib -lfreetype',
INC => '-IC:/gtk/include/freetype2 -IC:/gtk/include -IC:/Dwimperl/c/include',
I think now the problem is converting *nix paths to Windows ones so the compiler can find all the header files. Has anyone successfully compiled this damned module in Windows using ANY compiler? Or does anyone at least know how to specify the Windows paths for WriteMakefile?
I was also trying to get the latest FreeType module to install on cygwin using cpan like so:
$ cpan
cpan shell -- CPAN exploration and modules installation (v1.9800)
Enter 'h' for help.
cpan[1]> install Font::FreeType
The first issue I ran into was during the make phase. Make was complaining about not being able to find ft2build.h.
It's then that I realized I had to download and compile/install the FreeType library first (doh!). So, I downloaded the latest from the FreeType download page, and installed it like so:
$ cd cygwin/freetype-2.4.0
$ ./configure
...
$ make
...
$ make install
The next issue is that when I tried to make the module in cpan again, it was failing at the following line in ft2build.h:
#include <freetype/config/ftheader.h>
If you take a look at the actual file (in /usr/local/include/ft2build.h on my system, but it may be somewhere else on yours) you will see this comment before that line:
/* `<prefix>/include/freetype2' must be in your current inclusion path */
So, I set the appropriate environment variable (The "proper" way, I believe -- better than modifying the "INC" line in the make file):
$ C_INCLUDE_PATH=/usr/local/include/freetype2
$ export C_INCLUDE_PATH
After fixing that, the next problem I ran into is the lvalue error:
$ cpan install Font::FreeType
CPAN: Storable loaded ok (v2.27)
...
FreeType.xs:808:21: error: lvalue required as left operand of assignment
...
Makefile:340: recipe for target `FreeType.o' failed
make: *** [FreeType.o] Error 1
GEOFFR/Font-FreeType-0.03.tar.gz
/usr/bin/make -- NOT OK
CPAN: YAML loaded ok (v0.84)
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
I know you've already fixed that, but I'll post the info here in case someone else runs into it. Save the patch file from here to FreeType.xs.diff (Your Font-FreeType-0.03 directory may be named differently), apply it, and make/compile like below. Note that since we modified the module we can't use cpan anymore, thus we make it manually:
$ cd ~/.cpan/build/Font-FreeType-0.03
$ patch FreeType.xs FreeType.xs.diff
patching file FreeType.xs
$ make
Makefile out-of-date with respect to Makefile.PL
...
==> Your Makefile has been rebuilt. <==
==> Please rerun the make command. <==
false
Makefile:866: recipe for target `Makefile' failed
make: *** [Makefile] Error 1
$ make
cp lib/Font/FreeType.pm blib/lib/Font/FreeType.pm
...
Manifying blib/man3/Font.FreeType.3pm
$ make install
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
...
Appending installation info to /usr/lib/perl5/5.14/i686-cygwin-threads-64int/perllocal.pod
Voila! It's compiled! Another thing to point out is that I used regular gnu make rather than dmake, as Borodin pointed out earlier. The FreeType install notes say you have to run GNU Make 3.80 or later. You can check what version of make you have installed like this:
$ make -v
GNU Make 3.82.90
Built for i686-pc-cygwin
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

installing perl module Class-Load-XS

I tried to install module Class-Load-XS-0.04 manually. I saw the following error:
$ perl Build.PL
Warning: ExtUtils::CBuilder not installed or no compiler detected
Proceeding with configuration, but compilation may fail during Build
However, the execution of perl -e 'use ExtUtils::CBuilder' was perfectly fine. I even tried to re-install ExtUtils::CBuilder, but it still does not work.
Could you please help?
I tried on my Win 7 machine, and it shows some warnings like this when I do perl Build.pl:
collect2: ld returned 1 exit status
Checking prerequisites...
requires:
! Class::Load is not installed
build_requires:
! Class::Load is not installed
! Module::Implementation is not installed
! Test::Fatal is not installed
! Test::Requires is not installed
ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions
of the modules indicated above before proceeding with this installation
Then I installed the above mentioned modules, and things went fine then.
You may try install these modules first.
Hope it helps.
It looks to me like you don't have a compiler. Try this:
perl -e 'use ExtUtils::CBuilder; $cb = ExtUtils::CBuilder->new; print $cb->have_compiler ? "have\n" : "dont have\n";'
Can I guess that you are on Windows using ActiveState Perl? If so perhaps try Strawberry Perl which comes with a compiler.
Had a similar problem installing a different module (Win32::Mutex). This isn't a great fix, but it got the job done. From the build directory (e.g., ~/.cpan/build/The-Module-mYyzLx)
First, set the CC environment variable yourself
SET CC=C:\strawberry\c\bin\g++.exe [Windows]
export CC=/usr/bin/g++.exe [Cygwin]
and try to build (perl Build.PL, perl Build, ...). If it is still complaining about missing programs (g++, dlltool, etc.):
Second, copy pieces of your tool chain into the build directory
COPY C:\strawberry\c\bin\g++.exe . [Windows]
COPY C:\strawberry\c\bin\dlltool.exe .
cp /usr/bin/g++ . [Cygwin]
cp /usr/bin/dlltool .
If the build still complains about missing programs, copy those to your build directory too.
The fix and the symptoms are consistent with ExtUtils::CBuilder not being able to use the current PATH setting, though I have no idea what that would be so difficult.
I'd suggest installing these first:
apt-get install libc6-dev
and
apt-get install libtest-exception-perl
By the way you describe the problem it looks like you have these two perl modules missing. On the other hand it takes just a couple of seconds to double-check if those are installed, but these 'seconds' could help you save on a lot of head ache.

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.