Opened 16 years ago

Closed 15 years ago

Last modified 15 years ago

#16165 closed defect (fixed)

rrdtool: RRDs Perl module fails to load librrd library

Reported by: vinc17@… Owned by: markd@…
Priority: Normal Milestone:
Component: ports Version: 1.6.0
Keywords: patch Cc:
Port: rrdtool

Description

Just after installing rrdtool 1.3.1_1, I get the following error:

Can't load '/opt/local/lib/perl5/site_perl/5.8.8/darwin-2level/auto/RRDs/RRDs.bundle' for module RRDs: dlopen(/opt/local/lib/perl5/site_perl/5.8.8/darwin-2level/auto/RRDs/RRDs.bundle, 1): Library not loaded: /opt/local/lib/librrd.2.dylib
  Referenced from: /opt/local/lib/perl5/site_perl/5.8.8/darwin-2level/auto/RRDs/RRDs.bundle
  Reason: image not found at /opt/local/lib/perl5/5.8.8/darwin-2level/DynaLoader.pm line 230.

Indeed /opt/local/lib/librrd.2.dylib doesn't exist: the library is librrd.4.dylib.

Attachments (1)

patch-Makefile.PL.diff (744 bytes) - added by vinc17@… 16 years ago.
patch for rrdtool 1.3.1 to solve this bug

Download all attachments as: .zip

Change History (15)

comment:1 Changed 16 years ago by blb@…

Did you do an upgrade of rrdtool or was this the first install? Also, is RRDs part of rrdtool? If yes to both, sounds like the upgrade caused the new bundle to link against the library of the old version.

comment:2 Changed 16 years ago by vinc17@…

Yes, this was an upgrade, and RRDs.pm is part of rrdtool. I've done a test with a fresh install (i.e. with no activated rrdtool during the installation), and it works. I've tried again the upgrade from version 1.2.27_0, and loading the library fails again. In the build output, I can see:

env MACOSX_DEPLOYMENT_TARGET=10.3 cc  -L/opt/local/lib -bundle -undefined dynamic_lookup RRDs.o -L../../src/.libs/  -lrrd  -o blib/arch/auto/RRDs/RRDs.bundle

Could the -L/opt/local/lib before -L../../src/.libs/ be the problem?

comment:3 Changed 16 years ago by blb@…

Owner: changed from macports-tickets@… to markd@…

That definitely could be the issue. Assigning to maintainer.

comment:4 Changed 16 years ago by vinc17@…

Perhaps not a bug in rrdtool itself. In case the line I've quoted is incorrect, its contents come from /opt/local/lib/perl5/5.8.8/darwin-2level/Config_heavy.pl (installed by the perl5.8 port):

ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc'
lddlflags='-L/opt/local/lib -bundle -undefined dynamic_lookup'

comment:5 Changed 16 years ago by vinc17@…

I confirmed that the -L/opt/local/lib is the problem:

prunille:...dings/perl-shared> sudo /opt/local/bin/perl Makefile.PL   RPATH=/opt/local/lib
Writing Makefile for RRDs
prunille:...dings/perl-shared> grep '^LDDLFLAGS' Makefile
LDDLFLAGS = -L/opt/local/lib -bundle -undefined dynamic_lookup
prunille:...dings/perl-shared> sudo make
[...]
prunille:...dings/perl-shared> otool -L blib/arch/auto/RRDs/RRDs.bundle
blib/arch/auto/RRDs/RRDs.bundle:
        /opt/local/lib/librrd.2.dylib (compatibility version 3.0.0, current version 3.13.0)
[...]
prunille:...dings/perl-shared> sudo /opt/local/bin/perl Makefile.PL   RPATH=/opt/local/lib
Writing Makefile for RRDs
prunille:...dings/perl-shared> sudo emacs -nw Makefile
prunille:...dings/perl-shared> grep '^LDDLFLAGS' Makefile
LDDLFLAGS = -bundle -undefined dynamic_lookup
prunille:...dings/perl-shared> sudo make
[...]
prunille:...dings/perl-shared> otool -L blib/arch/auto/RRDs/RRDs.bundle
blib/arch/auto/RRDs/RRDs.bundle:
        /opt/local/lib/librrd.4.dylib (compatibility version 5.0.0, current version 5.0.0)
[...]

comment:6 Changed 16 years ago by vinc17@…

And that comes from the hints/darwin.sh file in the perl5.8 tarball:

*) 
   lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
   case "$ld" in
       *MACOSX_DEVELOPMENT_TARGET*) ;;
       *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;;
   esac
   ;;

Shouldn't ${ldflags} be suppressed? (Not tested...)

comment:8 Changed 16 years ago by vinc17@…

Removing ${ldflags} does not solve the problem, as it is added even when not included explicitly.

Changed 16 years ago by vinc17@…

Attachment: patch-Makefile.PL.diff added

patch for rrdtool 1.3.1 to solve this bug

comment:9 Changed 16 years ago by vinc17@…

Keywords: patch added

Instead of patching perl5.8, I found it simpler to fix rrdtool (though I think that the real problem is in perl -- however it is badly documented) with the patch I've just attached: the idea was to include -L../../src/.libs/ early enough in the command line.

Also note that this bug occurs only after some upgrades, such as from rrdtool 1.2.27, i.e. when an incompatible library is found in ${prefix}/lib and takes the precedence over the one from the build directory.

comment:10 Changed 15 years ago by vinc17@…

I've submitted a bug upstream: RRDs Perl module links with wrong library under Mac OS X. But as I said, it may be regarded as a bug in Perl.

comment:11 Changed 15 years ago by vinc17@…

Port: rrdtool added

comment:12 Changed 15 years ago by markd@…

Please test current 1.3.5 rrdtool port. It has several OS X specific bug fixes.

comment:13 Changed 15 years ago by vinc17@…

Resolution: fixed
Status: newclosed

I think it is fixed, though I couldn't test under conditions where I could really test the fix.

comment:14 Changed 15 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

Note: See TracTickets for help on using tickets.