LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-02-2017, 09:59 AM   #1
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Rep: Reputation: 68
Change shipped Perl package compile options to use /usr, not /usr/local


I am not 100% sure about this, but it seems that CPAN generates its own settings on first run based on paths compiled into Perl. On Slackware, the default Perl package lists the following paths:

Code:
#perl -V
...
  Built under linux
  Compiled at Apr 29 2016 23:26:30
  @INC:
    /usr/local/lib64/perl5
    /usr/local/share/perl5
    /usr/lib64/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib64/perl5
    /usr/share/perl5
As a result of the above, CPAN installs its modules in /usr/local/share/perl5 (and some other locations under /usr/local).

As all other software in Slackware appears to be using the /usr and not /usr/local path, would it be possible to compile the default shipped Perl package with appropriate arguments so that the /usr/local paths don't appear in its @INC statements? Hopefully, this will also convince CPAN to install modules by default under /usr, not /usr/share.

At the moment I have to modify manually /root/.cpan/CPAN/MyConfig.pm (after first CPAN run) and amend the following:

Code:
  'makepl_arg' => q[PREFIX=/usr/],
  'mbuild_arg' => q[--install_base /usr/],

Last edited by xj25vm; 02-02-2017 at 10:00 AM.
 
Old 02-02-2017, 10:13 AM   #2
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,103

Rep: Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178
IMHO, is not a good idea to let CPAN install untracked files into /usr that should be left to files handled by pkgtools...

if someone needs CPAN badly, an option should be to use cpan2tgz.

Last edited by ponce; 02-02-2017 at 10:15 AM.
 
Old 02-02-2017, 10:54 AM   #3
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Original Poster
Rep: Reputation: 68
@ponce Is there a particular reasoning behind advising against the use of CPAN? Using the settings I suggested above, CPAN installs its modules in /usr/share/perl5 - all in one place. Is there something particularly wrong or dangerous about using CPAN? I confess to not knowing a much about Perl or CPAN beyond installation and configuration of stuff.
 
Old 02-02-2017, 11:20 AM   #4
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,103

Rep: Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178
CPAN doesn't track whatever is installed so if you have to upgrade, remove or whatever the stuff you installed using that you usually get into deep s**t (sorry for my french).

issues related to the use of CPAN have been reported a lot lately because, to make things worse, perl devs made slackware-14.2's perl binary incompatible with slackware-14.1's perl, so whoever had used CPAN to install perl modules in 14.1, after upgrading to 14.2, got a segfaulting perl interpreter: as the only way to fix these segfaults would have been cleaning every third party module and rebuilding them from CPAN, not having the possibility to track stuff had obviously became a PITA for people needing to upgrade.

that's the reason why it's recommended to use packages to install perl modules.

if you let CPAN install stuff in /usr instead of /usr/local, mixing this way modules and files installed via packages with others installed via CPAN, tracking things surely will become even a scarier nightmare.

Last edited by ponce; 02-02-2017 at 11:44 AM.
 
1 members found this post helpful.
Old 02-02-2017, 01:17 PM   #5
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Original Poster
Rep: Reputation: 68
Well, first of all, although the path which goes in the CPAN config (which I suggested in my first post) is /usr, the CPAN stuff doesn't actually go directly into /usr. This is only used as the base to generate the install path, which, as I mentioned above, seems to be /usr/share/perl5 - which means they don't mix with files from other software or packages.

As to the second problem of Perl incompatibility between Slack 14.1 and 14.2, I got that on a number of machines as well. However, I simply deleted all CPAN modules (which at the time on these machines were in the default /usr/local/...) - and re-installed all modules through CPAN. I'm not sure how this is such a major PITA. I would say having to download, build and install separately about 20 Perl modules from slackbuilds (required in my case by Spamassassin), instead of using CPAN commands directly (which can also be told to install dependencies, incidentally) was a much bigger PITA.

I use the Slackware package manager for everything else, but frankly, in the case of Perl modules, I'm not sure I can see the point, when CPAN was designed specifically for that. On the other hand, everybody has different preferences, and if the "official" or "semi-official" line on Slackware is to discourage the use of CPAN, that is equally fine with me :-)

Edit: Also, according to the docs, "cpan -l" will list all the modules it has installed.

