Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: XSLoader/DynaLoader Can't Locate Library

by wbirkett (Acolyte)
on Jun 12, 2020 at 09:28 UTC ( [id://11117965]=note: print w/replies, xml ) Need Help??


in reply to Re: XSLoader/DynaLoader Can't Locate Library
in thread XSLoader/DynaLoader Can't Locate Library

Thanks for the suggestion, perlfan.

I exported the path to the folder containing the .dylib, and here is the result

WBBirkett-M:~ wbirkett$ export LD_LIBRARY_PATH=/Users/wbirkett/Library +/Application\ Support/TextMate/Pristine\ Copy/Bundles/PressCal.tmbund +le/Support/lib/perl5 WBBirkett-M:~ wbirkett$ env TERM_PROGRAM=Apple_Terminal SHELL=/bin/bash TERM=xterm-256color TMPDIR=/var/folders/kf/hd1w1x888xj_x1018f8m3f2h0000gn/T/ Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.le70PQDJKe/R +ender TERM_PROGRAM_VERSION=404.1 TERM_SESSION_ID=CC263E8D-8730-4F07-9752-F779AA2A8ADD USER=wbirkett LD_LIBRARY_PATH=/Users/wbirkett/Library/Application Support/TextMate/P +ristine Copy/Bundles/PressCal.tmbundle/Support/lib/perl5 SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.L73CgT5E19/Listeners PATH=/Users/wbirkett/.rbenv/shims:/usr/local/bin:/usr/local/sbin:/usr/ +local/mysql/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X1 +1/bin:/usr/local/git/bin:/Library/TeX/texbin PWD=/Users/wbirkett LANG=en_US.UTF-8 XPC_FLAGS=0x0 RBENV_SHELL=bash XPC_SERVICE_NAME=0 SHLVL=1 HOME=/Users/wbirkett LOGNAME=wbirkett DISPLAY=/private/tmp/com.apple.launchd.pfkv04jVPR/org.macosforge.xquar +tz:0 _=/usr/bin/env WBBirkett-M:~ wbirkett$ perl -I/Users/wbirkett/Library/Application\ Su +pport/TextMate/Pristine\ Copy/Bundles/PressCal.tmbundle/Support/lib/p +erl5 /Users/wbirkett/Desktop/Rmath_test.pl Can't load '/Users/wbirkett/Library/Application Support/TextMate/Prist +ine Copy/Bundles/PressCal.tmbundle/Support/lib/perl5/darwin-thread-mu +lti-2level/auto/ICC/Support/Rmath/Rmath.bundle' for module ICC::Suppo +rt::Rmath: dlopen(/Users/wbirkett/Library/Application Support/TextMat +e/Pristine Copy/Bundles/PressCal.tmbundle/Support/lib/perl5/darwin-th +read-multi-2level/auto/ICC/Support/Rmath/Rmath.bundle, 1): Library no +t loaded: libRmath.dylib Referenced from: /Users/wbirkett/Library/Application Support/TextMat +e/Pristine Copy/Bundles/PressCal.tmbundle/Support/lib/perl5/darwin-th +read-multi-2level/auto/ICC/Support/Rmath/Rmath.bundle Reason: image not found at /System/Library/Perl/5.18/XSLoader.pm lin +e 71. at /Users/wbirkett/Library/Application Support/TextMate/Pristine Copy +/Bundles/PressCal.tmbundle/Support/lib/perl5/darwin-thread-multi-2lev +el/ICC/Support/Rmath.pm line 183. Compilation failed in require at /Users/wbirkett/Desktop/Rmath_test.pl + line 1. BEGIN failed--compilation aborted at /Users/wbirkett/Desktop/Rmath_tes +t.pl line 1.

DynaLoader gets its initial list of library paths from Perl's %Config hash. On my Mac, the paths are /usr/lib and /usr/local/lib.

Replies are listed 'Best First'.
Re^3: XSLoader/DynaLoader Can't Locate Library
by perlfan (Vicar) on Jun 13, 2020 at 17:51 UTC
    Thank you for replying, glad it gave you something to try. I am going through your OP to pick out any information that I might have missed the first time.

    First thing that strikes me is that you moved the library. We know nothing about how you built the XS libararies, so did you literally move it or did you rebuild it in the new location? I suspect that there is an issue with the libaries you built thinking they are in the original location (just a stretch guess).

    Second thing is that DynaLoader is for Perl modules, so I was confused that this was being used to create and export your XS libraries. After educating myself a bit on DynaLoader, I see that it says:

    It must be stressed that the DynaLoader, by itself, is practically useless for accessing non-Perl libraries because it provides almost no Perl-to-C 'glue'. There is, for example, no mechanism for calling a C library function or supplying arguments. A C::DynaLib module is available from CPAN sites which performs that function for some common system types. And since the year 2000, there's also Inline::C, a module that allows you to write Perl subroutines in C. Also available from your local CPAN site..

    My suggestion is to take DynaLoader out of this altogether. Seems like you don't need it at all. XS based modules should work as normal if you just did a use My::XS::Module. On CPAN, XS based modules are not distributed as pre-compiled blobs, they are compiled and installed when you "install" the module. So get back to the basics:

    1. make sure you've rebuilt your XS modules for the new location
    2. get it to work in a simple script without DynaLoader with, use My::XS::Module
    3. make sure the lib directory in /path/to/lib/My::XS::Module is in @INC

    Then iterate on that until you get it to work, once that happens you can translate what you did in the simple program. I am getting the feeling that the root of the issue is that you may have literally mv'd the libraries to the new location rather than rebuilding them.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11117965]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-24 01:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found