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

In the imortal words of the single greatest character in all media, in all history, Jar Jar Binks: My give up.

FFI::Platypus was sagely recommended here before. I read the doc and watched the youtube talks; read a few of the example scripts and tests. I am really excited to try it.

I cannot even get the most simplistic lib check—on the libraries I’m interested in using—to work. I have tried about 100 minor variations of this basic formula (including paths all over my drive and variations and guesses on lib names and adding recurse => 1) to no avail.

Standard library

perl -MFFI::CheckLib -E 'say "OK" if find_lib_or_exit lib => "archive" +' OK

DCMTK library

# Tried MANY variations on this theme with lib_path and recurse too. perl -MFFI::CheckLib -E 'find_lib_or_exit lib => "dcmdata"' library not found: dcmdata at -e line 1.

DCMTK is definitely installed on my system; as a binary, I think, I don’t remember building/installing it. I can find the libraries manually, I think. I tried using their various paths. The tools are in the regular $PATH, e.g. /usr/local/bin/dcmodify. The packages I am interested in wrapping up and using in Perl include those here DCMTK Documentation.

What am I doing wrong? Surely something, I hope something, simple.

Solved

The simple problem—finding the library—is solved with a local tweak thanks to swl pointing out the platform specific regex. They use the extension “a.”

find /usr/local/lib | ack dcmdata /usr/local/lib/libdcmdata.a
# Change in FFI::CheckLib. push @$pattern, qr{^lib(.*?)(?:\.([0-9]+(?:\.[0-9]+)*))?\.(?:dylib|b +undle|a)$}; # add "a"
perl -MFFI::CheckLib -E 'say "OK" if find_lib_or_exit lib => "dcmdata" +' OK

Replies are listed 'Best First'.
Re: FFI::Platypus; trouble finding non-standard, but present, libs
by swl (Prior) on Oct 30, 2019 at 05:24 UTC

      I’m sure that’s true but I’ve tried a LOT of variation adding in the libpath argument too pointing it at the various places the libs really have to be… :| One of the multiple examples–

      perl -MFFI::CheckLib -E 'find_lib_or_exit recurse => 1, lib => "dcmdat +a", libpath => "/Users/moo/depot/osirix/Binaries"' library not found: dcmdata at -e line 1.
Re: FFI::Platypus; trouble finding non-standard, but present, libs
by Anonymous Monk on Oct 30, 2019 at 06:37 UTC

    Tried try_linker_script option?

    Surely there must be a way to just point at the lib directly without having to "find" it?