Thursday, May 28, 2009

Installing MySQL 5.4.0 on Cygwin

First of all, it was an installation from source.

./configure
make
make install

The commands above didn't work.

A try:
./configure
make
......
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -O3 -MT readline.o -MD -MP -MF .deps/readline.Tpo -c -o readline.o readline.c
In file included from readline.c:54:
readline/readline.h:70:29: sys/ttydefaults.h: No such file or directory

Cygwin provides no file named `sys/ttydefaults.h'. Someone said a copy from a *nix distribution would help.
I didn't try it 'cause MySQL provides an option to skip the bundled readline kindly.

Another try:
./configure --without-readline
make
......
g++ -DUNDEF_THREADS_HACK -DDEFAULT_MYSQL_HOME="\"/usr/local\"" -DDATADIR="\"/usr/local/var\"" -I. -I../include -I../include -I../include -I../regex -O3 -fno-implicit-templates -fno-exceptions -fno-rtti -MT mysql.o -MD -MP -MF .deps/mysql.Tpo -c -o mysql.o mysql.cc
mysql.cc:1030: error: redefinition of `struct _hist_entry'
../include/readline/readline.h:46: error: previous definition of `struct _hist_entry'
mysql.cc:1033: error: ISO C++ forbids declaration of `HIST_ENTRY' with no type
mysql.cc:1033: error: conflicting declaration 'typedef int HIST_ENTRY'

I have little knowledge about compiling, so what I can do is only to guess, change options and have another try.
However, I'm lucky! I found the problem is caused by the option `-O3', well, actually is the inner `-frename-registers'. To set CFLAGS=-O2 or CFLAGS=-fno-rename-registers can help. Also, gcc-4 seems ok. Maybe gcc-3 is the bad, I don't know.

My compiler, which is the latest default compiler on Cygwin.
$ gcc -V
gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Yet another try:
./configure --without-readline CFLAGS=-O2
make
make install

Done.

P.S.1. The configure option `--with-plugin-partition' doesn't work. The MySQL guy said the issue is not repeatable with current development sources. So, just using `--with-plugins=partition' instead.

P.S.2. Cygwin is not supported for MySQL.(I didn't know that.)

2 comments:

Anonymous said...

Thanks for this post. It helps me a lot. Thanks !

Ruprict said...

Ugh, I still get the redefinition of `struct _hist_entry' error, no matter what I do.

:(