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

Hi Monks! I'm new to Perl and am trying to set up perl DBI so I can get started with MySQL. I've run into a problem with DBI that arises during the make stage of the installation, and would greatly appreciate some help with solving the issue.

I am trying to install DBI v1.637 using Perl v5.18.2, on MacOS Sierra v10.12.6. However, the problem persists for other recent DBI versions, and occurs when using cpan or a tarball. I've included a copy of the makefile that is generated here: pastebin.com/mXaxUaYX and terminal output below after running the makefile and then make as sudo. Many thanks for your help

/usr/bin/perl -MExtUtils::Command -e 'mkpath' -- blib/lib/DBI rm -f blib/lib/DBI/Changes.pm cp Changes blib/lib/DBI/Changes.pm cp lib/DBD/File/Roadmap.pod blib/lib/DBD/File/Roadmap.pod cp dbi_sql.h blib/arch/auto/DBI/dbi_sql.h cp lib/DBD/Sponge.pm blib/lib/DBD/Sponge.pm cp dbipport.h blib/arch/auto/DBI/dbipport.h cp lib/DBI/DBD/Metadata.pm blib/lib/DBI/DBD/Metadata.pm cp lib/DBI/SQL/Nano.pm blib/lib/DBI/SQL/Nano.pm cp lib/DBI/Gofer/Serializer/DataDumper.pm blib/lib/DBI/Gofer/Serialize +r/DataDumper.pm cp lib/DBI/Const/GetInfo/ODBC.pm blib/lib/DBI/Const/GetInfo/ODBC.pm cp lib/DBD/File/Developers.pod blib/lib/DBD/File/Developers.pod cp lib/DBI/Gofer/Transport/Base.pm blib/lib/DBI/Gofer/Transport/Base.p +m cp lib/DBI/Util/_accessor.pm blib/lib/DBI/Util/_accessor.pm cp lib/DBD/NullP.pm blib/lib/DBD/NullP.pm cp lib/DBI/DBD/SqlEngine/Developers.pod blib/lib/DBI/DBD/SqlEngine/Dev +elopers.pod cp lib/DBI/ProfileDumper/Apache.pm blib/lib/DBI/ProfileDumper/Apache.p +m cp lib/DBI/PurePerl.pm blib/lib/DBI/PurePerl.pm cp lib/DBI/ProfileSubs.pm blib/lib/DBI/ProfileSubs.pm cp dbivport.h blib/arch/auto/DBI/dbivport.h cp dbixs_rev.h blib/arch/auto/DBI/dbixs_rev.h cp lib/DBI/Gofer/Serializer/Base.pm blib/lib/DBI/Gofer/Serializer/Base +.pm cp lib/DBI/Const/GetInfoType.pm blib/lib/DBI/Const/GetInfoType.pm cp dbd_xsh.h blib/arch/auto/DBI/dbd_xsh.h cp lib/DBD/Gofer/Policy/Base.pm blib/lib/DBD/Gofer/Policy/Base.pm cp lib/DBI/Util/CacheMemory.pm blib/lib/DBI/Util/ AutoSplit: Can't open blib/lib/DBI/Util/.pm: No such file or directory make: *** [pm_to_blib] Error 2
  • Comment on Perl DBI installation problem on MacOS Sierra - Can't open blib/lib/DBI/Util/
  • Download Code

