in reply to Perl DBI installation problem on MacOS Sierra - Can't open blib/lib/DBI/Util/

G'day Nanjizal,

Welcome to the Monastery.

I have almost the same OS as you: macOS Sierra 10.12.5. It has the same System Perl version as yours (i.e. 5.18.2). I recommend, in the strongest possible terms, that you do not use the System Perl!

The Perl set up by Apple (the System Perl) is for their use. By installing modules using the System Perl, you run the risk of overwriting what the OS is expecting, and could potentially break some part of your system. The biggest problem, however, is that when you next upgrade the system (e.g. macOS High Sierra 10.13.x has been recently released), the entire, current v5.18 could be wiped (including every module you've installed) and replaced with a newer Perl version.

What I do recommend you use is Perlbrew. I've been using this for many years; I have about a dozen different versions of Perl installed using this; and I've never lost anything when upgrading the system (I think I started with 10.6.x "Snow Leopard?").

Once you have Perlbrew installed, you can install as many Perl versions as you want. Its documentation explains how to do that, but ask if you need any help.

When you have a Perl version installed (the current, stable version is v5.26.1), you can start installing additional modules (such as DBI). I typically use the builtin cpan utility; there are others available, cpanm seems to be fairly popular at the moment, "How to install CPAN modules" lists a variety of options.

One final point, you should never need sudo when installing modules, whether using utilities or doing it manually, e.g.

perl Makefile.PL && make && make test && make install

— Ken

Replies are listed 'Best First'.
Re^2: Perl DBI installation problem on MacOS Sierra - Can't open blib/lib/DBI/Util/
by Nanjizal (Novice) on Oct 27, 2017 at 10:57 UTC

    Hi Ken

    Many thanks for your tips and advice.

    I wasn't aware of the system Perl issue, thank you for pointing that out.

    I successfully installed Perlbrew, which sounds like a sensible way of doing things.

    Unfortunately, installation of the latest stable version of Perl (v5.26.1) throws up the following error, when using the command $perlbrew install stable:

    or-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PU +TENV -std=c89 -O3 -Wall -Werror=declaration-after-statement -Wextra - +Wc++-compat -Wwrite-strings miniperlmain.c cc -mmacosx-version-min=10.12 -fstack-protector-strong -L/usr/local/li +b -L/opt/local/lib -force_flat_namespace -o miniperl \ opmini.o perlmini.o gv.o toke.o perly.o pad.o regcomp.o dump.o ut +il.o mg.o reentr.o mro_core.o keywords.o hv.o av.o run.o pp_hot.o sv. +o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint +.o deb.o universal.o globals.o perlio.o perlapi.o numeric.o mathoms.o + locale.o pp_pack.o pp_sort.o caretx.o dquote.o time64.o miniperlmai +n.o -lpthread -ldl lmm -lutil -lc clang: error: no such file or directory: 'lmm' make: *** [lib/buildcustomize.pl] Error 1 ##### Brew Failed #####

    I couldn't find any information on this error, so if you have any pointers on how to get around this I would be very grateful!

      "Many thanks for your tips and advice."

      You're very welcome.

      "Unfortunately, installation of the latest stable version of Perl (v5.26.1) throws up the following error, when using the command $perlbrew install stable: ..."

      I think you may have missed the beginning of the error message (perhaps where the text wrapped). What you posted begins with "or-strong ..."; I see on the next line "... -fstack-protector-strong ..."; maybe you've chopped off that first line in the middle of an option similar to that.

      Further down, I see "clang: error: no such file or directory: 'lmm'". The line immediately before that ends with "... -lpthread -ldl lmm -lutil -lc": I'm wondering if "lmm" should really be "-lmm", which would match all the "-l*" parts surrounding it.

      A search for the clang error didn't provide any useful results. I also had a look in "Active bugs for App-perlbrew": none of the "Subject" lines seemed relevant (although, they're not always as descriptive as they might be).

      I don't normally use the "install stable" command; in fact, it's possible I've never used it. I typically have some non-default options, so I use a command with this format:

      $ perlbrew install -v DOWNLOAD_URL -Dusethreads --as perl-5.x.xt

      I get the DOWNLOAD_URL directly from the CPAN page (in the top-right corner you'll see "Download: link-to-tarball). So for 5.26.1, the link is http://search.cpan.org/CPAN/authors/id/S/SH/SHAY/perl-5.26.1.tar.gz, and the command would be:

      $ perlbrew install -v http://search.cpan.org/CPAN/authors/id/S/SH/SHAY +/perl-5.26.1.tar.gz -Dusethreads --as perl-5.26.1t

      I haven't installed 5.26.1. The last one was 5.26.0, the link is http://search.cpan.org/CPAN/authors/id/X/XS/XSAWYERX/perl-5.26.0.tar.bz2, and the command I would have used was:

      $ perlbrew install -v http://search.cpan.org/CPAN/authors/id/X/XS/XSAW +YERX/perl-5.26.0.tar.bz2 -Dusethreads --as perl-5.26.0t

      You can try either of those yourself. They both install Perl with thread support; if you don't want threads, omit the -Dusethreads, and leave off the "t" from the end of perl-5.x.xt (that's just my own convention to indicate threads).

      I don't recall having any problems installing Perl using that method. I have successfully installed all of these:

      $ perlbrew list perl-5.14.0t perl-5.14.2 perl-5.14.2t perl-5.18.0t perl-5.18.1t perl-5.20.0t perl-5.20.2t perl-5.22.0t perl-5.24.0t perl-5.25.9t * perl-5.26.0t

      — Ken

        Hi Ken,

        Thanks again for the tips, and for searching around for me.

        I tried those suggestions, but I still always run into the same error (example output provided below).

        I don't know whether it's perhaps something to do with the new 'System Integrity Protection' feature of MacOS limiting access etc?

        In any case, I've switched to using Macports and things seem to be working okay. I'm using a local version of Perl in /opt/local/bin/ instead of the system Perl.