I have a problem on Solaris 2.7 that's stumped me. I have rather large Perl installations on 2 Solaris boxes: 1 Solaris 2.7; the other 2.8. Each has over 250 CPAN modules loaded, as well as a number of prerequisite libraries. Both use GNU (gcc) build environments. Both appear to be using the same versions of all software.

Friday, I went to install DBD::mysql. I already had this loaded on the 2.8 box. I built it there against a recent Solaris binary download of mysql. No problems ... all tests pass, etc. On the 2.7 box I'm stuck. Everything builds okay but all the tests yield errors like this:

t/00base............install_driver(mysql) failed: Can't load 'blib/arc +h/auto/DBD /mysql/mysql.so' for module DBD::mysql: ld.so.1: /usr/local/bin/perl: +fatal: rel ocation error: file blib/arch/auto/DBD/mysql/mysql.so: symbol mysql_re +al_escape_ string: referenced symbol not found at /usr/local/lib/perl5/5.6.1/sun4 +-solaris/D ynaLoader.pm line 206. at (eval 1) line 3 Compilation failed in require at (eval 1) line 3. Perhaps a required shared library or dll isn't installed where expecte +d
Basically it looks like at run-time the mysql client library is missing in action. I've been building freeware for some time so I checked all the obvious things: missing shared libraries, unset LD_LIBRARY_PATH, etc. This one is not obvious. Plus all the other modules I've built (including 2 other DBD:: modules) have not hit this problem. My basic conclusion is that the linker is happy it can find everything at build time but the run time linker is not so happy. I added debug to DynaLoader and @dl_library_path is set correctly. Runnning the Solaris ldd command against the created mysql.so shows all the libraries it thinks it wants are there, however the mysql client lib is not in that list on either machine. Instead, the build on both machines (good and bad) shows this sort of set-up to find the mysql client lib:
Running Mkbootstrap for DBD::mysql () chmod 644 mysql.bs rm -f blib/arch/auto/DBD/mysql/mysql.so LD_RUN_PATH="/usr/local/lib/mysql:/usr/lib" /usr/local/bin/perl myld g +cc -G -L/ usr/local/lib dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.so + -L/usr/lo cal/lib/mysql -lmysqlclient -lcrypt -lgen -lsocket -lnsl -lm chmod 755 blib/arch/auto/DBD/mysql/mysql.so cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs chmod 644 blib/arch/auto/DBD/mysql/mysql.bs Manifying blib/man3/DBD::mysql.3 Manifying blib/man3/DBD::mysql::INSTALL.3 Manifying blib/man3/Bundle::DBD::mysql.3 Manifying blib/man3/Mysql.3
I'm not exactly sure what that means ... I assume it's setting things up so DynaLoader finds the libs at run time. The standard mysql downloads only provide a static library so I'm not sure how that works but it does on the 2.8 box -- there are no mysql .so files to be found there and everything is happy.

I've tried using source builds of mysql -- which do have the .so shared libs; tried about a half dozen older versions of DBD::mysql; rebuilt everything including Perl with a new gcc to make sure I matched the other machine, etc. I've found numerous Google references to similar problems which all point to the things I mention here. Anyone have any other ideas (besides a bullet to the head)? Both boxes are running 5.6.1 Perl.

Two things I started looking into that I'm not all that familiar with: gcc has spec files that provide linker defaults; Solaris has a crle command that controls linker options. Interestingly enough, that command is on both the 2.7 and 2.8 box but only the 2.8 box has a man page entry and the directory/file structure that man page describes.

I also posted to the DBI mailing list (no response) and tried to subscribe to a mysql specific list (also no response).


In reply to DynaLoader DBD::mysql and Solaris 2.7 by steves

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.