So, I'm doing my first attempt at a hand-holding free install of Perl. I'm used to the niceties of Gentoo and being able to do everything through its package manager, so I thought I'd try doing it the way everyone else in the world apparently uses as "The most practical".
I'm going to walk you through what I did, mostly constructed from memory, so you have an idea of what the problem I have is, or, if you're in a similar situation, you can get some progress and learn from my mistakes once I've worked out what I need.
Normally, I'd ask about this on #perl@irc.freenode.org or something on irc.perl.org, or if appropriate, file a bug. However, in this case, I can't even conceive of which would be the right place to target my question, OpenBSD is in my estimation very "niché" market at the moment, as are lots of the modern tools for Perl, and I don't know where the appropriate place to solicit help for them are. So, I approach the ALL MIGHTY LAZY-WEB.
The Setup
- Installed OpenBSD 4.7
This shall be left as an exercise to the reader as to how this works. Its too much to cover here, and it really is pretty straight forward =). - Install
cpanm
Everyone I see in Perl these days seems to be ranting about this, so I used the perscribed instructions:$ curl -L http://cpanmin.us | perl - --sudo App::cpanminus
- I don't want to be stuck using Perl 5.10.1, which is great and all, but I'd rather be doing work with 5.12.2 and 5.13.* . And I keep getting recommendations NOT to use system Perl for ANYTHING other than getting your custom Perl running. ( Using system Perl is fine in Gentoo, at least how I use it, we've got 5.12.2 in tree now, and stuffing Perl dists into Package Management JustWorks™ ). The new sex for this is allegedly
perlbrew
, so I'm firing that baby up next.
$ cpanm --sudo App::perlbrew
- All appears good!. Now from here on, is where I think a few things start to drift south, but not entirely sure WHERE.
$ perlbrew init # add instructed line to bash $ bash $ perlbrew install perl-5.13.4 -v $ perlbrew install perl-5.12.2 -v
- All this appears to run smoothly.
$ perlbrew switch perl-5.13.4
- Here is where I do the stupid things that possibly lead to my downfall. First, you must understand how I want my setup:
- I want my primary development user (kent) to have 2 copies of Perl available, 5.13.4 and 5.12.4
- I want the modules for each install of Perl to follow their respective installs so I can just switch between Perls and have the modules switch over too
- "Production" Will repeat this process, except with less versions of Perl, and probably with less modules installed.
To achieve this, I insert lines in my .bashrc until it resembles this
source /home/kent/perl5/perlbrew/etc/bashrc export PERLDIR=/home/kent/perl5/perlbrew/perls/current export MODULEBUILDRC=/home/kent/perl5/perlbrew/etc/.modulebuildrc export PERL_MM_OPT="INSTALL_BASE=${PERLDIR}" export PERL5LIB="${PERLDIR}:${PERLDIR}/i386-openbsd" export PERL_CPANM_OPT="--local-lib=${PERLDIR}"
and .modulebuildrc of course contains this:install --install_base /home/kent/perl5/perlbrew/perls/current/
- For the most part this works perfectly, and I'm off installing modules happy as Larry.
- And then a few hours later, something depends on IO::Compress::BZip2. Now is the beginning of sorrows.
The Problem:
Can't find libbz2!
bzip2
and family installed and working.However, this worrisome notice appears during build:
Entering Compress-Bzip2-2.09 Configuring Compress-Bzip2-2.09 ... Running Makefile.PL Parsing config.in... /usr/bin/ld: cannot find -lbz2 collect2: ld returned 1 exit status compile command 'cc -fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -fstack-protector -I/usr/local/include -Wl,-E -fstack-protector -o show_bzversion show_bzversion.c -lbz2' failed system bzip2 not found, building internal libbz2Ah .... ok.
$ bzip2 -h 2❭&1 | head -n 1 bzip2, a block-sorting file compressor. Version 1.0.5, 10-Dec-2007. $ /usr/bin/ldd $(which bzip2) /usr/local/bin/bzip2: Start End Type Open Ref GrpRef Name 1c000000 3c006000 exe 1 0 0 /usr/local/bin/bzip2 065b5000 265b9000 rlib 0 1 0 /usr/local/lib/libbz2.so.10.4 07295000 272ce000 rlib 0 1 0 /usr/lib/libc.so.53.1 0643c000 0643c000 rtld 0 1 0 /usr/libexec/ld.soOk, so maybe it is a bit geriatric
That should be fine though right? WRONG
Something magical keeps finding Perl 5.10.1 :(
Building and testing Compress-Bzip2-2.09 for Compress::Bzip2 ... cp lib/Compress/Bzip2.pm blib/lib/Compress/Bzip2.pm AutoSplitting blib/lib/Compress/Bzip2.pm (blib/lib/auto/Compress/Bzip2) cd bzlib-src && make cc -c -fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -fstack-protector -I/usr/local/include -O2 -DVERSION=\"\" -DXS_VERSION=\"\" -DPIC -fPIC "-I/usr/libdata/perl5/i386-openbsd/5.10.1/CORE" blocksort.c cc -c -fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -fstack-protector -I/usr/local/include -O2 -DVERSION=\"\" -DXS_VERSION=\"\" -DPIC -fPIC "-I/usr/libdata/perl5/i386-openbsd/5.10.1/CORE" huffman.c cc -c -fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -fstack-protector -I/usr/local/include -O2 -DVERSION=\"\" -DXS_VERSION=\"\" -DPIC -fPIC "-I/usr/libdata/perl5/i386-openbsd/5.10.1/CORE" crctable.c cc -c -fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -fstack-protector -I/usr/local/include -O2 -DVERSION=\"\" -DXS_VERSION=\"\" -DPIC -fPIC "-I/usr/libdata/perl5/i386-openbsd/5.10.1/CORE" randtable.c cc -c -fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -fstack-protector -I/usr/local/include -O2 -DVERSION=\"\" -DXS_VERSION=\"\" -DPIC -fPIC "-I/usr/libdata/perl5/i386-openbsd/5.10.1/CORE" compress.c cc -c -fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -fstack-protector -I/usr/local/include -O2 -DVERSION=\"\" -DXS_VERSION=\"\" -DPIC -fPIC "-I/usr/libdata/perl5/i386-openbsd/5.10.1/CORE" decompress.c cc -c -fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -fstack-protector -I/usr/local/include -O2 -DVERSION=\"\" -DXS_VERSION=\"\" -DPIC -fPIC "-I/usr/libdata/perl5/i386-openbsd/5.10.1/CORE" bzlib.c ar cr libbz2.a && ranlib libbz2.a cc -c -fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -fstack-protector -I/usr/local/include -O2 -DVERSION=\"\" -DXS_VERSION=\"\" -DPIC -fPIC "-I/usr/libdata/perl5/i386-openbsd/5.10.1/CORE" bzip2.c /usr/bin/perl /usr/libdata/perl5/ExtUtils/xsubpp -typemap /usr/libdata/perl5/ExtUtils/typemap -typemap typemap Bzip2.xs > Bzip2.xsc && mv Bzip2.xsc Bzip2.c cc -c -Ibzlib-src -fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -fstack-protector -I/usr/local/include -O2 -DVERSION=\"2.09\" -DXS_VERSION=\"2.09\" -DPIC -fPIC "-I/usr/libdata/perl5/i386-openbsd/5.10.1/CORE" Bzip2.c In file included from Bzip2.xs:7: ppport.h:231:1: warning: "PERL_UNUSED_DECL" redefined In file included from Bzip2.xs:4: /usr/libdata/perl5/i386-openbsd/5.10.1/CORE/perl.h:330:1: warning: this is the location of the previous definition Running Mkbootstrap for Compress::Bzip2 ()Um. Um. Um.
How about NO
$ perl -v | grep version This is perl 5, version 13, subversion 4 (v5.13.4) built for OpenBSD.i386-openbsdThat's going to go down like a houseboat on fire.
What comes next is only a natural
t/010-useability.t ...... 1/3 ol 'BZ2_bzDecompressInit'nm/work/1284524774.31144/Compress-Bzip2-2.09/blib/arch/auto/Compress/Bzip2/Bzip2.so: undefined symb /usr/bin/perl:/home/kent/.cpanm/work/1284524774.31144/Compress-Bzip2-2.09/blib/arch/auto/Compress/Bzip2/Bzip2.so: undefined symbol 'BZ2_bzDecompress' /usr/bin/perl:/home/kent/.cpanm/work/1284524774.31144/Compress-Bzip2-2.09/blib/arch/auto/Compress/Bzip2/Bzip2.so: undefined symbol 'BZ2_bzBuffToBuffDecompress' /usr/bin/perl:/home/kent/.cpanm/work/1284524774.31144/Compress-Bzip2-2.09/blib/arch/auto/Compress/Bzip2/Bzip2.so: undefined symbol 'BZ2_bzDecompressEnd' /usr/bin/perl:/home/kent/.cpanm/work/1284524774.31144/Compress-Bzip2-2.09/blib/arch/auto/Compress/Bzip2/Bzip2.so: undefined symbol 'BZ2_bzCompress' /usr/bin/perl:/home/kent/.cpanm/work/1284524774.31144/Compress-Bzip2-2.09/blib/arch/auto/Compress/Bzip2/Bzip2.so: undefined symbol 'BZ2_bzBuffToBuffCompress' /usr/bin/perl:/home/kent/.cpanm/work/1284524774.31144/Compress-Bzip2-2.09/blib/arch/auto/Compress/Bzip2/Bzip2.so: undefined symbol 'BZ2_bzlibVersion' /usr/bin/perl:/home/kent/.cpanm/work/1284524774.31144/Compress-Bzip2-2.09/blib/arch/auto/Compress/Bzip2/Bzip2.so: undefined symbol 'BZ2_bzCompressInit' /usr/bin/perl:/home/kent/.cpanm/work/1284524774.31144/Compress-Bzip2-2.09/blib/arch/auto/Compress/Bzip2/Bzip2.so: undefined symbol 'BZ2_bzCompressEnd'And more and more of that explosion until you see:
Files=25, Tests=33, 7 wallclock secs ( 0.35 usr 0.21 sys + 4.74 cusr 1.44 csys = 6.74 CPU) Result: FAIL Failed 25/25 test programs. 30/33 subtests failed.Oh crap. That's not good.
Something Seriously wrong is going on here, but hell knows what it is, and I'm the least qualified to work it out.
Call For Halp
I acknowledge that CPANTS lists many many passes for this module, so it must be I who is at fault, right?
perl -V
Summary of my perl5 (revision 5 version 13 subversion 4) configuration: Platform: osname=openbsd, osvers=4.7, archname=OpenBSD.i386-openbsd uname='openbsd stridor.lan 4.7 generic#558 i386 ' config_args='-de -Dprefix=/home/kent/perl5/perlbrew/perls/perl-5.13.4 -Dusedevel' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='3.3.5 (propolice)', gccosandvers='openbsd4.7' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags ='-Wl,-E -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-lm -lutil -lc perllibs=-lm -lutil -lc libc=/usr/lib/libc.so.53.1, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-DPIC -fPIC ', lddlflags='-shared -fPIC -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: MYMALLOC PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP PERL_USE_DEVEL USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF Built under openbsd Compiled at Sep 14 2010 11:31:21 %ENV: PERL5LIB="/home/kent/perl5/perlbrew/perls/current:/home/kent/perl5/perlbrew/perls/current/i386-openbsd" PERLDIR="/home/kent/perl5/perlbrew/perls/current" PERL_CPANM_OPT="--local-lib=/home/kent/perl5/perlbrew/perls/current" PERL_MM_OPT="INSTALL_BASE=/home/kent/perl5/perlbrew/perls/current" @INC: /home/kent/perl5/perlbrew/perls/current /home/kent/perl5/perlbrew/perls/current/i386-openbsd /home/kent/perl5/perlbrew/perls/perl-5.13.4/lib/site_perl/5.13.4/OpenBSD.i386-openbsd /home/kent/perl5/perlbrew/perls/perl-5.13.4/lib/site_perl/5.13.4 /home/kent/perl5/perlbrew/perls/perl-5.13.4/lib/5.13.4/OpenBSD.i386-openbsd /home/kent/perl5/perlbrew/perls/perl-5.13.4/lib/5.13.4 .
Hey,
ReplyDeleteI think you got the order wrong a bit. You want to install perlbrew first, compile a local perl, then build cpan minus, local lib, etc on top of that. Otherwise you might get a situation where you compiled a local::lib for one version of perl, and are running another. Not sure if that helps, but that's the way I do it. In fact, some people using perlbrew no longer bother with creating a local::lib, they just use the local perlbrew created perl and install stuff into that.
what john said - your cpanminus installation is now tied to your system perl. You either have to install cpanminus for each perlbrew (which I usually do), or have one cpanminus with "#!/usr/bin/env perl" in the shebang line, in /usr/bin or somewhere else you always have in PATH.
ReplyDeleteIf you want to learn how to do it yourself, forget about perlbrew. It's a nice enough tool, but I hear a lot of the same complaints about it. It's very easy to compile and install your own perl. I write about how I do it in Make links to per-version tools. I don't have to switch perls, remember which one I'm using, or any of that other stuff.
ReplyDelete