Solaris 2.7 run time linking problem

Solaris 2.7 run time linking problem

am 02.02.2003 05:48:46 von Steve Sapovits

I posted this to PerlMonks and an earlier version to the DBI mailing
list. Any ideas?
----

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/arch/auto/DBD
/mysql/mysql.so' for module DBD::mysql: ld.so.1: /usr/local/bin/perl: fatal:
relocation error: file blib/arch/auto/DBD/mysql/mysql.so: symbol
mysql_real_escape_string: referenced symbol not found at
/usr/local/lib/perl5/5.6.1/sun4-solaris/DynaLoader.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 expected

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
nd @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).

--
Steve Sapovits GSI Commerce, Inc. http://www.gsicommerce.com
Email: sapovitss@gsicommerce.com



------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread2014@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.