Bug #5871 Linux on amd64 architecture uses nptl instead of legacy LinuxThreads
Submitted: 3 Oct 2004 19:43 Modified: 26 Apr 2005 8:15
Reporter: Christian Hammers (Silver Quality Contributor) (OCA) Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:4.0.21 OS:Linux (Debian GNU/Linux)
Assigned to: Joerg Bruehe

[3 Oct 2004 19:43] Christian Hammers
Description:
Hello

The following was reported as Debian bug report and is available at 
http://bugs.debian.org/274555

bye,

-christian-
----------------------------------
From: Andreas Jochens <aj@andaco.de>

When building 'mysql-dfsg' on amd64 I get the following error:

checking "LinuxThreads"... "Not found"
configure: error: This is a linux system and Linuxthreads was not
found. On linux Linuxthreads should be used.  Please install Linuxthreads
(or a new glibc) and try again.  See the Installation chapter in the
Reference Manual for more information.
make: *** [configure-stamp] Error 1

With the attached patch 'mysql-dfsg' can be compiled on amd64.
The amd64 port does not have the old 'legacy' linuxthreads 
but only the newer nptl.

Regards
Andreas Jochens

How to repeat:
Try to compile on AMD64 architecture running Linux. Or at least Debian GNU/Linux, I'm not sure about others, ask Andreas.

Suggested fix:
diff -urN ../tmp-orig/mysql-dfsg-4.0.21/configure ./configure
--- ../tmp-orig/mysql-dfsg-4.0.21/configure	2004-10-01 14:22:20.900250208 +0200
+++ ./configure	2004-10-01 14:22:17.787723384 +0200
@@ -24953,18 +24953,10 @@
     else
       echo "$as_me:$LINENO: result: \"Not found\"" >&5
 echo "${ECHO_T}\"Not found\"" >&6
-      # If this is a linux machine we should barf
       if test "$IS_LINUX" = "true"
       then
-	{ { echo "$as_me:$LINENO: error: This is a linux system and Linuxthreads was not
-found. On linux Linuxthreads should be used.  Please install Linuxthreads
-(or a new glibc) and try again.  See the Installation chapter in the
-Reference Manual for more information." >&5
-echo "$as_me: error: This is a linux system and Linuxthreads was not
-found. On linux Linuxthreads should be used.  Please install Linuxthreads
-(or a new glibc) and try again.  See the Installation chapter in the
-Reference Manual for more information." >&2;}
-   { (exit 1); exit 1; }; }
+        # use nptl instead of linuxthreads
+        CFLAGS="$CFLAGS -DUSE_MUTEX_INSTEAD_OF_RW_LOCKS -DPTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP"
       else
 	echo "$as_me:$LINENO: checking \"DEC threads\"" >&5
 echo $ECHO_N "checking \"DEC threads\"... $ECHO_C" >&6
diff -urN ../tmp-orig/mysql-dfsg-4.0.21/configure.in ./configure.in
--- ../tmp-orig/mysql-dfsg-4.0.21/configure.in	2004-09-07 00:29:39.000000000 +0200
+++ ./configure.in	2004-10-01 14:22:10.295862320 +0200
@@ -1238,13 +1238,10 @@
       with_named_thread="-lpthread"
     else
       AC_MSG_RESULT("Not found")
-      # If this is a linux machine we should barf
       if test "$IS_LINUX" = "true"
       then
-	AC_MSG_ERROR([This is a linux system and Linuxthreads was not
-found. On linux Linuxthreads should be used.  Please install Linuxthreads
-(or a new glibc) and try again.  See the Installation chapter in the
-Reference Manual for more information.])
+        # use nptl instead of linuxthreads
+        CFLAGS="$CFLAGS -DUSE_MUTEX_INSTEAD_OF_RW_LOCKS -DPTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP"
       else
 	AC_MSG_CHECKING("DEC threads")
         if test -f /usr/shlib/libpthread.so -a -f /usr/lib/libmach.a -a -f /usr/ccs/lib/cmplrs/cc/libexc.a
[29 Oct 2004 13:37] Joerg Bruehe
Effectively, this is the same problem in 4.0 as bug#2173 (reported for 4.1).
We will change the configuration tools to support builds on Linux with any threads library. However, this will involve several changes applied in sequence, each to be checked and verified.
[26 Apr 2005 8:15] Joerg Bruehe
Sorry for the delay!

As written in my last entry, this is basically the same thing as bug#2173 (reported for MySQL 4.1).
For that, a patch is accepted, will soon be pushed. Please look into bug#2173 for details.

There is no intention to fix 4.0, as this is stable, and 4.1 also has production status.