perl local::lib problems with some makefiles (eg: git manual installation)

30 December 2009

I tried to install the latest git in my ubuntu 9.04 and failed while trying to install some perl code. The makefile use prefix but does not check if there is a INSTALL_BASE variable already  defined in the system. This create a conflict having both prefix and install_base.

# installing git
sudo aptitude install git-core git-doc git-svn gitmagic gitweb
git-core git-doc git-svn gitmagic gitweb libdigest-sha1-perl{a} liberror-perl{a} libneon27-gnutls{a} libsvn-perl{a}

#updating git:

$ sudo apt-get build-dep git-core git-doc libssl-dev
$ wget
$ tar -xzf git-
$ cd git-
$ ./configure
$ make all doc
$ sudo make install install-doc
$ git --version
git version

[in my case wget]

ERROR because Local::Lib exported variable: INSTALL_BASE

/usr/bin/perl Makefile.PL PREFIX='/usr/local'
Only one of PREFIX or INSTALL_BASE can be given.  Not both.
make[1]: *** [perl.mak] Error 255
make: *** [perl/perl.mak] Error 2

!!! why /usr/bin/perl; ????? if I have my local perl 5.10.1 in my home and ‘which perl’ point to it. Seems that I would need to change the makefile options and the hardcoded perl location!!! <TO_DO>

$ make clean

<TO_DO> modify the makefile options for using my local perl 5.10.1 and use only the INSTALL_BASE (or only prefix deleting the install_base envvar)

## how Local::Lib works: it exports some variables from an eval in your .bashrc:

 pablo@pmg-linux:~$ perl -I$HOME/localperl/locallib/lib/perl5 -Mlocal::lib=$HOME/localperl/locallib
 export MODULEBUILDRC="/home/pablo/localperl/locallib/.modulebuildrc"
 export PERL_MM_OPT="INSTALL_BASE=/home/pablo/localperl/locallib"
 export PERL5LIB="/home/pablo/localperl/locallib/lib/perl5:/home/pablo/localperl/locallib/lib/perl5/i486-linux-gnu-thread-multi:$PERL5LIB"
 export PATH="/home/pablo/localperl/locallib/bin:$PATH"


And similar problems reported in the web:

From: Jakub Narebski <jnareb <at>>
Subject: Re: [ANNOUNCE] GIT 1.6.5
Newsgroups: gmane.comp.version-control.git
Date: 2009-10-14 22:11:50 GMT (9 weeks and 26 minutes ago)

Junio C Hamano <gitster <at>> writes:

> The latest feature release GIT 1.6.5 is available at the usual
> places:
>   git-1.6.5.tar.{gz,bz2}			(source tarball)
>   git-htmldocs-1.6.5.tar.{gz,bz2}		(preformatted docs)
>   git-manpages-1.6.5.tar.{gz,bz2}		(preformatted docs)
> The RPM binary packages for a few architectures are found in:
>   RPMS/$arch/git-*-1.6.5-1.fc9.$arch.rpm	(RPM)
> This cycle took a bit longer than I hoped, but here it is.  We already
> have some new features cooking in 'next', and I expect we may be able to
> have 1.6.6 by the end of the year.

Compiling git from source RPM git-1.6.5-1.fc9.src.rpm using

  $ rpmbuild --rebuild git-1.6.5-1.fc9.src.rpm

fails with the following error:

    SUBDIR perl
/usr/bin/perl Makefile.PL PREFIX='/usr'
Only one of PREFIX or INSTALL_BASE can be given.  Not both.
make[1]: *** [perl.mak] Error 2
make: *** [perl/perl.mak] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.53174 (%build)

Compiling git from source with

 $ make prefix=/home/local/git \
        bindir=/home/local/git \
        gitexecdir=/home/local/git \
        template_dir=/home/local/git \

gives the same error.

It might matter that I am using modern Perl way of installing Perl
modules locally, via local::lib, with ~/perl5/.modulebuildrc

  install  --install_base  /home/jnareb/perl5

and I have

  export MODULEBUILDRC="$HOME/perl5/.modulebuildrc"


 $ unset PERL_MM_OPT

before compiling (from SRPMS) made compilation pass this stage,
and finally succeed.

I guess that perl/Makefile (or rather the file that generates it)
should unset PERL_MM_OPT, or use INSTALL_BASE as DESTDIR rather
than fiddling with PREFIX.

But I am not a Perl hacker
perl, v5.8.6
ExtUtils::MakeMaker 6.54 (local)
ExtUtils::MakeMaker 6.17 (global)

export MODULEBUILDRC="$HOME/perl5/.modulebuildrc"
Jakub Narebski
ShadeHawk on #git

MYSQL devel files in ubuntu and installing perl DBD::mysql

29 December 2009

