Bug #7148 build fails: mf_keycaches.c:60: error: parse error before "pthread_rwlock_t"
Submitted: 9 Dec 2004 21:12 Modified: 24 Mar 2005 4:46
Reporter: Bauke Jan Douma Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:4.1.7 OS:Linux (Linux-2.6.9)
Assigned to: CPU Architecture:Any

[9 Dec 2004 21:12] Bauke Jan Douma
Description:
note:
gcc-3.4.2
libc-2.3.3.so + libpthread-2.3.3.so
linux-2.6.9

make bombs with:

...
Making all in mysys
make[2]: Entering directory `/sw/mysql/mysql-4.1.7/mysys'
if gcc -DDEFAULT_BASEDIR=\"/usr/local/lib/mysql\" -DDATADIR="\"/usr/local/lib/mysql/var\"" -DDEFAULT_CHARSET_HOME="\"/usr/local/lib/mysql\"" -DSHAREDIR="\"/usr/local/lib/mysql/share/mysql\"" -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.  -O3 -s -mcpu=pentium4 -I/usr/local/lib/ssl/include -I/usr/local/include/readline  -O3 -DDBUG_OFF   -O3 -s -mcpu=pentium4 -I/usr/local/lib/ssl/include -I/usr/local/include/readline   -MT mf_keycaches.o -MD -MP -MF ".deps/mf_keycaches.Tpo" \
  -c -o mf_keycaches.o `test -f 'mf_keycaches.c' || echo './'`mf_keycaches.c; \
then mv -f ".deps/mf_keycaches.Tpo" ".deps/mf_keycaches.Po"; \
else rm -f ".deps/mf_keycaches.Tpo"; exit 1; \
fi
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.
mf_keycaches.c:60: error: parse error before "pthread_rwlock_t"
mf_keycaches.c:60: warning: no semicolon at end of struct or union

note that:
$> ls include/{*config.h,*thread*}
-rw-------  1 root staff 26966 Dec  9 21:48 include/my_config.h
-rw-r--r--  1 503  100    1245 Oct 23 09:28 include/my_no_pthread.h
-rw-r--r--  1 503  100   24502 Oct 23 09:28 include/my_pthread.h
and:
$> ls /usr/include/pthread.h
-rw-r--r--  1 root staff 34714 Nov 28 02:47 /usr/include/pthread.h

How to repeat:
$> make distclean

$> ./configure \
--prefix=/usr/local/lib/mysql \
--with-charset=latin1 \
--with-extra-charsets=complex \
--enable-assembler \
--enable-local-infile \
--enable-thread-safe-client \
--with-pthread \
--with-named-thread-libs=-lpthread \
--with-comment \
--with-embedded-server \
--with-embedded-privilege-control \
--with-vio \
--with-openssl=/usr/local/lib/ssl \
--without-bench \
--with-isam

$> make
[6 Jan 2005 14:09] Volodymyr Pomfiuk
this is stupid way, but in this particular case you can add following lines at the very begining of mf_keycaches.c:

#define __USE_UNIX98
#include <bits/pthreadtypes.h>

and change "rw_lock_t" to "pthread_rwlock_t" in the line, that causes error
[21 Apr 2006 20:49] Timothy Steiner
Reproduced using the development chroot environment supplied for ts-linux (http://www.embeddedarm.com/linux/main.htm) when using "./configure --build=i486 && make"