develooper Front page | perl.perl5.porters | Postings from June 2018

DB_File woes on MacOS

Thread Next
From:
paul.marquess via perl5-porters
Date:
June 24, 2018 20:16
Subject:
DB_File woes on MacOS
Message ID:
000d01d40bf8$11b35f70$351a1e50$@ntlworld.com
I've had a flurry of emails and RT tickets recently on DB_File that can be
summarised as "MacOS is shipping with a bad version of the Berkeley DB
library that blows up in the DB_File test harness."

 

Danny Thomas has suggested the patch below to Makefile.PL for DB_File to
catch the problem early on in the build.

 

I've no problem in principle with catching this error early on in the build
as long as it doesn't cause more problems than it solves.

 

Didn't know (or have long forgotten) that ExtUtils::MakeMaker returned
LD_RUN_PATH. In fact, I don't see it mentioned in the main
ExtUtils::MakeMaker man page. I see LD_RUN_PATH mentioned in
ExtUtils::Liblist. It says this about Win32 (and VMS) support for
LD_RUN_PATH

 

     LDLOADLIBS and EXTRALIBS are always identical under Win32, 

     and BSLOADLIBS and LD_RUN_PATH are always empty (this may change in
future).

 

Means the patch would need to ignore (at least) Win32 and VMS.

 

Does anyone have a module that does something similar or comments on the
approach? I'm keen not to break the build for other platforms

 

 

 

diff -ur DB_File-1.841.orig/Makefile.PL DB_File-1.841/Makefile.PL

--- DB_File-1.841.orig/Makefile.PL            2018-04-02 20:16:07.000000000
+1000

+++ DB_File-1.841/Makefile.PL  2018-06-24 17:16:06.999773077 +1000

@@ -45,7 +45,7 @@

# building this module with the perl source distribution.

my $CORE = $ENV{PERL_CORE} ? '' : '-D_NOT_CORE';

-WriteMakefile(

+my $MM = WriteMakefile(

               NAME                   => 'DB_File',

               LIBS                        => ["-L${LIB_DIR} $LIBS"],

               INC                         => "-I$INC_DIR",

@@ -79,6 +79,35 @@

               );

 

+# printf "%s : '%s'\n", $_, $MM->{$_}//'<undef>' for qw(EXTRALIBS
BSLOADLIBS LDLOADLIBS LD_RUN_PATH);

+unless ($MM->{LD_RUN_PATH}) {

+    print "Doesn't seem like ExtUtils::MakeMaker found libdb,\n";

+    print "so you should have seen:\n";

+    print "  Warning (mostly harmless): No library found for -ldb\n";

+    print "which is actually not so harmless.\n";

+    if ($^O eq 'darwin') {

+        print "The BerkeleyDB library doesn't seem to have been included
with macOS+XCode\n";

+        print "since at least OSX 10.9, even though a /usr/include/db.h is
installed\n";

+        print "by XCode's Command_Line_Tools.\n";

+        print "NB the system perl does include a working DB_File
(statically linked libdb?):\n";

+        print "
/System/Library/Perl/5.XX/darwin-thread-multi-2level/auto/DB_File/DB_File.bu
ndle\n";

+        print "FYI that DB_File seems buggy (in at least macOS 10.13):\n";

+        print "  https://discussions.apple.com/thread/8125401\n\n";

+        print "To build DB_File successfully, you'll need a libdb from
another source such\n";

+        print "as MacPorts or HomeBrew. DB_File does look under one
non-standard directory\n";

+        print "/usr/local/BerkeleyDB for {include,lib}.\n";

+        print "So a simple approach for MacPorts:\n";

+        print "  sudo port install db48\n";

+        print "  sudo mkdir /usr/local/BerkeleyDB\n";

+        print "  sudo ln -s /opt/local/lib/db48
/usr/local/BerkeleyDB/lib\n";

+        print "  sudo ln -s /opt/local/include/db48
/usr/local/BerkeleyDB/include\n";

+    } else {

+        print "You may need to install the 'libdb' or 'libdb-devel' package
or port.\n";

+    }

+    exit 1;

+}

+

+

my @names = qw(

               BTREEMAGIC

               BTREEVERSION


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About