I am using the fantastic local::lib with ubuntu 9.04. That is great, but  not following the easy way (aka ‘aptitude’) and having full control managing all the perl modules with CPAN, has its downside: the installation of  the hard-to-install-modules like DBI and GD

A- where is myql_config script? DBD::mysql use it for finding where you have all the mysql things
B- where is now the mysql-devel package?

A) Not found until solved B.

mysql_config is not installed until you install the mysql-devel !!!

linux:~/.cpan/build/DBD-mysql-4.013-tjvDzy$ mysql_config
Usage: /usr/bin/mysql_config [OPTIONS]
–cflags         [-I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing]
–include        [-I/usr/include/mysql]
–libs           [-Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient]
–libs_r         [-Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient_r]
–socket         [/var/run/mysqld/mysqld.sock]
–port           [0]
–version        [5.0.75]
–libmysqld-libs [-Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqld -lwrap -lrt]

B) The msyql devel is no longer in ubuntu (at least with this name)

linux:~/.cpan/build/DBD-mysql-4.013-tjvDzy$ sudo aptitude search mysql | grep devel
p   liblua5.1-sql-mysql-dev         – luasql development files for the lua langu
p   libmysql++-dev                  – MySQL C++ library bindings (development)
p   libmysqlclient15-dev            – MySQL database development files
p   libmysqlclient16-dev            – MySQL database development files

Seems that now is called  libmysqlclient15-dev

Searching in the web:
a lot of people have had the same problem and they say that ‘ libmysql++-dev’ works ok

What I was not able to find is what is the difference between libmysqlclient15-dev and libmysqlclient16-dev. I have mysql-5.0 installed but in the repostiroty there is also the 5.1. Are the libmysqlcientxx-devel specific for each msyql version?

# installing the libmysql++-dev
> sudo aptitude install libmysql++-dev
The following NEW packages will be installed:
libmysql++-dev libmysql++3{a} libmysqlclient15-dev{a}

==intalled devel files ==

== Try to install DBD::mysql with CPAN==

cpan[12]> install DBD::mysql

‘/home/pablo/localperl/bin/perl Makefile.PL’ returned status 512, won’t make
Running make test
Make had some problems, won’t test
Running make install
Make had some problems, won’t install

* try it manually

pablo@pmg-linux:~/.cpan/build/DBD-mysql-4.013-2mMMny$ perl Makefile.PL


For ‘make test’ to run properly, you must ensure that the
database user ‘pablo’ can connect to your MySQL server
and has the proper privileges that these tests require such
as ‘drop table’, ‘create table’, ‘drop procedure’, ‘create procedure’
as well as others.

mysql> grant all privileges on test.* to ‘pablo’@’localhost’ identified by ‘s3kr1t’;

You can also optionally set the user to run ‘make test’ with:

perl –testuser=username

I will use the following settings for compiling and testing:

cflags        (mysql_config) = -I/usr/include/mysql  -DBIG_JOINS=1 -fPIC -fno-strict-aliasing
embedded      (mysql_config) =
libs          (mysql_config) = -Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient
mysql_config  (guessed     ) = mysql_config
nocatchstderr (default     ) = 0
nofoundrows   (default     ) = 0
ssl           (guessed     ) = 0
testdb        (default     ) = test
testhost      (default     ) =
testpassword  (default     ) =
testsocket    (default     ) =
testuser      (guessed     ) = pablo

To change these settings, see ‘perl Makefile.PL –help’ and

# Before installing, it would be good to have a test database and give rights to the my user:
$ mysql -u root -p
mysql> grant all privileges on test.* to ‘pablo’@’localhost’;
mysql> create database test;
$ cd ~/.cpan/build/DBD-mysql-4.013-2mMMny
perl Makefile.PL

$ make

$ make test
All tests successful.
Files=36, Tests=745, 15 wallclock secs ( 0.24 usr  0.97 sys +  1.47 cusr  7.16 csys =  9.84 CPU)
Result: PASS

$ make install


After installing it manually I did the installation again from CPAN with the CPAN shell into my local-lib and it worked ok! Well I was expecting it to warn me that was already installed but it was installed again instead.

virtualbox issues

27 December 2009

I have a new (old) MacBooc Pro 3.1 4GB
I installed virtualbox and tried to install ubutntu 9.10 but it went wrong. The graphic part of the installer was all garbage. So I went to 9.04.

I installed the guest_additions.

The resolution of my external monitor went bad one or two times and I needed to set it manually even after the guest additions installation. But now it works ok with different monitors and resolutions.

Shared folders:
There are some issues with the shared folders. I don’t know if the problem with having capital letters in the shared folder still apply but the other common problem with s.f. (That I hit several times in this installation) is to try to mount from the folder where the mount points are:

/sbin/mount.vboxsf: mounting failed with the error: Protocol error

If you try to mount the folder from the directory where the mount point are:

ej, you are in /sf and your mount points are  /sf/software /sf/tmp /sf/mac_home etc

