Looking at my Perl installation, I groan in despair. (Hahaha – been there, done that: 2006-09-05 Perl Installation.)
There’s `/usr/bin/perl` identifying as `v5.8.1-RC3`, and there’s `/opt/local/bin/perl` identifying as `v5.8.8`.
So, where do I expect the manual pages of packages I install via `cpan`?
In `/opt/local/man/man3` of course. But why oh why do I also see similar files in `/man/man3`?
And here’s what I find in my `~/.profile`:
1. there's no MANPATH by default, and manpath(1) just prints /usr/share/man if [ -z "$MANPATH" ]; then # cpan seems to install in /man... :( export MANPATH=/man:/opt/local/man:/usr/local/man:/usr/local/share/man:/usr/X11R6/man:/usr/share/man export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:/usr/local/sbin:$PATH export INFOPATH=/opt/local/share/info:/usr/local/info:/usr/local/share/info:/usr/share/info fi
I tried to run `cpan` and then run `install Bundle::CPAN` to upgrade my CPAN thing. There are endless unsatisfied prerequisites I don’t understand, missing installation permissions, and so on.
Example:
... Running make install Warning: You do not have permissions to install into /opt/local/lib/perl5/site_perl/5.8.8/darwin-2level at /opt/local/lib/perl5/5.8.8/ExtUtils/Install.pm line 114. mkdir /opt/local/lib/perl5/site_perl/5.8.8/File: Permission denied at /opt/local/lib/perl5/5.8.8/ExtUtils/Install.pm line 176 make: *** [pure_site_install] Error 13 /usr/bin/make install -- NOT OK Running install for module IO::Compress::Gzip::Constants Running make for P/PM/PMQS/IO-Compress-Zlib-2.005.tar.gz Is already unwrapped into directory /Users/alex/.cpan/build/IO-Compress-Zlib-2.005 Has already been processed within this session Running make test Won't repeat unsuccessful test during this command Running make install make test had returned bad status, won't install without force ...
Why is everything so confusing. I’d like to start again with a clean slate.
1. What’s the best way to install Perl such that you really understand what’s going on? Just redo the entire thing using `sudo`?
2. Is it really worth it to run all the tests? And if not, how can I disable it?
3. How can I tell `cpan` to just do all the prerequisites without asking me about it?
Time passes and I think that I can remove `/man` – all the files in there are from 2005. Using `sudo` when calling `cpan` basically solved all my problems. The man pages are installed in the right directories.
And rerunning the new `cpan` version asks me: “Policy on building prerequisites (follow, ask or ignore)? [ask]” to which I answer: “follow”.
I decided to keep running `cpan` as root (using `sudo`) and thus didn’t provide an answer to the following question:
Parameters for the 'perl Makefile.PL' command? Typical frequently used settings: PREFIX=~/perl # non-root users (please see manual for more hints)
Yeah, call me a chicken. 😄
I did change my answer to the following question, however:
Do you want to use a different command for './Build install'? Sudo users will probably prefer: su root -c ./Build or sudo ./Build or /path1/to/sudo -u admin_account ./Build or some such. Your choice: [./Build]
I answered: “sudo .*Build”*
Wish me luck. ;)
Hm, restarting `cpan` without `sudo` I see that I’m asked about all these options again. I guess user alex cannot read that sudo-created config file... Interesting. I’ll try to chown all the stuff in `~/.cpan` over to user alex:
sudo chown alex `find .cpan -user root`
Still no luck. I think my problem is that using `sudo cpan` has stored my config options in `/opt/local/lib/perl5/5.8.8/CPAN/Config.pm` instead of `~/.cpan/CPAN/MyConfig.pm`.
Grrrr. So I answer all the questions again. And at the end I see that the data is saved to `/Users/alex/Library/Application Support/.cpan/CPAN/MyConfig.pm`. Interesting... 😄
I think it should work, now.
Except... Yikes!!
_opt_local/lib/perl5/5.8.8/darwin-2level/auto/File/Glob/Glob.bundle undefined reference to _PL_curpad expected to be defined in a dynamic image##
Ayeeeeee!
How weird is that? When I run my code directly using `perl ...`, no problem. When I run `make test`, tons of problems. Apparently, `make test` for Oddmuse uses the following:
`perl -e 'use Test::Harness; $Test::Harness::switches = ""; runtests @ARGV;' t/*.t`
Indeed, that does cause the error! Calling `prove t` causes the same problem. I’m in trouble.
And running `cpan File::Glob` says “File::Glob is up to date (1.05).”
My problem is that running `force install File::Glob` tries to download `perl-5.8.8.tar.gz`.
I am so in trouble.
Oh, and I discovered the `notest` prefix for commands. 😄
What is it about Test::Harness that breaks Perl and File::Glob.
Take a wild guess and looking at the output of `r` where it lists the modules that need upgrading, I tried to `upgrade AutoLoader`. And I get “CPAN.pm needs either the external programs tar, gzip and bzip2 installed. Can’t continue.”
Weird. I do have `/usr/bin/tar /usr/bin/gzip /opt/local/bin/bzip2`.
I guessed that I had to run `o conf tar /usr/bin/tar` etc. That seemed to work, because now I get a different error when I try to `install AutoLoader`: I get a “permission denied” while installing! And it says:
You may have to su to root to install the package (Or you may want to run something like o conf make_install_make_command ’sudo make’ to raise your permissions.
How strange. I thought I had answered this question correctly up above. So I did `o conf make_install_make_command "sudo make"` and `force install AutoLoader` and managed to install it. And I got asked for my password! Yay!
Unfortunately the File::Glob error did not disappear. 🙁
And a `force install File::Glob` will rebuild perl5. Interesting... Aaaaargh!
Now rebuilding Perl into `/usr/local` instead of `/opt/local` (which is the DarwinPorts things).
I feel much better now. I just hope it all works out.
I guess I’ll end up with three Perl installations. The OSX default Perl installation in `/usr`, the MacPorts Perl installation in `/opt/local`, and my local copy in `/usr/local`.
So now I’m trying to use `sudo port uninstall ....` for package `perl5.8` and its dependents.
Except... Now I have to install Bundle::CPAN *again*! Groan...
Finally (running `make test` for Oddmuse):
All tests successful. Files=67, Tests=1357, 900 wallclock secs (474.94 cusr + 92.32 csys = 567.26 CPU)
Some more struggling with my Makefile and I think a new Oddmuse release is ready! 😄
a new Oddmuse release is ready
#Perl #Software
(Please contact me if you want to remove your comment.)
⁂
this helped, thanks
– luis 2009-03-31 17:57 UTC
---
Hehe, it’s a long story and in the end the answer is “install from scratch” which is bummer. But at least it works. Glad I could help.
– Alex Schroeder 2009-03-31 20:51 UTC