Bug #15861 Compile error using --without-server on FreeBSD
Submitted: 19 Dec 2005 15:31 Modified: 14 Mar 2006 18:29
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0.16/5.0.17 OS:FreeBSD (FreeBSD)
Assigned to: Joerg Bruehe CPU Architecture:Any

[19 Dec 2005 15:31] [ name withheld ]
Description:
Compilation of MySQL 5.0.15 & 5.0.16 on FreeBSD5.4 fails.

------

if gcc -DDEFAULT_BASEDIR=\"/usr/local\"  -DDATADIR="\"/usr/local/var\""  -DDEFAULT_CHARSET_HOME="\"/usr/local\""  -DSHAREDIR="\"/usr/local/share/mysql\""  -DDEFAULT_HOME_ENV=MYSQL_HOME  -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX  -DHAVE_CONFIG_H -I. -I. -I.. -I../include  -I../include -I.     -O3 -DDBUG_OFF -MT mf_keycache.o -MD -MP -MF ".deps/mf_keycache.Tpo" -c -o mf_keycache.o mf_keycache.c;  then mv -f ".deps/mf_keycache.Tpo" ".deps/mf_keycache.Po"; else rm -f ".deps/mf_keycache.Tpo"; exit 1; fi
In file included from mf_keycache.c:43:
../include/keycache.h:74: error: syntax error before "pthread_mutex_t"
mf_keycache.c:103: error: syntax error before "KEYCACHE_CONDVAR"
mf_keycache.c:103: warning: data definition has no type or storage class
mf_keycache.c:155: error: syntax error before "KEYCACHE_CONDVAR"
mf_keycache.c: In function `remove_reader':
mf_keycache.c:1119: error: structure has no member named `condvar'
mf_keycache.c:1120: error: structure has no member named `condvar'
*** Error code 1

Stop in /data/install/mysql-5.0.15/mysys.
*** Error code 1

Stop in /data/install/mysql-5.0.15.
*** Error code 1

Stop in /data/install/mysql-5.0.15.

How to repeat:
./configure --without-server
make
[19 Dec 2005 16:08] MySQL Verification Team
I was not able to repeat this issue on Suse Linux, some FreeBSD
specific issue so.
[20 Dec 2005 9:28] [ name withheld ]
I've only tested on clean installs of FreeBSD 5.4 and 6.0 and it fails on both.
[20 Dec 2005 12:20] MySQL Verification Team
Thank you for the bug report.

$ uname -a
FreeBSD hegel.txg 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Sun May  8 10:21:06 UTC 2005
root@harlow.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

 mf_keycache.Po"; else rm -f ".deps/mf_keycache.Tpo"; exit 1; fi
In file included from mf_keycache.c:43:
../include/keycache.h:74: error: syntax error before "pthread_mutex_t"
mf_keycache.c:103: error: syntax error before "KEYCACHE_CONDVAR"
mf_keycache.c:103: warning: data definition has no type or storage class
mf_keycache.c:155: error: syntax error before "KEYCACHE_CONDVAR"
mf_keycache.c: In function `remove_reader':
mf_keycache.c:1119: error: structure has no member named `condvar'
mf_keycache.c:1120: error: structure has no member named `condvar'
*** Error code 1

Stop in /usr/home/miguel/works/mysql-5.0.17/mysys.
*** Error code 1

Stop in /usr/home/miguel/works/mysql-5.0.17.
*** Error code 1
[20 Jan 2006 10:39] [ name withheld ]
see bug #16528
[1 Mar 2006 19:36] Joerg Bruehe
The bug is platform-specific: I tried on Linux (SuSE 9.3, Athlon), and it works.
I will try next on Linux (Debian 3.1, PPC), as I have that available locally.

Trying on FreeBSD must be aligned with build work, so it may get delayed a bit.
[2 Mar 2006 16:46] Joerg Bruehe
Works fine on Debian as well, so my local possibilities are exhausted.
It seems to be quite BSD-specific, I have to check remotely. 
I will do that, but have to align it with build activities.
[6 Mar 2006 22:57] [ name withheld ]
Looking at the databases/mysql50-client port, which builds without any issues,  I added --enable-thread-safe-client, as an option to configure and was able to build 5.0.18 on  FreeBSD 4.4-RELEASE.  It should build without it, but I thought that might help narrow down the issue.
[8 Mar 2006 17:00] Joerg Bruehe
I could reproduce the problem on our FreeBSD machine.
It definitely looks related to threading, but I have to check why FreeBSD differs from Linux here.
[9 Mar 2006 17:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3650
[10 Mar 2006 16:13] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3719
[10 Mar 2006 16:32] Joerg Bruehe
This patch solves the problem on FreeBSD:

--- a/include/my_no_pthread.h   2006-03-10 17:30:31 +01:00
+++ b/include/my_no_pthread.h   2006-03-10 17:30:31 +01:00
@@ -23,6 +23,8 @@
 #if !defined(_my_no_pthread_h) && !defined(THREAD)
 #define _my_no_pthread_h

+#include <pthread.h>  /* some types are needed even in unthreaded builds */
+
 #define pthread_mutex_init(A,B)
 #define pthread_mutex_lock(A)
 #define pthread_mutex_unlock(A)

It is _not_ pushed, as it might cause problems on platforms which do not have a system header file 'pthread.h', so a more general solution will be used.
But if you want fix now, apply it.
[10 Mar 2006 20:11] Joerg Bruehe
Fixed, will take effect in 5.0.20 and 5.1.8-beta.
[14 Mar 2006 18:29] Paul DuBois
No changelog entry needed.