Subject: mysql-4.x.x with gcc-3.4.1, compile error on cygwin, all fixes to get it compiled
From: "Gerrit P. Haase" <[email-masked]>
To: "Charles Churchill" <[email-masked]>
Cc: [email-masked]
Date: Thu, 4 Nov 2004 17:56:03 +0100

Hi Charles,

> getting this error with the gcc-3.4.1 test release for cygwin:
> 
> gcc -c -I. -I/instsoft/mysql/mysql-4.0.20/bdb/dist/../include -O3 -DDBUG_OFF
>  -g0 -O3 /instsoft/mysql/mysql-4.0.20/bdb/dist/../env/env_open.c
> /instsoft/mysql/mysql-4.0.20/bdb/dist/../env/env_open.c: In function `__dbenv_refresh ':
> /instsoft/mysql/mysql-4.0.20/bdb/dist/../env/env_open.c:453: warning: passing arg 1 of `__cygwin_lock_fini ' from incompatible pointer type
> /instsoft/mysql/mysql-4.0.20/bdb/dist/../env/env_open.c:453: error: void value not ignored as it ought to be
> make[3]: *** [env_open.o] Error 1
> make[3]: Leaving directory
> `/instsoft/mysql/mysql-4.0.20/.build/bdb/build_unix '

I found the problem, Thomas Pfaff introduced system functions with the
same name, to get rid of this error, I renamed the BerkeleyDB internal
functions __lock_close() and __lock_init() to s.th. more unique.

These fixes apply to all MySQL 4.x.x versions
=============================================

# cd to the libmysql directory
cd mysql-4.x.x/libmysql

# Add -no-undefined to libmysql/Makefile.shared
sed -i "s:target_ldflags =:\0-no-undefined:g" Makefile.shared

# cd to the top source directory
cd ../

# Remove AC_PREREQ(2.12) from configure.in
sed -i "s:AC_PREREQ(2.12)::g" configure.in

# Autoreconf. Run:
autoreconf --install --verbose --force

# Remove #pragma interface defines everywhere:
grep -rl "#pragma interface" * | xargs -r sed -i "s:#pragma interface:/*\0*/:g"

# cd to the bdb subdirectory
cd bdb

# Rename conflicting BDB internal functions:
grep -rl "__lock_close" * | xargs -r sed -i "s:__lock_close:__lock_close_bdb:g"
grep -rl "__lock_init" * | xargs -r sed -i "s:__lock_init:__lock_init_bdb:g"

# Additionally
# Change my_thr_init.c: line 74ff to:

#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
  pthread_mutexattr_init(&my_errchk_mutexattr);
#ifndef __CYGWIN__
   pthread_mutexattr_setkind_np(&my_errchk_mutexattr,
                               PTHREAD_MUTEX_ERRORCHECK_NP);
#else
#define PTHREAD_MUTEX_ERRORCHECK_NP     PTHREAD_MUTEX_ERRORCHECK
  pthread_mutexattr_settype(&my_errchk_mutexattr,
                               PTHREAD_MUTEX_ERRORCHECK_NP);
#endif
#endif

However, it seems that the Cygwin MySQL server still doesn't run stable.

Gerrit
-- 
=^..^=

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/