Fix for problems installing DBD::mysql-2.9004 with mysql-4.0.20

From: Steven Lembark (lembark_at_wrkhors.com)
Date: 07/22/04


Date: Thu, 22 Jul 2004 13:09:51 -0400
To: dbi-users@perl.org


Perl-5.8.5 compiled happily, now updating DBD::mysql with:

        mysql-standard-4.0.20-pc-linux-i686
        DBD-mysql-2.9004

Catch is that newer mysql distro's use ./lib and ./include for
their files not ./lib/mysql or ./include/mysql. Fix is to symlink
'.' to mysql in the lib directory and use an explicit '-I' with
the cflags.

For example:

$ perl Makefile.PL
I will use the following settings for compiling and testing:

  cflags (mysql_config) = -I/usr/local/mysql/include/mysql
-mcpu=pentiumpro
  libs (mysql_config) = -L/usr/local/mysql/lib/mysql -lmysqlclient
-lz -lcrypt -lnsl -lm -lc -lnss_files -lnss_dns -lresolv -lc -lnss_files
-lnss_dns -lresolv
  nocatchstderr (default ) = 0
  nofoundrows (default ) = 0
  ssl (guessed ) = 0
  testdb (default ) = test
  testhost (default ) =
  testpassword (default ) =
  testuser (default ) =

To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.

Note (probably harmless): No library found for -lmysqlclient
Using DBI 1.43 (for perl 5.008005 on i686-linux-thread-multi) installed in
/opt/perl/5.8/lib/site_perl/5.8.4/i686-linux-thread-multi/auto/DBI
Writing Makefile for DBD::mysql

EH??? No libmysqlclient?

$ find /usr/local/mysql/ -name 'libmysqlclient*' -follow
/usr/local/mysql/lib/libmysqlclient.a
/usr/local/mysql/lib/libmysqlclient_r.a

One hak fixes it:

        cd /usr/local/mysql/lib;
        ln -fs . mysql;

Now I get:

        cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
        cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
        cp lib/Mysql.pm blib/lib/Mysql.pm
        cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
        cp lib/Mysql/Statement.pm blib/lib/Mysql/Statement.pm
        cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
        /opt/gcc/bin/gcc -c
-I/opt/perl/5.8/lib/site_perl/5.8.4/i686-linux-thread-multi/auto/DBI
-I/usr/local/mysql/include/mys
        ql -mcpu=pentiumpro -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FIL
        E_OFFSET_BITS=64 -I/usr/include/gdbm -O3 -march=pentium4
-DVERSION=\"2.9004\" -DXS_VERSION=\"2.9004\" -fpic "-I/opt/pe
        rl/5.8/lib/5.8.5/i686-linux-thread-multi/CORE" dbdimp.c
        `-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
        In file included from dbdimp.c:19:
        dbdimp.h:21:49: mysql.h: No such file or directory
        dbdimp.h:22:49: errmsg.h: No such file or directory
        In file included from dbdimp.c:19:
        dbdimp.h:106: error: parse error before "MYSQL"
        dbdimp.h:106: warning: no semicolon at end of struct or union
        dbdimp.h:117: error: parse error before '}' token
        dbdimp.h:146: error: parse error before "MYSQL_RES"
        dbdimp.h:146: warning: no semicolon at end of struct or union
        dbdimp.h:159: error: parse error before '}' token
        In file included from dbdimp.c:19:
        <snip>

Which was fixed via:

        perl Makefile.PL --cflags='-O3 -march=i686 -I/usr/local/mysql/include';

-- 
Steven Lembark                           9 Music Square South, Box 344
Workhorse Computing                                Nashville, TN 37203
lembark@wrkhors.com                                     1 888 359 3508


Relevant Pages

  • Re: DELETING records using MYSQL Database
    ... you don't have the rights for a local infile operation for that mysql ... ask the Perl Guys to run the infile op as a perl script with your file - ... mySql / VFP / MS-SQL ... > remote table - DELETE FROM, I want to repopulate it with data from ...
    (microsoft.public.fox.vfp.queries-sql)
  • script help to update member profiles
    ... form is all stored in a MySql Database (First Name, Last Name, Username, ... my partner that did all the perl scripts was injured ... Compare entered username and password to database to confirm the user is ...
    (comp.lang.perl.misc)
  • DBI / DBD / MySQL installation problem
    ... I used to run Red Hat 9, and had a perfect relationship with Perl, DBI, ... able to connect to MySQL from Perl via DBI. ... Running install for module Mysql ...
    (perl.dbi.users)
  • unable to make SELECT take variables
    ... I am working on a MySQL /Perl web site. ... PERL and am making progress. ... I want to sort and print the mailing labels from the database. ...
    (perl.dbi.users)
  • Re: SQLite - problem connecting to database (or doing a select)
    ... >> You need to pick one, MySQL or SQLite for your project. ... I just want to be able to access an sql database from perl. ... if you can install DBD::mysql on the machine that has MySQL ...
    (comp.lang.perl.misc)