Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Setting build path for modules

by Skyeheart (Initiate)
on Jul 18, 2012 at 16:18 UTC ( [id://982477]=perlquestion: print w/replies, xml ) Need Help??

Skyeheart has asked for the wisdom of the Perl Monks concerning the following question:

I have packages installed in /usr/lib/perl5 and /usr/lib64/perl5. Some packages which I build and install go to /usr/lib/perl5 and others to /usr/lib64/perl5. My question is how to do you set the install path for a Makefile.PL, Build.PL or cpan install? I need to make sure that all packages are going to the same path – probably /usr/lib64/perl5 – and then remove the other – probably /usr/lib/perl5.

Replies are listed 'Best First'.
Re: Setting build path for modules
by daxim (Curate) on Jul 18, 2012 at 16:30 UTC
    You set the install path with --install_base resp. INSTALL_BASE. The CPAN configuration variables mbuildpl_arg resp. makepl_arg and the environment variables PERL_MB_OPT and PERL_MM_OPT can supply default values. If these are not set, modules are installed automatically into the appropriate place.

    I have no idea how it could happen that you end up with both /lib and /lib64. Some information is lacking from you. Show the output of

    • perl -V
    • env | sort | grep -i perl
    • your CPAN configuration file named MyConfig.pm or Config.pm

      For Perl -V: Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=linux, osvers=2.6.18-53.el5, archname=x86_64-linux-thread-multi uname='linux builder10.centos.org 2.6.18-53.el5 #1 smp mon nov 12 02:14:55 est 2007 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -Dversion=5.8.8 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dprivlib=/usr/lib/perl5/5.8.8 -Dsitelib=/usr/lib/perl5/site_perl/5.8.8 -Dvendorlib=/usr/lib/perl5/vendor_perl/5.8.8 -Darchlib=/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi -Dsitearch=/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi -Dvendorarch=/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi -Darchname=x86_64-linux-thread-multi -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.7 5.8.6 5.8.5 -Dscriptdir=/usr/bin' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-52)', 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='gcc', ldflags ='' libpth=/usr/local/lib64 /lib64 /usr/lib64 libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Feb 22 2012 11:13:04 @INC: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8

      For Config.pm: # This is CPAN.pm's systemwide configuration file provided for # ActivePerl. This file provides defaults for users, and the values # can be changed in a per-user configuration file. The user-config # file is being looked for as ~/.cpan/CPAN/MyConfig.pm. my $CPAN_HOME = "$ENV{HOME}/.cpan"; $CPAN_HOME = do {require Config; "$Config::Config{prefix}/cpan"} if $^O eq "MSWin32"; my $SHELL = $ENV{SHELL}; $SHELL ||= $ENV{COMSPEC} if $^O eq "MSWin32"; my $PAGER = $ENV{PAGER} || "more"; $CPAN::Config = { 'auto_commit' => 0, 'build_cache' => "10", 'build_dir' => "$CPAN_HOME/build", 'cache_metadata' => 1, 'colorize_output' => 1, 'colorize_print' => "green", 'colorize_warn' => "red", 'cpan_home' => $CPAN_HOME, 'ftp' => '', 'ftp_proxy' => '', 'getcwd' => '', 'gpg' => '', 'gzip' => '', 'histfile' => "$CPAN_HOME/histfile", 'histsize' => 100, 'http_proxy' => '', 'inactivity_timeout' => 0, 'index_expire' => 1, 'inhibit_startup_message' => 0, 'keep_source_where' => "$CPAN_HOME/sources", 'load_module_verbosity' => 'none', 'lynx' => '', 'make' => '', 'make_arg' => '', 'make_install_arg' => '', 'makepl_arg' => 'INSTALLDIRS=site', 'mbuild_arg' => '', 'mbuild_install_arg' => '', 'mbuildpl_arg' => '--installdirs=site', 'no_proxy' => '', 'pager' => $PAGER, 'prerequisites_policy' => 'follow', 'scan_cache' => 'atstart', 'shell' => $SHELL, 'tar' => '', 'term_is_latin' => 1, 'unzip' => '', 'urllist' => 'http://ppm.activestate.com/CPAN', 'http://cpan.perl.org', 'wget' => '', 'yaml_module' => qYAML::XS, }; if ($^O eq "MSWin32") { $ENV{TERM} = "dumb"; $CPAN::Config->{colorize_output} = eval { require Win32::Console::ANSI }; } else { $CPAN::Config->{mbuild_install_build_command} = './Build install'; } 1;

      Though I'm not sure if that's the correct one since I found so many Config.pm in a lot of directories.

        Quoting your Perl configuration:
        -Dprivlib=/usr/lib/perl5/5.8.8
        -Dsitelib=/usr/lib/perl5/site_perl/5.8.8
        -Dvendorlib=/usr/lib/perl5/vendor_perl/5.8.8
        -Darchlib=/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi
        -Dsitearch=/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
        -Dvendorarch=/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi

        The problem stems from Redhat's practice of defining these divergent paths explicitly at compile time. I cannot fathom why, but probably they thought they had a good reason to do so. (Normally one only defines a common prefix.)

        Your Perl is very old and unsupported. You should get an updated package for your OS, or if failing that, simply abandon the installation compile your own current stable of Perl (as of now this is version 5.16.0) into a different prefix. Perlbrew helps you automate most parts of that.

Re: Setting build path for modules
by sundialsvc4 (Abbot) on Jul 18, 2012 at 17:51 UTC

    Strictly speaking, there are two ways that modules may be built; there are CPAN configuration variables corresponding to both of them.   In my experience, you need to separately and correctly set both.

    In addition, you need to be sure that the PERL5LIB environment variable includes the target path ... before you actually start trying to install anything.   Typically, you do this by editing the .bash_profile file on Unix/Linux and then reading it using the source command.   In Windows, this setting is made (of course) in the Registry by means of the System control panel or otherwise.

    (If you don’t do this first, then Perl will attempt to self-test the modules that it has just built, but those modules won’t know where to find themselves or anything else because PERL5LIB isn’t set yet.   Not pretty.   Did that one “bite” me once?   You bet it did!)

    You are correct that the “base” library search-path is hard-coded into the Perl executable such that it can be obtained by perl -V with a capital “V” as you did.   However, this is only the base contents of @INC before added-to by PERL5LIB and so on; it does not specify the build-targets for CPAN purposes.

Re: Setting build path for modules
by Anonymous Monk on Jul 19, 2012 at 01:57 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://982477]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 16:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found