Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

How to install DBD::mysql on 10.2 UNIX
I recently installed perl 5.8.0 and therefore had to reinstall the Perl module DBD::mysql, because there were binary incompatibilities. The normal procedure for DBD::mysql is:
perl Makefile.PL
make
...
But this did not work, and I got compiler errors:
In file included from dbdimp.c:29:
dbdimp.h:31:49: mysql.h: No such file or directory
dbdimp.h:32:49: errmsg.h: No such file or directory
In file included from dbdimp.c:29:
dbdimp.h:116: error: parse error before "MYSQL"
dbdimp.h:116: warning: no semicolon at end of struct or union
............snip
I found that the default values for some flags (location of mysql-libs and headers) seemed to be wrong (at least on my system), and so the neccesary files could not be found. My mysql installation is located at /usr/local/mysql, and I had to slightly adjust the --lib and --cflag settings (see README file). I used (shown on two lines; enter as one with just a space before "--libs"):
perl Makefile.PL --cflags=-I/usr/local/mysql/include/
   --libs="-L/usr/local/mysql/lib -lmysqlclient -lz"
So if you have similar problems, make sure the locations of the header and lib files match. Hope this is useful.
    •    
  • Currently 2.20 / 5
  You rated: 3 / 5 (5 votes cast)
 
[5,996 views]  

How to install DBD::mysql on 10.2 | 9 comments | Create New Account
Click here to return to the 'How to install DBD::mysql on 10.2' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
DBD::mysql package
Authored by: gdelfino on Sep 15, '03 11:47:29PM
Good hint. After failing to install using CPAN, I found this precompiled package: http://www.heavyhosting.net/AppToolkit/

[ Reply to This | # ]
Yes, but how do you install it on 10.3? :)
Authored by: trevden on Sep 18, '03 12:10:53AM

make is giving me this:

cc -c -I/Library/Perl/5.8.1/darwin-thread-multi-2level/auto/DBI -I/usr/local/mysql/include/ -g -pipe -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include -Os -DVERSION=\"2.1028\" -DXS_VERSION=\"2.1028\" "-I/System/Library/Perl/5.8.1/darwin-thread-multi-2level/CORE" dbdimp.c
cc -c -I/Library/Perl/5.8.1/darwin-thread-multi-2level/auto/DBI -I/usr/local/mysql/include/ -g -pipe -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include -Os -DVERSION=\"2.1028\" -DXS_VERSION=\"2.1028\" "-I/System/Library/Perl/5.8.1/darwin-thread-multi-2level/CORE" mysql.c
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.bundle
LD_RUN_PATH="/usr/lib" /usr/bin/perl myld MACOSX_DEPLOYMENT_TARGET=10.3 cc -bundle -undefined dynamic_lookup -L/usr/local/lib dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.bundle -L/usr/local/mysql/lib -lmysqlclient -lz
make: *** [blib/arch/auto/DBD/mysql/mysql.bundle] Error 1



[ Reply to This | # ]
Yes, but how do you install it on 10.3? :)
Authored by: byron on Oct 25, '03 09:41:52PM

Yes! I have the same problem. I'm trying to find a solution.



[ Reply to This | # ]
Yes, but how do you install it on 10.3? :)
Authored by: buddha456 on Oct 26, '03 10:01:06PM

Yup, having the same problem. Any solutions yet? I found another post (see below) saying that you could switch back to gcc2 with the command,

sudo /usr/sbin/gcc_select 2

but it seems that gcc2 does come installed on Panther. Plus I don't really want to go around switching my compilers around if I don't have to.

Other Post
I've found that quite a few perl modules fail to compile with the latest gcc3 on Mac OSX (10.2.6 in my case). They tend to fail with "bus error" which is very unhelpful indeed, and means that the compiler crashed, as opposed to the source code for the modules being buggy or unsupported under OSX.

For the record, the preferred way to change compilers (straight from Apple) is

$ sudo /usr/sbin/gcc_select 2 ( to switch to gcc2 )
$ sudo /usr/sbin/gcc_select 3 ( to switch back to gcc3 )

In addition, I've found that changing the symlink /usr/bin/gcc to point at either gcc2 or gcc3 works as well, and as the hint suggests, changing the compiler listing in the Makefile should also work, although hunting down what might be multiple cases of this in a source package might be less reliable.



[ Reply to This | # ]
Yes, but how do you install it on 10.3? :)
Authored by: buddha456 on Oct 26, '03 10:50:55PM

So, a work around is to use the MysqlPP driver (which also requires Net::mysql), although it gives some weird errors such as,

in short at /Library/Perl/5.8.1/Net/MySQL.pm line 591.

but it does seem to work for the time being. I hope someone figure out the DBD::mysql thing soon though. I'm bummed I can't use it. :)



[ Reply to This | # ]
Yes, but how do you install it on 10.3? :)
Authored by: jasondk on Oct 28, '03 06:12:16PM

I came across a workaround. Create the makefile using:

perl Makefile.PL --nocatchstderr

then continue normally with:
make
make test
make install

It worked for me!
- Jason

[see http://www.plaidworks.com/chuqui/blog/000895.html]



[ Reply to This | # ]
Do this for 10.3
Authored by: wallyfoo on Oct 26, '03 10:52:39PM
To quote another site:

After you build the Makefile, do this.
perl -pi -e's/MACOSX/env MACOSX/' Makefile

Taken from this website.
http://caseywest.com/journal/archives/000510.html

It just worked for me. Now I can install that cgi BBS on my new webserver. Hooray!

---
_____________________________
My other sig is really witty.

[ Reply to This | # ]

Do this for 10.3
Authored by: buddha456 on Oct 27, '03 12:37:36AM

Nice! Worked for me too! Thanks for the successful sleuthing!



[ Reply to This | # ]
[DBD::mysql-make test] mysql.bundle-error
Authored by: Zetetes on Nov 28, '03 06:10:53PM

hi there
got my powerbook one week ago, i want to use it mainly for webdev with perl/mysql/XML. since i never worked on unix it took me quite some time to get used to getting the right cpan-modules and installing them, until now i'm ok with that. but then, yesterday, i run into a problem using the DBI-module.

i had the same problems as described in the thread (with the 'make' and setting parameters for the makefile-thingy, etc.). but then, doing the 'make test' failed with the following error-msg:

[code]mysql.bundle undefined reference to _mysql_real_query expected to be defined in a dynamic image[/code]
got this for lots of _mysql_...-things. in the end, 5.56% were ok of the test, tried to install, which went through, but then trying to get some data over the browser got me a 500-error. in the error_log i got the same errors again:
[code]mysql.bundle undefined reference to _mysql_real_query expected to be defined in a dynamic image[/code]

tried the DBD-package-installer as well, which did not solve any problems...

anybody may help me? i know, i'm not very precise in describing the errors and what's going on, guess that's because i'm new to all this stuff and do not know what is important and what isn't. but i'm willing to learn. :)

thank you all!
Ze



[ Reply to This | # ]