GNU Info

Info Node: (mysql.info)Perl support problems

(mysql.info)Perl support problems


Prev: Windows Perl Up: Perl support
Enter node , (file) or (file)node

Problems Using the Perl `DBI'/`DBD' Interface
---------------------------------------------

If Perl reports that it can't find the `../mysql/mysql.so' module, then
the problem is probably that Perl can't locate the shared library
`libmysqlclient.so'.

You can fix this by any of the following methods:

   * Compile the `Msql-Mysql-modules' distribution with `perl
     Makefile.PL -static -config' rather than `perl Makefile.PL'.

   * Copy `libmysqlclient.so' to the directory where your other shared
     libraries are located (probably `/usr/lib' or `/lib').

   * On Linux you can add the pathname of the directory where
     `libmysqlclient.so' is located to the `/etc/ld.so.conf' file.

   * Add the pathname of the directory where `libmysqlclient.so' is
     located to the `LD_RUN_PATH' environment variable.

If you get the following errors from `DBD-mysql', you are probably
using `gcc' (or using an old binary compiled with `gcc'):

     /usr/bin/perl: can't resolve symbol '__moddi3'
     /usr/bin/perl: can't resolve symbol '__divdi3'

Add `-L/usr/lib/gcc-lib/... -lgcc' to the link command when the
`mysql.so' library gets built (check the output from `make' for
`mysql.so' when you compile the Perl client).  The `-L' option should
specify the pathname of the directory where `libgcc.a' is located on
your system.

Another cause of this problem may be that Perl and MySQL aren't both
compiled with `gcc'.  In this case, you can solve the mismatch by
compiling both with `gcc'.

If you get the following error from `Msql-Mysql-modules' when you run
the tests:

     t/00base............install_driver(mysql) failed: Can't load '../blib/arch/auto/DBD/mysql/mysql.so' for module DBD::mysql: ../blib/arch/auto/DBD/mysql/mysql.so: undefined symbol: uncompress at /usr/lib/perl5/5.00503/i586-linux/DynaLoader.pm line 169.

it means that you need to include the compression library, -lz, to the
link line. This can be doing the following change in the file
`lib/DBD/mysql/Install.pm':

     $sysliblist .= " -lm";
     
     to
     
     $sysliblist .= " -lm -lz";

After this, you MUST run 'make realclean' and then proceed with the
installation from the beginning.

If you want to use the Perl module on a system that doesn't support
dynamic linking (like SCO) you can generate a static version of Perl
that includes `DBI' and `DBD-mysql'.  The way this works is that you
generate a version of Perl with the `DBI' code linked in and install it
on top of your current Perl.  Then you use that to build a version of
Perl that additionally has the `DBD' code linked in, and install that.

On SCO, you must have the following environment variables set:

     shell> LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/usr/progressive/lib
     or
     shell> LD_LIBRARY_PATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:/usr/progressive/lib:/usr/skunk/lib
     shell> LIBPATH=/usr/lib:/lib:/usr/local/lib:/usr/ccs/lib:/usr/progressive/lib:/usr/skunk/lib
     shell> MANPATH=scohelp:/usr/man:/usr/local1/man:/usr/local/man:/usr/skunk/man:

First, create a Perl that includes a statically linked `DBI' by running
these commands in the directory where your `DBI' distribution is
located:

     shell> perl Makefile.PL -static -config
     shell> make
     shell> make install
     shell> make perl

Then you must install the new Perl. The output of `make perl' will
indicate the exact `make' command you will need to execute to perform
the installation.  On SCO, this is `make -f Makefile.aperl inst_perl
MAP_TARGET=perl'.

Next, use the just-created Perl to create another Perl that also
includes a statically-linked `DBD::mysql' by running these commands in
the directory where your `Msql-Mysql-modules' distribution is located:

     shell> perl Makefile.PL -static -config
     shell> make
     shell> make install
     shell> make perl

Finally, you should install this new Perl.  Again, the output of `make
perl' indicates the command to use.


automatically generated by info2www version 1.2.2.9