PERL : Unicode string : Permission denied [duplicate] - perl

This question already has answers here:
How can I use a new Perl module without install permissions?
(11 answers)
Closed 7 years ago.
I program using Perl and need to install Unicode String. But make install tells me:
Files found in blib/arch: installing files in blib/lib into
architecture dependent library tree
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create
'/Library/Perl/5.16/darwin-thread-multi-2level/Unicode' mkdir
/Library/Perl/5.16/darwin-thread-multi-2level/Unicode: Permission
denied at /System/Library/Perl/5.16/ExtUtils/Install.pm line 494.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
at -e line 1. make: *** [pure_site_install] Error 13
Does anyone ever encountered this problem?

/Library is a system directory. It is a bad idea to tinker with your system's own Perl distribution. If anything goes wrong, you'll have a lot of cleanup to do.
Therefore, build your own Perl. All you need is to download the appropriate source distribution, and run ./Configure --help, and read the instructions.
Or, you could just do:
$ ./Configure -des -Dprefix=/Users/user/perl/5.xx.x
make
make test
make install
You can then put /Users/user/perl/5.xx.x/bin on your path, or just invoke perl with the full path.
$ ~/perl/5.xx.x/bin/perl Makefile.PL
make test
make install
I like to put symlinks in ~/bin so that perl5.xx.x invokes ~/perl/5.xx.x/bin/perl.
Do not install modules in system directories. I am sure people who recommended that mean well, but doing so is going to cause trouble at some point.

Related

perl DBI module installation erroring out

perl DBI module installation is erroring out.
Installed perl 5.32.1 in non standard location, using -Dinstallprefix option
./Configure -Dinstallprefix=/test/user/home/perl -des
make
make test
make install
/test/user/home/perl/bin/perl -version
This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux
Set PERL5LIB env variable
export PERL5LIB="/test/user/home/perl/lib/5.32.1:/test/user/home/perl/lib/site_perl/5.32.1:/test/user/home/perl/lib/5.32.1/x86_64-linux"
which perl
/test/user/home/perl/bin/perl
Downloaded DBI-1.643 archive, after extraction execution of Makefile.PL is failing
perl Makefile.PL
Warning: PERL_LIB (/perl/lib/5.32.1) seems not to be a perl library directory
(strict.pm not found) at /test/user/home/perl/lib/5.32.1/ExtUtils/MM_Unix.pm line 1934.
Have /test/user/home/perl/lib/5.32.1/x86_64-linux
Want /perl/lib/5.32.1/x86_64-linux
Your perl and your Config.pm seem to have different ideas about the
architecture they are running on.
Perl thinks: [x86_64-linux]
Config says: [x86_64-linux]
This may or may not cause problems. Please check your installation of perl
if you have problems building this extension.
Can't stat /perl/lib/5.32.1: No such file or directory
at Makefile.PL line 280.
Can't stat /perl/lib/5.32.1/x86_64-linux: No such file or directory
at Makefile.PL line 280.
Failed to opendir '/perl/lib/5.32.1/x86_64-linux/CORE' to find header files: No such file or directory at /test/user/home/perl/lib/5.32.1/ExtUtils/MM_Any.pm line 3048.
Found non existing paths are referred from #INC
perl -e "print \"#INC\""
/test/user/home/perl/lib/5.32.1 /test/user/home/perl/lib/site_perl/5.32.1 /test/user/home/perl/lib/5.32.1/x86_64-linux
/perl/lib/site_perl/5.32.1/x86_64-linux /perl/lib/site_perl/5.32.1 /perl/lib/5.32.1/x86_64-linux /perl/lib/5.32.1
Can someone guide me where from #INC getting these non existing paths
/perl/lib/site_perl/5.32.1/x86_64-linux /perl/lib/site_perl/5.32.1 /perl/lib/5.32.1/x86_64-linux /perl/lib/5.32.1
are there any way to restrict #INC to append non existing paths?
I think you want just -Dprefix=/.... There are other things that need to end up in the right place too. You shouldn't need to set PERL5LIB though because perl should be using your prefix as its default #INC. What does your perl -V show?
There is an installprefix, but it's aimed at compiling on one machine and installing on another. However, the INSTALL docs also recommend against using that. Is that what you are trying to do?
As for the other directories, the INSTALL docs describe the various directories that show up in #INC.
Thank you #brian for pointing me in right direction.
Following was the root cause behind #INC contains non existing directories.
Last time during perl installation at least one time I ran following command
./Configure -des -Dprefix=/perl
Use relocatable #INC? [n]
Pathname where the private library files will reside? (~name ok)
[/perl/lib/5.32.1]
Where do you want to put the public architecture-dependent libraries? (~name ok)
[/perl/lib/5.32.1/x86_64-linux]
Pathname for the site-specific library files? (~name ok)
[/perl/lib/site_perl/5.32.1]
Pathname for the site-specific architecture-dependent library files? (~name ok)
[/perl/lib/site_perl/5.32.1/x86_64-linux]
then executed make command. Later on make test failed for other error.
Then without running make distclean command, I re ran Configure with
-Dinstallprefix option
./Configure -Dinstallprefix=/test/user/home/perl -des
This populate #INC as follows
/test/user/home/perl/lib/5.32.1 /test/user/home/perl/lib/site_perl/5.32.1 /test/user/home/perl/lib/5.32.1/x86_64-linux
/perl/lib/site_perl/5.32.1/x86_64-linux /perl/lib/site_perl/5.32.1 /perl/lib/5.32.1/x86_64-linux /perl/lib/5.32.1
To fix this issue executed following steps,
make distclean
./Configure -des -Dprefix=/test/user/home/perl -Dusethreads
now #INC is populated correct
#INC:
/test/user/home/perl/lib/site_perl/5.32.1/x86_64-linux-thread-multi
/test/user/home/perl/lib/site_perl/5.32.1
/test/user/home/perl/lib/5.32.1/x86_64-linux-thread-multi
/test/user/home/perl/lib/5.32.1
Now DBI installation ran successfully.

