Bug #5343 Compile failure on Cygwin/Windows
Submitted: 1 Sep 2004 14:05 Modified: 16 May 2005 14:41
Reporter: Lenz Grimmer Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:4.0 OS:Microsoft Windows (Windows/Cygwin)
Assigned to: Magnus Blåudd CPU Architecture:Any

[1 Sep 2004 14:05] Lenz Grimmer
Compiling MySQL under Cygwin/Windows using the "--enable-thread-safe-client"
compile option aborts with the following compile error:

make[2]: Entering directory `mysql-4.0.20a/libmysql_r'
if /bin/bash ../libtool --preserve-dup-deps --mode=compile gcc -DDEFAULT_CHARSET_HOME="\"/usr/local\"" -DDATADIR="\"/usr/local/var\"" -DSHAREDIR="\"/usr/local/share/mysql\"" -DDONT_USE_RAID -DMYSQL_CLIENT  -I. -I. -I.. -I./../include -I../include -I./.. -I.. -I..     -O3 -DDBUG_OFF    -MT my_thr_init.lo -MD -MP -MF ".deps/my_thr_init.Tpo" \
  -c -o my_thr_init.lo `test -f 'my_thr_init.c' || echo './'`my_thr_init.c; \
then mv -f ".deps/my_thr_init.Tpo" ".deps/my_thr_init.Plo"; \
else rm -f ".deps/my_thr_init.Tpo"; exit 1; \
 gcc -DDEFAULT_CHARSET_HOME=\"/usr/local\" -DDATADIR=\"/usr/local/var\" -DSHAREDIR=\"/usr/local/share/mysql\" -DDONT_USE_RAID -DMYSQL_CLIENT -I. -I. -I.. -I./../include -I../include -I./.. -I.. -I.. -O3 -DDBUG_OFF -MT my_thr_init.lo -MD -MP -MF .deps/my_thr_init.Tpo -c my_thr_init.c  -DPIC -o .libs/my_thr_init.o
my_thr_init.c: In function `my_thread_global_init':
my_thr_init.c:69: error: `PTHREAD_MUTEX_ERRORCHECK_NP' undeclared (first use in this function)
my_thr_init.c:69: error: (Each undeclared identifier is reported only once
my_thr_init.c:69: error: for each function it appears in.)

How to repeat:
Compile MySQL on Cywin/Windows using the "--enable-thread-safe-client"
compile option.
[1 Sep 2004 14:10] Lenz Grimmer

Attachment: config.log.gz (application/x-gzip-compressed, text), 28.30 KiB.

[26 Sep 2004 17:35] Richard Dahlstedt
Seems as though Cygwin either doesn't fully implement the pthread interface or MySQL assumes a particular pthread interface.  In either case the fix to enable compilation of mysys/my_thr_init.c is as follows:

Original (lines #69-73):
70:   pthread_mutexattr_init(&my_errchk_mutexattr);
71:   pthread_mutexattr_setkind_np(&my_errchk_mutexattr,
72:                                             PTHREAD_MUTEX_ERRORCHECK_NP);
73: #endif

Change lines 71 & 72 to:
#ifdef __CYGWIN__

This gets it to compile properly.  Came across another compilation error afterwards which I am currently working on.  Once I have completed the full compilation will update as to whether this truly works or not.
[4 Oct 2004 16:06] Lenz Grimmer
Thanks for the suggestion, Richard! Please keep up posted.

Joerg, can you please take a look at this?
[7 Oct 2004 11:51] Lenz Grimmer
Bug #5947 was marked as a duplicate of this one.
[23 Oct 2004 15:22] Richard Dahlstedt
Finally resolved my last issue in compiling 4.0.21 under Cygwin.  Seems that the #pragma interface bug in gcc under Cygwin (http://sources.redhat.com/ml/cygwin/2003-12/msg00053.html) was the culprit.  However, as per that reference's fix I still needed to make the change previously stated above related to pthreads in addition to not using '--enable-assembler' when running configure.
[16 May 2005 14:41] Magnus Blåudd
Thank you for taking the time to report this problem. 
It has been fixed in mysql 4.1.13 and 5.0.6, please use one of those versions.
See bug#10241 http://bugs.mysql.com/bug.php?id=10241