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

Well, this post may be inadequately titled, and inappropriately situated in PM, but hopefully some of you can give me your insights.

A couple of days ago I upgraded my Macbook Pro from Mac OS X 10.4.x aka Tiger to Mac OS X 10.5.1 aka Leopard. My laptop had my own version of Perl 5.8.8 installed under /usr/local called as #!/usr/local/bin/perl in my scripts. I had installed it a while back, with 100% of its make test passed.

When I upgraded my operating system, it didn't even occur to me that my personal Perl install would get whacked, but it seems that's what happened. As I started running my scripts, I found none of them would run. Here is a typical script and error msg

---- start test script ----------------------- #!/usr/local/bin/perl -w use strict; use diagnostics; use DBI qw(:sql_types); ... ---- end test script ------------------------- 12:45 AM] ~/Data/ckb$ ./foo.pl Can't locate strict.pm in @INC (@INC contains: /usr/local/lib/perl5/5. +8.8/darwin-2level /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/sit +e_perl/5.8.8/darwin-2level /usr/local/lib/perl5/site_perl/5.8.8 /usr/ +local/lib/perl5/site_perl .) at foo.pl line 3. BEGIN failed--compilation aborted at foo.pl line 3. [12:45 AM] ~/Data/ckb$ which perl /usr/local/bin/perl [12:45 AM] ~/Data/ckb$ perl -v This is perl, v5.8.8 built for darwin-2level Copyright 1987-2006, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge. [12:46 AM] ~/Data/ckb$ perl -e 'print "hello world\n"'; hello world

At this time I thought that perhaps I had to rebuild my Perl because I had installed Leopard. Gearing up for a few hours of installation cycle, I decided to do just that. But this quickly became a nightmare. My original Perl source distro would break on testing. Typical broken tests were

Failed 5 test scripts out of 932, 99.46% okay. ### Since not all tests were successful, you may want to run some of ### them individually and examine any diagnostic messages they produce +. ### See the INSTALL document's section on "make test". ### You have a good chance to get more information by running ### ./perl harness ### in the 't' directory since most (>=80%) of the tests succeeded. ### You may have to set your dynamic library search path, ### DYLD_LIBRARY_PATH, to point to the build directory: ### setenv DYLD_LIBRARY_PATH `pwd`; cd t; ./perl harness ### DYLD_LIBRARY_PATH=`pwd`; export DYLD_LIBRARY_PATH; cd t; ./perl +harness ### export DYLD_LIBRARY_PATH=`pwd`; cd t; ./perl harness ### for csh-style shells, like tcsh; or for traditional/modern ### Bourne-style shells, like bash, ksh, and zsh, respectively. u=1.41 s=1.56 cu=146.16 cs=27.03 scripts=932 tests=117319 make[2]: *** [_test_tty] Error 1 make[1]: *** [_test] Error 2 make: *** [test] Error 2

Very surprising, because this was the same distro that had installed earlier with 100% tests passed. So I decided to do more testing.

[12:11 AM] ~/Projects/perl-5.8.8$ export DYLD_LIBRARY_PATH=`pwd` [12:20 AM] ~/Projects/perl-5.8.8$ cd t [12:20 AM] ~/Projects/perl-5.8.8/t$ ./perl harness .. comp/colon..................................ok + comp/cpp....................................cc1: error: /usr/local/lib +/perl5/5.8.8: Too many levels of symbolic links FAILED before any test output arrived comp/decl...................................ok .. run/switchp.................................ok + run/switchPx................................cc1: error: /usr/local/lib +/perl5/5.8.8: Too many levels of symbolic links FAILED before any test output arrived run/switcht.................................ok .. op/pwent....................................FAILED test 1 + Failed 1/2 tests, 50.00% okay op/qq.......................................ok .. ../lib/ExtUtils/t/dir_target................ok + ../lib/ExtUtils/t/Embed.....................cc1: error: /usr/local/lib +/perl5/5.8.8/darwin-2level/CORE: Too many levels of symbolic links ../lib/ExtUtils/t/Embed.....................FAILED tests 1-9 + Failed 9/9 tests, 0.00% okay .. # None of your locales were broken. ../lib/locale...............................FAILED test 99 + Failed 1/117 tests, 99.15% okay .. Failed Test Stat Wstat Total Fail Failed List of Faile +d ---------------------------------------------------------------------- +--------- ../lib/ExtUtils/t/Embed.t 9 9 100.00% 1-9 ../lib/locale.t 117 1 0.85% 99 comp/cpp.t ?? ?? % ?? op/pwent.t 2 1 50.00% 1 run/switchPx.t ?? ?? % ?? 59 tests and 242 subtests skipped. Failed 5/996 test scripts, 99.50% okay. 11/117332 subtests failed, 99. +99% okay.

Well, after a lot of futzing around, I discovered that in my older /usr/local/lib/ had been renamed to /usr/local/lib 1/, and a new symbolic link had been created from /usr/local/lib/ --> /usr/local/lib/. I am assuming my Leopard installation did that because I am neither smart enough to do something like that, nor dumb enough to create a circular link. But that did explain the "Too many levels of symbolic links" error. Phew. That still didn't explain the other errors such as locale errors.

