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}
libsvn1{a}

#updating git:

http://blog.zobie.com/2009/07/installing-git-on-ubuntu-904-jaunty/

$ sudo apt-get build-dep git-core git-doc libssl-dev
$ wget http://kernel.org/pub/software/scm/git/git-1.6.3.3.tar.gz
$ tar -xzf git-1.6.3.3.tar.gz
$ cd git-1.6.3.3/
$ ./configure
$ make all doc
$ sudo make install install-doc
$ git --version
git version 1.6.3.3

[in my case wget http://kernel.org/pub/software/scm/git/git-1.6.5.6.tar.gz]

ERROR because Local::Lib exported variable: INSTALL_BASE

-----[error]------
/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)

[NB]
## 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:

http://thread.gmane.org/gmane.comp.version-control.git/129906/focus=130343

From: Jakub Narebski <jnareb <at> gmail.com>
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> pobox.com> writes:

> The latest feature release GIT 1.6.5 is available at the usual
> places:
>
>   http://www.kernel.org/pub/software/scm/git/
>
>   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 \
        GIT_PYTHON_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
containing 

  install  --install_base  /home/jnareb/perl5

and I have

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

Doing

 $ 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"
export PERL_MM_OPT="INSTALL_BASE=$HOME/perl5"
--
Jakub Narebski
Poland
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

PROBLEMS:
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]
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:
http://ubuntuforums.org/showthread.php?t=556317
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

PLEASE NOTE:

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 Makefile.pl –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.

Issues:
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/

THIS FAILS!!!

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 http://www.citeulike.org/bookmarklets.adp] under Advanced bookmarklets

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

javascript:var%20CUL;var%20jQuery;%20(function%20loadBookmarklet(){var%20t=’text/javascript’;if(CUL%20&&%20CUL.doStuff){CUL.doStuff();return;}CUL=new%20Object();CUL.VERSION=4;CUL.POPUP=1;CUL.BASE_URL=’http://www.citeulike.org’;CUL.USERNAME=’PabloMarin’;CUL_STATIC=’http://static.citeulike.org’;if(!jQuery){var%20s=document.createElement(‘script’);s.src=CUL_STATIC+’/3rdparty/jQuery/jquery-1.3.2.min.js’;s.type=t;document.body.appendChild(s);}(function%20waitForJquery(){if(typeof%20jQuery==’undefined’)%20{window.setTimeout(waitForJquery,%20200);}})();var%20s=document.createElement(‘script’);s.src=CUL_STATIC+’/3rdparty/jQuery/jqModal.js’;s.type=t;document.body.appendChild(s);var%20s=document.createElement(‘script’);s.src=CUL.BASE_URL+’/go_bookmarklet?url=’+encodeURIComponent(location.href);s.type=t;document.body.appendChild(s);})();