Replies are listed 'Best First'.
Re: Perl DBI installation problem on MacOS Sierra - Can't open blib/lib/DBI/Util/
by roboticus (Chancellor) on Oct 26, 2017 at 13:31 UTC

    Nanjizal:

    I looked through the makefile to see where CacheMemory.pm was used after Gofer/Policy/Base.pm and couldn't find that sequence. I didn't see anything obvious in the makefile. (I've not debugged module installations in any detail, though, so not much would be obvious to me.)

    (Note: By the way, putting the makefile in pastebin is considered bad form here, as the link could go stale and make this thread useless to future people with the same or similar problem. You ought to wrap the makefile in <readmore><code> ... </code></readmore> tags to keep the data in the node. This way, the makefile is available to anyone who needs to dig through it, but not force all that to be displayed unless someone really wants to see it.)

    I don't have a system I can conveniently try to reproduce your problem, so I next looked at AutoSplit.pm and found the error message in the autosplit_file() subroutine, where the $file is an argument. It's called in two places (in v1.06 anyway): autosplit() and autosplit_lib_modules(). Since it seems likely that the second one is where the difficulty arises, I'd suggest putting print "<$_>\n"; just after the initial while statement so you can see what it's trying to do and see if there's some unusual filename that's confusing it. In cases like this, I'll frequently also drop a print "autosplit beg\n"; at the beginning of the subroutine and print "autosplit end\n"; at the end of the routine, just to put a "wrapper" around it to ensure that the error actually appears within the subroutine (rather than shortly afterwards, for example). That way, if the autosplit() call was the culprit rather than the suspected autosplit_lib_modules() subroutine, you'd see the error without the wrapper tags.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Hi roboticus,

      Many thanks for your reply, and apologies for the pastebin, I've now included the makefile below as suggested.

      Thank you for the suggestions regarding the autosplit module. Unfortunately, I don't know where to find that code to include your suggested edits. Do you know where I might find it?

        Nanjizal:

        It will be somewhere in your @INC path. I use cygwin which has a locate command, so I used locate to find it:

        $ locate AutoSplit locate: warning: database ‘/var/locatedb’ is more than 8 days old (act +ual age is 13.4 days) . . . C:/cygwin64\lib\perl5\5.22\AutoSplit.pm C:/cygwin64\usr\share\man\man3\AutoSplit.3pm.gz . . .

        You could likely find it by doing something like:

        $ perl -e 'for (@INC) { $t="$_/AutoSplit.pm"; print $t,"\n" if -e $t } +' /usr/lib/perl5/5.22/AutoSplit.pm

        Note: That would only work if AutoSplit happens to be at the root of a directory in @INC (which it is, in this case). A File::Find solution would be more general for locating files that might be deeper in the @INC directory hierarchy.

        Update: I second kcott's(++) suggest to use perlbrew. When I was using a Mac, it worked very well for me.

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.

Re: Perl DBI installation problem on MacOS Sierra - Can't open blib/lib/DBI/Util/
by kcott (Archbishop) on Oct 26, 2017 at 21:24 UTC

    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

      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

Re: Perl DBI installation problem on MacOS Sierra - Can't open blib/lib/DBI/Util/
by thanos1983 (Parson) on Oct 26, 2017 at 12:56 UTC

    Hello Nanjizal,

    Welcome to the Monastery. As far as I understand you are trying to install the module manually, why?

    If there is no obvious reason that I am no aware why you do not try installing it through cpan or cpanminus find more information here How to install CPAN modules.

    Also since you are running on MacOS I assume your software is up to date, why you are running Perl 5.18.2 latest version is 5.26.1. If you want to upgrade you can either download it and do it manually from here Perl or you can open a terminal and type cpan<code> enter. Then simply type <code>install CPAN enter, as soon as this finish type reload cpan enter. Observe the difference between small case letters and upper case.

    Update: It was many years ago since the last time that I used a MacOS so maybe I skipped something. So I found this article Using CPAN to Extend Perl on Mac OS X. Where I quote:

    Configuring Your Mac to Use CPAN Before we get into using CPAN to install modules for your own code, le +t's talk what happens if you find a really cool project on the Intern +et that uses CPAN modules. To get that code up and running, you'll ne +ed to install the modules from CPAN to your computer. So let's config +ure your Mac to use CPAN before we do anything else. First, CPAN uses some low-level tools to install modules on your Mac. +Therefore, you will need to have either Xcode installed from the Mac +App Store or you will need to download the Command Line Tools for Xco +de package from Apple's Developer site. (Note that you need a free de +veloper account to download these tools.) Once you have either Xcode +or the Developer tools, let's install some modules!

    This is a mandatory step before you open a terminal and type cpan. Have you installed Xcode?.

    If you still having problems, update your question.

    Hope this helps, BR.

    Seeking for Perl wisdom...on the process of learning...not there...yet!

      Hi thanos1983, Many thanks for your response. I first tried installing DBI via CPAN and had the same problem, so I tried the manual installation instead. I have Xcode installed. I haven't altered any Perl settings and am just using what came installed. I tried upgrading via perl.org, and downloaded the suggested active Perl package, but this doesn't seem to have changed my Perl version - when I type perl -v I still get v5.18.2. I tried updating via cpan by following your instructions and got another error included below. I assume I am doing something pretty basic wrong here, perhaps relating to the way Perl is set up on my machine? Any pointers would be very gratefully received. Many thanks.

        Hello again Nanjizal,

        First of all do not worried for obvious mistakes we all being there and believe me all of us (at least the majority) we are still here. Maybe this minor problem it looks big to you but we also face minor problems that looks huge to us.

        Moving on to resolve the issue, regarding install CPAN. It is very important to read the stdout of the modules. By 99.9% usually contains the answer to your problems.

        Read carefully this part:

        Warning: Prerequisite 'Mac::SystemDirectory => 0.04' for 'REHSACK/File +-HomeDir-1.002.tar.gz' failed when processing 'ETHER/Mac-SystemDirect +ory-0.10.tar.gz' with 'make_test => NO'. Continuing, but chances to s +ucceed are limited.

        The same error you get at the end also. Try as sudo (if there is I can not remember):

        sudo cpan Mac::SystemDirectory

        If everything works fine, do again install CPAN and reload cpan. In case of another error repeat again and again until you make it work ;)

        Always but always read the output 99.9% in all cases contains hints on how to resolve issues not only for Perl but in general.

        Minor hint, when you are posting a huge bunch of coding lines use <readmore> and </readmore> it helps a lot for readability reasons.

        Try it out and if you get any problems comment again.

        BR / Thanos

        Seeking for Perl wisdom...on the process of learning...not there...yet!