HTML::TokeParser not able to install from CPAN

I am not able to install HTML::TokeParser this package from CPAN.
cpan[6]> install HTML::TokeParser
Running install for module 'HTML::TokeParser'
Running make for G/GA/GAAS/HTML-Parser-3.71.tar.gz
Has already been unwrapped into directory /root/.cpan/build/HTML-Parser-3.71-0zUSqw
Could not make: Unknown error
Running make test
Can't test with enter code here out successful make
Running make install
Make had returned bad status, install seems impossible
Can anyone help here?
you can try:
perl -MCPAN -e 'install HTML::TokeParser'
OR
Download the zipped tar file from one of the following:
http://search.cpan.org/~gaas/HTML-Parser-3.71/lib/HTML/TokeParser.pm
or
search.cpan.org/CPAN/authors/id/G/GA/GAAS/HTML-Parser-3.71.tar.gz
Unzip the module as follows or use winzip:
tar -zxvf HTML-Parser-3.71.tar.gz
The module can be installed using the standard Perl procedure:
perl Makefile.PL
make
make test
make install # You may need to be root
make clean # or make realclean

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.

Install GD Library on RedHat machine for twiki

My ultimate goal is to run a twiki website for my research group.
I have space on RedHat server that is running Apache, etc., but upon which I do not have root access. Since I cannot install perl modules with the current permissions, I've decided to manually install a local version of perl. Got that working no problem. The following modules are required to get twiki to work:
FreezeThaw - http://search.cpan.org/~ilyaz/FreezeThaw
CGI::Session - http://search.cpan.org/~markstos/CGI-Session
Error - http://search.cpan.org/~shlomif/Error
GD - http://search.cpan.org/~lds/GD
HTML::Tree - http://search.cpan.org/~petek/HTML-Tree
Time-modules - http://search.cpan.org/~muir/Time-modules
I have installed FreezeThaw, CGI, Error, and it fails on GD with the following error:
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.
In searching for how to get around this newest obstacle, I found a previous SO question: How to install GD library with Strawberry Perl asked about installing this and the top answer suggested manually compiling gdlib. You'll note, however, that that link is broken. The base site: http://www.libgd.org/ is basically down saying to go to the project's bitbucket page.
So I got the tarball from that page and am trying to install it. The following problems occur when I follow the instructions included. README.TXT says: "If the sources have been fetched from CVS, run bootstrap.sh [options]."
Running bootstrap.sh yields:
configure.ac:64: warning: macro `AM_ICONV' not found in library
configure.ac:10: required directory ./config does not exist cp: cannot
create regular file `config/config.guess': No such file or directory
configure.ac:11: installing `config/config.guess' configure.ac:11:
error while copying cp: cannot create regular file
`config/config.sub': No such file or directory configure.ac:11:
installing `config/config.sub' configure.ac:11: error while
copying cp: cannot create regular file `config/install-sh': No such
file or directory configure.ac:28: installing `config/install-sh'
configure.ac:28: error while copying cp: cannot create regular
file `config/missing': No such file or directory configure.ac:28:
installing `config/missing' configure.ac:28: error while copying
configure.ac:577: required file `config/Makefile.in' not found
configure.ac:577: required file `config/gdlib-config.in' not found
configure.ac:577: required file `test/Makefile.in' not found
Makefile.am:14: Libtool library used but `LIBTOOL' is undefined
Makefile.am:14: The usual way to define `LIBTOOL' is to add
AC_PROG_LIBTOOL' Makefile.am:14: to configure.ac' and run
aclocal' and autoconf' again. Makefile.am:14: If `AC_PROG_LIBTOOL'
is in `configure.ac', make sure Makefile.am:14: its definition is in
aclocal's search path. cp: cannot create regular file
`config/depcomp': No such file or directory Makefile.am: installing
`config/depcomp' Makefile.am: error while copying Failed
And it says I should also install the following 3rd party libraries:
zlib, available from http://www.gzip.org/zlib/
Data compression library
libpng, available from http://www.libpng.org/pub/png/
Portable Network Graphics library; requires zlib
FreeType 2.x, available from http://www.freetype.org/
Free, high-quality, and portable font engine
JPEG library, available from http://www.ijg.org/
Portable JPEG compression/decompression library
XPM, available from http://koala.ilog.fr/lehors/xpm.html
X Pixmap library
Which I am ignoring for now.
Switching to the generic instructions it says follow the advice in the INSTALL file; which says: "cd to the directory containing the package's source code and type ./configure to configure the package for your system." Which flat does not work: I've cd'ed into every directory of the tarball and running that command does nothing.
So, trying to install twiki required me to install perl, which required me to install the perl modules: FreezeThaw, CGI, Error, HTML, Time-modules, and GD -- which itself required me to install gdlib -- which further suggested I install zlib, libpng, FreeType 2.x, JPEG library, and XPM. And of course, I'm stuck at the installing gdlib stage.
My question is: what other process can possibly demean humanity to such a level? I cannot fathom the depths of cruelty that lay ahead of me as I dive ever deeper into this misery onion. Should I just end it all? Can meaning be brought from this madness? Will the sun come up tomorrow, and if so, does it even matter?
But seriously, any suggestions on what to do differently/better would be much appreciated -- I can't remember what a child's laughter sounds like anymore.
Install the package gd-devel, it contains /usr/bin/gdlib-config.
This should work:
sudo apt-get -y install libgd2-xpm-dev build-essential

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.