Difference between revisions of "Perlbrew"

From HalfgeekKB
Jump to navigation Jump to search
Line 40: Line 40:
  
 
I believe it is supposed to work to install the same version twice as long as the names are different. However, there can be only one build directory per version, so don't try to perform the actual installs simultaneously; wait for one to finish before starting the next.
 
I believe it is supposed to work to install the same version twice as long as the names are different. However, there can be only one build directory per version, so don't try to perform the actual installs simultaneously; wait for one to finish before starting the next.
 +
 +
==Fixes for build failures==
 +
 +
===cwd.t linktest===
 +
 +
When building 5.18.2, I got this failure:
 +
 +
<syntaxhighlight lang=perl>
 +
#  Failed test at t/cwd.t line 209.
 +
#                  '/home/username/perl5/perlbrew/build/perl-5.18.2/dist/Cwd/t/linktest'
 +
#    doesn't match '(?^i:\/home\/username\/perl5\/perlbrew\/build\/perl\-5\.18\.2\/dist\/Cwd\/t\/_ptrslt_\/_path_\/_to_\/_a_\/_dir_$)'
 +
</syntaxhighlight>
 +
 +
A corresponding error [http://www.nntp.perl.org/group/perl.perl5.porters/2013/09/msg208099.html reported by someone else] said that this manual hack on Cwd.pm got the issue out of the way without forcing the install:
 +
 +
<syntaxhighlight lang=perl>
 +
# ~/perl5/perlbrew/build/perl-5.18.2/lib/Cwd.pm, line 579:
 +
        unless (opendir(PARENT, $dotdots))
 +
        {
 +
            # probably a permissions issue.  Try the native command.
 +
            require File::Spec;
 +
            $start = readlink($start) if -l $start; # ADD this line to resolve a symlink
 +
            return File::Spec->rel2abs( $start, _backtick_pwd() );
 +
        }
 +
</syntaxhighlight>
 +
 +
Currently rebuilding to see if it works.
  
 
==Image::Magick==
 
==Image::Magick==

Revision as of 17:47, 15 April 2014

perlbrew is a manager for sudo-free, user-level perl installations.

Installation

cd ~/tmp
wget --no-check-certificate https://raw.github.com/gugod/App-perlbrew/master/perlbrew
perl perlbrew self-install
cat 'source ~/perl5/perlbrew/etc/bashrc' >> ~/.bashrc # restart bash for this to take effect

At this point, you should also install patchperl, but the default command to do this,

perl perlbrew install-patchperl

failed for me because of a certificate issue. A workaround is to get it directly:

curl -kL https://raw.github.com/gugod/patchperl-packing/master/patchperl > ~/perl5/perlbrew/bin/patchperl
chmod +x ~/perl5/perlbrew/bin/patchperl

Alternatively, perlbrew can be patched to add the -k option to ignore cert issues. However, the program is minified, so this is currently more straightforward.

Add a new perl install

Do this in a screen session. It is a long-running process that you won't want interrupted by connectivity problems.

perlbrew install --as $your_install_name stable
  • The --as switch is optional. Omitting it causes the version to be used instead of a name when managing.
  • The stable specifier may be replaced with any version number or blead.
  • Other options are available.

This is a full perl install process and will take a substantial about of time. You will be given a tail -f command to follow the log if desired.

I believe it is supposed to work to install the same version twice as long as the names are different. However, there can be only one build directory per version, so don't try to perform the actual installs simultaneously; wait for one to finish before starting the next.

Fixes for build failures

cwd.t linktest

When building 5.18.2, I got this failure:

#   Failed test at t/cwd.t line 209.
#                   '/home/username/perl5/perlbrew/build/perl-5.18.2/dist/Cwd/t/linktest'
#     doesn't match '(?^i:\/home\/username\/perl5\/perlbrew\/build\/perl\-5\.18\.2\/dist\/Cwd\/t\/_ptrslt_\/_path_\/_to_\/_a_\/_dir_$)'

A corresponding error reported by someone else said that this manual hack on Cwd.pm got the issue out of the way without forcing the install:

# ~/perl5/perlbrew/build/perl-5.18.2/lib/Cwd.pm, line 579:
        unless (opendir(PARENT, $dotdots))
        {
            # probably a permissions issue.  Try the native command.
            require File::Spec;
            $start = readlink($start) if -l $start; # ADD this line to resolve a symlink
            return File::Spec->rel2abs( $start, _backtick_pwd() );
        }

Currently rebuilding to see if it works.

Image::Magick

One process that is claimed to work for installing Image::Magick is given on perltricks.com.

The given process has a new IM library installed under ~/local. I'm likely to modify it to something like ~/opt/ImageMagick-VERSION-NAME. This should be documented here.

Proposed install script (has not been tested yet!):

IM=ImageMagick-6.8.9-0
IM_DOWNLOADS="http://www.imagemagick.org/download"
OPT="$HOME/opt"
FONT_PATH="$HOME/.fonts"
PB_NAME="your perlbrew install name"
PB_DIR="$PERLBREW_ROOT/perls/$PB_NAME"
PB_PERL="$PB_DIR/bin/perl"
PB_CORE="$PB_DIR"/lib/5.*.*/*/CORE
PREFIX="$OPT/$IM-$PB_NAME"

WITHOUT_THREADS=`"$PB_PERL" -MConfig -E '$Config{useithreads} or say "--without-threads"'`

wget "$IM_DOWNLOADS/$IM.tar.xz" &&
tar xJvf "$IM.tar.xz" &&
cd "$IM" &&
LDFLAGS=-L"$PB_CORE" \
	./configure \
		--prefix "$PREFIX" \
		--with-perl="$PB_PERL" \
		--enable-shared \
		$WITHOUT_THREADS \ 
		--with-fontpath="$FONT_PATH" \
		--with-rsvg \
		&&
read -p "Press enter to make and install." &&
make install