/sf$ sudo mount -t vboxsf -o uid=1000,gid=1000 sf_software /sf/software/


Went  to ~/home and tried from there and all went ok

PD: I took me a lot of blog-reading to find this solution. Hope it helps!

[Q:] numeric modern perl

26 December 2009

In this new rebirth of perl, we have moose for OO, dbx::class for ORM, catalyst for MVC,  and now two month ago there was a new release of PDL for matrix and vectorization number crunching.

Question: Are PDL and the graphics libraries to plot for PDL obsolete or simply people does not know of its existence? Is people using them in non-legacy production code? Are only astrophisics using it?

Should we use PDL instead of scripting R from inside perl scripts?

I would like to hear about modern success stories with PDL and comparisons with R for example for some basic matrix manipulation or vectorization.

How many active CPAN modules are using PDL?

In the new bioinformatics era of massive parallel sequencing  and high throughput expression and genotyping analysis a lot of people is using Perl for handling data, but turning into R for filtering, transforming and plotting the data. Perl can not compete with R in the statistical grounds, but now R is gaining adepts even for web plotting and cgi.

Do we have modern plotting libraries besides PLplot in CPAN?  And  do we have good tutorials for use them?

Bibliography: citeulike

26 December 2009

At Wellcome Trust Sanger Institute we use citeulike to keep track of the journal picks. The best way of adding a new bibliography entry is with a bookmarlet.

The bookmarklets are javascript code that you save as a bookmark.

There is a new one that port selected DOI or checked PUBMED list from pubmed, and even googlebooks ISBN into citeulike.

I found it more useful that the one that extract the metadata from the current page. Also the popup version is better because does not take you out of your page:

[update:  the below link from citeulike gets corrupted when copy-paste as Fergus well spotted it]

Post to CiteULike (with popup) [NB: this is the working one on 2009-12-26  beware if you copy it from here long after this date]

But you can find the up to date one here] under Advanced bookmarklets

[source code of the bookmarklet (the %20 are the html encoded spaces)]


news in sqlite3

1 November 2009

Now it supports natively foreign keys

2009-Oct-14 – Version 3.6.19
SQLite version 3.6.19 adds native support for foreign key constraints, including deferred constraints and cascading deletes. Enforcement of foreign keys is disabled by default for backwards compatibility and must be turned on using the foreign_keys pragma.

perl and unicode

20 September 2009

I have just found an interesting entry about perl and unicode:

Apart of the typical recommendation of using :encoding(UTF-8) as an input layer, it has a script for finding out which is the encoding of your shell:

use warnings;
use strict;
use Encode;

my @charsets = qw(utf-8 latin1 iso-8859-15 utf-16);

# some non-ASCII codepoints:
my $test = 'Ue: ' . chr(220) .'; Euro: '. chr(8364) . "\n";

for (@charsets){
    print "$_: " . encode($_, $test);

Also, this entry explain how some perl function are expecting text string or ‘Codepoints’ instead of binary data and explains how to decode the strings properly to pass them to this functions.

This other entry also explain how to avoid the ‘wide character in print’ warning, and here there is an explanation of the difference between UTF-8 and utf8 (

If you want to read more about encoding:

Finally al link to perlmonks where it is explained why the pragma :utf8 is insecure and you should use :encoding(UTF-8)

perl one-liner: print filenames with content matched

17 September 2009

If you want to know which files contains a specific text string you can do:

perl -nle '/find this/ and print $ARGV and close ARGV' file1 file2 .....
  • $ARGV contains the name of each file.
  • ARGV is the filehandle for $ARGV.
  • This one-liner searches each line (-n option) for a match (/xxx/) and when it happens (and) prints the file name and closes the filehandle to pass to search the next file.

This one-liner is very useful when  combined with xargs.

Frozen Bubble

12 September 2009

Pero mira que bien! acabo de enterarme que Frozen Bubble (juego adictivo donde los haya) ha sido creado con perl_sdl.

Si es que Perl es el Emacs de los lenguajes de programación 😉

Por que debes usar Perl 5.10.x?

11 September 2009

Por que es un salto cualitativo en la modernidad de Perl. Es un paso mas hacia Perl 6 y aunque algunas de sus funcionalidades se pueden conseguir en Perl 5.8 con diferentes modulos, usar Perl 5.10 es una declaración de intenciones. Significa que estas actualizado y te preocupas por las herramientas que usas.

Usar perl 5.10 y sus nuevas funcionalidades es una gran ayuda en tu estilo de programación, aunque solo sea por usar ‘say’ y los nuevos ‘given/when’ y ‘smart_match’.

Usar perl 5.10 no es sólo usar perl 5.10 sino que debe implicar también usar los nuevos paradigmas de programación y las nuevas herramientas disponibles en Perl como Perl::Critic, Moose, DBIx::Class, Catalyst, Devel::NYTProf, etc