So, the failure to load the library is somehow connected to the current directory in the Terminal app. I don't know why that would matter, but it looks this is a macOS problem, not a Perl problem.

If I understand right that by changing directory to that which *contains* the actual dylib file, it does work, then that could be because it possibly searches the current directory for the dylib file by default - perhaps not DynaLoader but the OS's dynamic library loader. So, that's to be expected I guess.

Perhaps you can experiment with a directory without spaces, although that's far-fetched and in my linux box a dir with spaces works perfectly. Additionally run strace's OSX equivalent: dtruss as per perlfan's suggestion and/or export any shell debug variables like LD_DEBUG=yes and maybe OSX-specific DYLD_PRINT_LIBRARIES=YES and try to see what's going on. It could say that it did not find the library but it could mean that some other dependencies were not found. Don't forget there are 2 processes at play here: DynaLoader and OS's dynamic library loader.


In reply to Re^5: XSLoader/DynaLoader Can't Locate Library by bliako
in thread XSLoader/DynaLoader Can't Locate Library by wbirkett

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.