Garrett (garote) wrote,

"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).

  • Post a new comment


    default userpic

    Your reply will be screened

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.