Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perlbrew should manage PERL5LIB/PERL_MM_OPT/PERL_MB_OPT #513

Open
KES777 opened this issue Jun 5, 2016 · 5 comments
Open

perlbrew should manage PERL5LIB/PERL_MM_OPT/PERL_MB_OPT #513

KES777 opened this issue Jun 5, 2016 · 5 comments

Comments

@KES777
Copy link

KES777 commented Jun 5, 2016

Before perlbrew I use this variables to install perl and perl libs into $HOME.
I do next in `~/.bashrc

export PERL_MB_OPT="--install_base \"/home/kes/perl5\""
export PERL_MM_OPT="INSTALL_BASE=/home/kes/perl5"
export PERL5LIB='/home/kes/perl5/lib/perl5'

So when I install module I install it into my $HOME and do not interfere with system perl.
But now I need to install perl-5.12 and I use perlbrew
This variables cause some problems and perl segfaults because of mix of my local modules and perlbrew's. Also I note that under perlbrew modules are installed into my local dir, not perlbrew's one. And this break my local perl.

perl: symbol lookup error: /home/kes/perl5/lib/perl5/x86_64-linux/auto/Guard/Guard.so: undefined symbol: Perl_xs_handshake

Here I switch to use perl-5.12.5 and install module:

$ env | grep PERL
PERLBREW_VERSION=0.75
PERLBREW_PERL=perl-5.12.5
PERL5LIB=/home/kes/work/projects/perl_libs/lib:/home/kes/perl5/lib/perl5
PERL_MB_OPT=--install_base "/home/kes/perl5"
PERLBREW_ROOT=/home/kes/perl5/perlbrew
PERLBREW_MANPATH=/home/kes/perl5/perlbrew/perls/perl-5.12.5/man
PERLBREW_SKIP_INIT=1
PERL_LOCAL_LIB_ROOT=
PERLBREW_LIB=
PERLBREW_PATH=/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-5.12.5/bin
PERL_MM_OPT=INSTALL_BASE=/home/kes/perl5
kes@keswork ~/work/projects/perl_libs $ ./Build install
Building Devel-DebugHooks
Installing /home/kes/perl5/lib/perl5/Devel/ImportArgs.pm
Installing /home/kes/perl5/lib/perl5/Devel/PkgAtCompileTime.pm
Installing /home/kes/perl5/lib/perl5/Devel/KillPrint_scope.pm
Installing /home/kes/perl5/lib/perl5/Devel/KillPrintTest.pm
Installing /home/kes/perl5/lib/perl5/Devel/DebugHooks.pm
Installing /home/kes/perl5/lib/perl5/Devel/DebugHooks/TraceAccess.pm
Installing /home/kes/perl5/lib/perl5/Devel/DebugHooks/Commands.pm
Installing /home/kes/perl5/lib/perl5/Devel/DebugHooks/CmdProcessor.pm
Installing /home/kes/perl5/lib/perl5/Devel/DebugHooks/KillPrint.pm
Installing /home/kes/perl5/lib/perl5/Devel/DebugHooks/Terminal.pm
Installing /home/kes/perl5/lib/perl5/Devel/DebugHooks/Server.pm
Installing /home/kes/perl5/lib/perl5/Devel/DebugHooks/Guides/DebugHooks.pod
Installing /home/kes/perl5/man/man3/Devel::DebugHooks.3pm
Installing /home/kes/perl5/bin/dclient.pl
kes@keswork ~/work/projects/perl_libs $ which perl
/home/kes/perl5/perlbrew/perls/perl-5.12.5/bin/perl
kes@keswork ~/work/projects/perl_libs $ perl -V
Summary of my perl5 (revision 5 version 12 subversion 5) configuration:

  Platform:
    osname=linux, osvers=3.13.0-37-generic, archname=x86_64-linux
    uname='linux keswork 3.13.0-37-generic #64-ubuntu smp mon sep 22 21:28:38 utc 2014 x86_64 x86_64 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/kes/perl5/perlbrew/perls/perl-5.12.5 -Aeval:scriptdir=/home/kes/perl5/perlbrew/perls/perl-5.12.5/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.8.4', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.19.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.19'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'


Characteristics of this binary (from libperl): 
  Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_64_BIT_ALL
                        USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO
                        USE_PERL_ATOF
  Locally applied patches:
    Devel::PatchPerl 1.38
  Built under linux
  Compiled at Jun  5 2016 13:43:02
  %ENV:
    PERL5LIB="/home/kes/work/projects/perl_libs/lib:/home/kes/perl5/lib/perl5"
    PERLBREW_LIB=""
    PERLBREW_MANPATH="/home/kes/perl5/perlbrew/perls/perl-5.12.5/man"
    PERLBREW_PATH="/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-5.12.5/bin"
    PERLBREW_PERL="perl-5.12.5"
    PERLBREW_ROOT="/home/kes/perl5/perlbrew"
    PERLBREW_SKIP_INIT="1"
    PERLBREW_VERSION="0.75"
    PERL_LOCAL_LIB_ROOT=""
    PERL_MB_OPT="--install_base "/home/kes/perl5""
    PERL_MM_OPT="INSTALL_BASE=/home/kes/perl5"
  @INC:
    /home/kes/work/projects/perl_libs/lib
    /home/kes/perl5/lib/perl5/x86_64-linux
    /home/kes/perl5/lib/perl5
    /home/kes/perl5/perlbrew/perls/perl-5.12.5/lib/site_perl/5.12.5/x86_64-linux
    /home/kes/perl5/perlbrew/perls/perl-5.12.5/lib/site_perl/5.12.5
    /home/kes/perl5/perlbrew/perls/perl-5.12.5/lib/5.12.5/x86_64-linux
    /home/kes/perl5/perlbrew/perls/perl-5.12.5/lib/5.12.5
    .

It seems perlbrew should check PERL5LIB/PERL_MM_OPT/PERL_MB_OPT and alter them to make things work correct.

Seems related: #414 #325 #387 #479 #211

@KES777
Copy link
Author

KES777 commented Jun 5, 2016

@shadowcat-mst
Copy link

You should be using 'perlbrew lib' to have per-perlbrew local::libs.

Stacking local::lib outside perlbrew doesn't make any sense since local::lib is per perl.

Please use the already written perlbrew local::lib support.

@KES777
Copy link
Author

KES777 commented Jun 5, 2016

It seems should be first thing to remove PERL5LIB/PERL_MM_OPT/PERL_MB_OPT from .bashrc before start to use perlbrew.

Sad that it was not mentioned in the DOC.

@gugod
Copy link
Owner

gugod commented Jun 6, 2016

I also second what @shadowcat-mst says: "local::lib is per perl".

What we could do here is maybe just detecting the this 3-var settings of local::lib and produce some warn in bashrc (bootstrap time). PERL_MM_OPT / PERL_MB_OPT might contain other values you might want to passthru to cpan.

@shadowcat-mst
Copy link

On Mon, Jun 06, 2016 at 02:58:02PM -0700, Kang-min Liu wrote:

I also second what @shadowcat-mst says: "local::lib is per perl".

What we could do here is maybe just detecting the this 3-var settings of local::lib and produce some warn in bashrc (bootstrap time). PERL_MM_OPT / PERL_MB_OPT might contain other values you might want to passthru to cpan.

Detecting PERL_LOCAL_LIB_ROOT seems like maybe it would work?

Though I do wonder if e.g. PERL5LIB is likely to be a footgun even sans a full
local::lib setup

Matt S Trout - Shadowcat Systems - Perl consulting with a commit bit and a clue

http://shadowcat.co.uk/blog/matt-s-trout/ http://twitter.com/shadowcat_mst/

Email me now on mst (at) shadowcat.co.uk and let's chat about how our CPAN
commercial support, training and consultancy packages could help your team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants