Compiling MySQL & DBD::mysql under cygwin
February 5, 2007 4:12 PM   Subscribe

MySQL source vs 'devel' package quirkiness...

I'm trying to setup DBD::mysql, under cygwin, using the instructions found here.

I download the MySQL source tar.gz file from the mysql community site, and build the mysql client/libraries without any obvious issues.

But when I try to make DBD::mysql, it dies saying dbdimp.h references mysqld_error.h, which is not found. Looking in the /usr/local/mysql/include/mysql folder, we can see that indeed, the file doesn't exist.

I tried checking one of the binary "max" tar balls, and it does contain the missing header files. Oldschool me can't help but thinking of the difference between a source and a source-devel package, but I don't see anywhere on to find the devel sources. It doesn't appear that the include files from the binary tarball are drop-in replaceable with those that came in the 'source' tarball.

Does anyone know what's up with MySQL sources, and if there is a devel tarball?
posted by nomisxid to Computers & Internet (7 answers total) 1 user marked this as a favorite
Best answer: It is likely related to this 'bug' where the file is not included when installing only client libraries.

Your other issue is likely related to MySQL's careful hiding of releases from casual non-commercial surfers of However, you can still get what you need if you know where to look.
posted by wackybrit at 5:14 PM on February 5, 2007 [1 favorite]

That sounds like a bug in DBD::mysql. The name mysqld_error.h implies that it is part of the server, not the client. But DBD::mysql shouldn't need anything from the server, the client libs should suffice.

To get you going, I'd say that you could either compile and install the server too, or lift whatever missing headers are necessary from the binary package. For something like mysqld_error.h which is probably just an enumeration of error code numbers, there hopefully won't be any kind of ABI breakage by cross-polinating a MSVC-precompiled and a Cygwin-compiled headers, but that's not the kind of thing you can do in general.

I have gotten DBD::mysql working under Cygwin in the past, so I know it's possible. I don't remember whether I built the server or not. I think I did. But obviously you don't have to run the Cygwin compiled version of the server; it can connect on TCP to any server, and if you intend to run the server locally you should use the native Win32 server and not the Cygwin server for performance reasons. One gotcha is the Cygwin client will be speaking TCP and unix sockets, whereas the native binary will be listening on TCP and Win32 named pipes (since Unix sockets don't exist on Win32 and are emulated by Cygwin.) Thus all communication between the two will have to be TCP.
posted by Rhomboid at 5:18 PM on February 5, 2007

But DBD::mysql shouldn't need anything from the server, the client libs should suffice.

You're right, but there's an issue (linked above) where the client libraries are (erroneously) not including a file that should be included (mysqld_error.h).
posted by wackybrit at 5:59 PM on February 5, 2007

I have no experience with compiling mysql, but from the comments here, have you tried compiling a 'developer' version? It sounds like that file should be automatically generated somehow... I think you may just need to make a different target.

If there's nothing in the readme, search the makefile for 'mysqld_error'. It'll probably be listed in there somewhere (unless it's in a subsidiary Makefile) -- look for the name of the target that includes it, and build that.

If you don't see it, try searching the Makefile for 'devel' and build any targets that look promising.

(a Makefile target is listed at the start of a line followed by a colon.)
posted by Malor at 7:04 PM on February 5, 2007

Ok, I downloaded the 5.0.34 version under Linux, and it has that file in the .tar.gz file to begin with. Can you get 5.0.34 for Cygwin?
posted by Malor at 7:42 PM on February 5, 2007

After some more digging, I discovered that it will regenerate the file automatically during a make. I've traced it down to the extras directory; the makefile in the extras subdiretory creates a program called 'comp_err', and then calls that program to create the mysqld_error.h file.

From your build root, if you type:

cd extra
make ../include/mysqld_error.h

It *should* make the mysqld_error.h file.
posted by Malor at 8:11 PM on February 5, 2007

Response by poster: Thanks all for the helpful hints. I ended up doing the full build 0f 5.0.33, and DBD was finally happy.
posted by nomisxid at 9:42 AM on February 6, 2007

« Older Who wants to ship by sail?   |   Forsooth, facilitate fixing my four-fingered... Newer »
This thread is closed to new comments.