Anyhoo... I deleted the symbolic link, and renamed /usr/local/lib 1/ to /usr/local/lib/ and everything started working fine. I haven't tested all my modules and all my scripts, but things mostly seem to be ok again. Well, DBI is working, and that makes me happy more than anything. I would still like to know

Update: After setting the /usr/local/lib/ path right, I am down to two tests that fail.

Failed Test Stat Wstat Total Fail Failed List of Failed ---------------------------------------------------------------------- +--------- ../lib/locale.t 117 1 0.85% 99 op/pwent.t 2 1 50.00% 1 58 tests and 230 subtests skipped. Failed 2/996 test scripts, 99.80% okay. 2/117361 subtests failed, 100. +00% okay.

Both seem harmless (some esoteric locale is clobbered -- see below) and I guess I could live with them, but would still like to understand why this happened, and why these two tests are now failing that all passed with Tiger.

# # The locale definition # # be_BY.CP1131 # # on your system may have errors because the locale test 99 # failed in that locale.

--

when small people start casting long shadows, it is time to go to bed

Replies are listed 'Best First'.
Re: strange "Perl on Leopard" install behavior
by Corion (Patriarch) on Jan 12, 2008 at 15:39 UTC

    I recomment installing Perl under /opt/perl or in your user home directory instead of putting it anywhere where the operating system thinks it could reach. That way, barring any binary incompatibilities with system libraries your Perl links dynamically to, an OS upgrade should go without a hitch.

      Thanks, that is a good suggestion. And, when I do it again, I might well consider it. Two points, however --
      1. Why on earth did my OS install tinker with /usr/local/ as I was under the impression that that location was for stuff that I, the user, would install?
      2. Installing stuff under /usr/local/ helps with subsequent and other installs that expect to find shared libraries and stuff in that location via autoconf, as I understand. If I install under my home dir or some other location, I will have to custom tailor all my installations of all other software that might depend on each other.
      --

      when small people start casting long shadows, it is time to go to bed
        I do installs into /usr/local under Solaris as it is a common target location for a lot of stuff, especially packages from http://www.sunfreeware.com. However, to avoid having the o/s mess with it I actually have a separate partition that I mount as /local and make /usr/local a symbolic link to it. Thus, all of my installed packages are held away from /usr. I can then break that link when tinkering with upgrades and remake it again once the danger has, hopefully, passed.

        Cheers,

        JohnGG

      Just a habbit I've picked up.

      The first thing I do is symlink /opt to /usr/local or vice-versa. Makes installations a lot easier.

      --
      I used to drive a Heisenbergmobile, but every time I looked at the speedometer, I got lost.
Re: strange "Perl on Leopard" install behavior
by KurtSchwind (Chaplain) on Jan 12, 2008 at 21:45 UTC

    Is there a particular reason you rolled your own perl on you laptop?

    I have a macbook pro with Leopard installed. It has :

    Macintosh: kurt$ which perl /usr/bin/perl Macintosh: kurt$ perl --version This is perl, v5.8.8 built for darwin-thread-multi-2level
    And I can cpan anything I want. I can understand if you wanted to run 5.10 or something, but if you are also running 5.8.8, why not use the one that comes with Leopard? Maybe I missed it in your post.

    --
    I used to drive a Heisenbergmobile, but every time I looked at the speedometer, I got lost.
      why do I want to install my own Perl 5.8.8 when Leopard comes with Perl 5.8.8?

      because I don't trust my competence with installing Perl and its various moving parts, and I do experiment quite a bit. As such, I don't want to do *anything* to the factory Perl. By rolling my own, I also get to learn, and that way, when I install my programs on other machines (mainly web programs that I develop on my laptop, and then install for production on other servers on which also I install my Perl) I am hopefully that much savvier. Since my laptop is really my lifeline and sole device for earning bread, I just don't want to muck with any of the factory stuff.

      I was going to install 5.10 but then I read the caveat on perl.com and just didn't have the heart to get into testing my programs, etc. 5.8.8 works for me, and very well, and I will happily stay with it for a few months if not a year or so.

      --

      when small people start casting long shadows, it is time to go to bed
Re: strange "Perl on Leopard" install behavior
by jasonk (Parson) on Jan 13, 2008 at 00:28 UTC

    FWIW, I also have a custom perl install in /usr/local/, and had no problems after upgrading to Leopard, so it may not have been the upgrade that caused your problems...


    We're not surrounded, we're in a target-rich environment!

      Ok, so of course I spoke too soon. I hadn't had any problems after upgrading to Leopard, until just now, when I installed the latest version of Xcode and ran into the same thing. So it appears it's the Developer tools upgrade that does this, not the Leopard upgrade itself.


      We're not surrounded, we're in a target-rich environment!
        phew! your earier post freaked me out as I knew that *I* hadn't done any tinkering with /usr/local/lib, so if I hadn't then who had? Which software? Now I know. Yes, I also installed Xcode 3. All I can ask is, WTF?
        --

        when small people start casting long shadows, it is time to go to bed