Last edited by xj25vm; 02-02-2017 at 01:27 PM.
 
Old 02-02-2017, 01:59 PM   #6
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,103

Rep: Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178Reputation: 4178
Quote:
Originally Posted by xj25vm View Post
Well, first of all, although the path which goes in the CPAN config (which I suggested in my first post) is /usr, the CPAN stuff doesn't actually go directly into /usr. This is only used as the base to generate the install path, which, as I mentioned above, seems to be /usr/share/perl5 - which means they don't mix with files from other software or packages.
perl, git, linuxdoc-tools, samba and whatever you install from SBo, for example, install things in /usr/share/perl5.
binaries from perl modules are installed in $PREFIX/bin.

Quote:
As to the second problem of Perl incompatibility between Slack 14.1 and 14.2, I got that on a number of machines as well. However, I simply deleted all CPAN modules (which at the time on these machines were in the default /usr/local/...) - and re-installed all modules through CPAN. I'm not sure how this is such a major PITA. I would say having to download, build and install separately about 20 Perl modules from slackbuilds (required in my case by Spamassassin), instead of using CPAN commands directly (which can also be told to install dependencies, incidentally) was a much bigger PITA.
it depends on what you install: I seem to remember that some things (sorry if I don't recall which ones ATM), despite the CPAN default path being /usr/local, still install in /usr.
but if you install them in /usr by default surely you cannot easily remove them like you do when they're installed in /usr/local: also, if you install other stuff in /usr/local it will mix, for example, with perl binaries, making it difficult to discern them if removing is needed.
instead, installing spamassassin via sbopkg or something else is pretty easy (dependencies are handled) and removing or upgrading packages is absolutely painless.

Quote:
I use the Slackware package manager for everything else, but frankly, in the case of Perl modules, I'm not sure I can see the point, when CPAN was designed specifically for that. On the other hand, everybody has different preferences, and if the "official" or "semi-official" line on Slackware is to discourage the use of CPAN, that is equally fine with me :-)
let me state again, if needed, that my opinions are my own, they're not "official" or "semi-official"
if you look for "perl segfault" in this forum you can find some of the report I cited and you can see that, if you don't know very well what you're doing (if you know it you should be fine), installing from CPAN can mess very bad with your system.
but, in the end, everybody is free to do whatever he prefers with his own installation

Quote:
according to the docs, "cpan -l" will list all the modules it has installed.
that will list every module installed, via CPAN or via package.
also consider that CPAN, during its installation of stuff, can also upgrade perl core modules or things that you have installed via packages, potentially mixing/breaking things.

if you want to handle things via CPAN maybe the cleaner way should be to:
- remove the Slackware perl package;
- install your perl interpreter from source;
- rebuild the packages cited above provided with Slackware and whatever you installed from third party repos (SBo, etc.) that contains perl modules over this new perl;
- install whatever you want via CPAN.

Last edited by ponce; 02-02-2017 at 11:57 PM.
 
Old 02-03-2017, 03:33 AM   #7
drmozes
Slackware Contributor
 
Registered: Apr 2008
Distribution: Slackware
Posts: 1,545

Rep: Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313Reputation: 1313
Quote:
Originally Posted by ponce View Post
CPAN doesn't track whatever is installed so if you have to upgrade, remove or whatever the stuff you installed using that you usually get into deep s**t (sorry for my french).
You can track perl installations with CPAN using slacktrack from the 'd' package series.
Check its documents for examples.
 
2 members found this post helpful.
Old 02-03-2017, 06:42 AM   #8
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
Thanks drmozes.

I didn't know about slacktrack.

Lots to learn and it looks interesting ...

I've scanned, not really read all the documentation.

Do you have any additional advice about slacktrack and production machines ?

Thanks !

-- kjh
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/usr vs /usr/local (& /opt) when describing non system software (debate welcomed) Alpha90 Linux - Software 2 07-07-2012 03:22 AM
What options do I need to pass to compile something to /usr/lib64? neocookie Linux - Software 3 04-30-2010 01:35 PM
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 08:33 AM
making files available in /usr/local/bin and /usr/sbin reakinator Linux - Newbie 1 10-14-2006 05:09 PM
Installing software, /usr/lib directory and /usr/local millertime Linux - Software 2 07-10-2004 09:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration