Garrett (garote) wrote,
Garrett
garote

"error: 'ulong' undeclared (first use in this function)" while installing DBD::mysql 4.001 on OS X

Oddly enough I found the solution to this Perl problem while browsing a Ruby messageboard. The fix hadn't made its way over into any Perl forums - lack of pages containing the word 'Perl' perhaps? - so I'm adding to the corpus with this post.

The error is simple: ulong isn't defined by the mysql headers that DBI::mysql is attempting to build with. It's supposed to be defined in 'my_global.h', but that file isn't even making it over. So let's define it someplace more conspicuous. Here's what you need to do:

Exit CPAN, so you're back at the prompt. Then:

sudo pico /usr/local/mysql/include/mysql.h

At the top of the file, after the lines

#ifndef _mysql_h
#define _mysql_h

Add the line

#define ulong unsigned long

And save the file. Then go back into CPAN and issue your install command again. Watch as the tests succeed. Problem solved.

This bugfix brought to you by the letter B, the color fuscia, and the unicode character 332E (SQUARE PIASUTORU).

Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

  • 4 comments