Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

I am trying to pack with pp on my macOS a script containing the module DBD::mySQL. The script may be as simple as:

use DBI; use DBD::mysql; print "Hello!\n"

I compile it with the following:

pp -o script script.pl

Running it on a second machine, it fires the following error:

Can't load '/var/folders/qn/ww36n76n3kldrwp2_zxxw6k40000gn/T/par-66637 +5/cache-2406952ca14394e9ceb0dfd842a9672270fd4d99/fcfedebf.bundle' for + module DBD::mysql: dlopen(/var/folders/qn/ww36n76n3kldrwp2_zxxw6k400 +00gn/T/par-666375/cache-2406952ca14394e9ceb0dfd842a9672270fd4d99/fcfe +debf.bundle, 1): Library not loaded: /usr/local/opt/mysql/lib/libmysq +lclient.21.dylib Referenced from: /var/folders/qn/ww36n76n3kldrwp2_zxxw6k40000gn/T//p +ar-666375/cache-2406952ca14394e9ceb0dfd842a9672270fd4d99/fcfedebf.bun +dle Reason: image not found at /Users/de/perl5/perlbrew/perls/perl-5.26. +1/lib/5.26.1/darwin-2level/DynaLoader.pm line 197. at /Users/de/perl5/perlbrew/perls/perl-5.26.1/lib/site_perl/5.26.1/PA +R/Heavy.pm line 123. Compilation failed in require at script/SQL.pl line 3. BEGIN failed--compilation aborted at script/SQL.pl line 3.

The obvious problem is that libmysqlclient.21.dylib is missing. Less obvious to me is hot to solve the problem, as the following is not working too

pp -o script --lib=/usr/local/opt/mysql/lib/libmysqlclient.21.dylib s +cript.pl

Any suggestions

Replies are listed 'Best First'.
Re: Par pp DBD::mySQL macOS
by marto (Cardinal) on Jul 03, 2018 at 13:21 UTC
    pp -o script script.pl

    I get better results with pp using -x:

    pp -x -o script script.pl

    See -x,-execute for details. This issue sounds familiar, did you try a Super Search?

      Hi Marto. Yes, I tried with -x too. But I get the same error. The mySQL is not found. Of course I searched for solutions before. There are a couple of posts dealing with it, but no really solution. One answer says it is necessary to manually include it in the bundle, but it does not specify how/where.

        In your last example you used --lib to add a library, that's not what it does -I,-lib=DIR:

        "Add the given directory to the perl module search path. May be specified multiple times."

        You're not trying to add a perl module, this is a mySQL library. use --link --link=FILE|LIBRARY:

        "Add the given shared library (a.k.a. shared object or DLL) into the packed file. Also accepts names under library paths; i.e. -l ncurses means the same thing as -l libncurses.so or -l /usr/local/lib/libncurses.so in most Unixes. May be specified multiple times."