Bug #9497 Check for LinuxThreads does not work on Gentoo AMD64 2005.0
Submitted: 30 Mar 2005 18:28 Modified: 26 Apr 2005 8:34
Reporter: Sebastian Bergmann Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:Irrelevant OS:Linux (Gentoo Linux)
Assigned to: Joerg Bruehe

[30 Mar 2005 18:28] Sebastian Bergmann
Description:
MySQL's configure uses

  grep Linuxthreads /usr/include/pthread.h

to check for the LinuxThreads implementation in the system's GLIBC.

This check does not work on multilib-enabled Gentoo Linux installations, for instance on Gentoo Linux AMD 2005.0, where /usr/include/pthread.h is a wrapper that looks like this:

  #ifdef __i386__
  #include "gentoo-multilib/x86/pthread.h"
  #endif /* __i386__ */

  #ifdef __x86_64__
  #include "gentoo-multilib/amd64/pthread.h"
  #endif /* __x86_64__ */

How to repeat:
sb@wopr mysql-5.0 % ./BUILD/compile-amd64-max

Suggested fix:
I see two solutions to this problem: Either change the check for LinuxThreads or add a
configure switch that disables the check and makes configure assume that LinuxThreads
is available.
[30 Mar 2005 19:12] Miguel Solorzano
The work-around for this is to add somewhere "Linuxthreads" in
/usr/include/pthread.h for to make the test to work.
[30 Mar 2005 22:05] Sergei Golubchik
Sure, such a workaround may help now.

But will will improve linuxthread detection anyway :)
[31 Mar 2005 9:24] Sergei Golubchik
related to http://bugs.mysql.com/2173
[26 Apr 2005 8:34] Joerg Bruehe
Patch for bug#2173 is about to be pushed soon.

This patch tries "getconf GNU_LIBPTHREAD_VERSION" first, it falls back onto the "grep /usr/include/pthread.h" method only when "getconf" fails. For Linux, it now supports both "Linuxthreads" and "NPTL".
(I have no Gentoo installation to test, would welcome feedback!)

Note that the whole detection issue can always be overridden by giving the '--with-named-thread-libs' option to "configure", which for Linux would be '--with-named-thread-libs="-lpthread"'.
Unluckily, this may have undesired side effects, as there are couplings between thread library detection and other configuration parameters - so if you should take that road, please test your binaries!

Patch for bug#2173 solves the problem and breaks these couplings.
[26 Apr 2005 10:16] 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/internals/24304
[26 Apr 2005 11:16] 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/internals/24310
[21 Jul 2011 10:05] uong channith
Hello sir! what can i learn MySQL?
and what can i connection MYSQL with server Linux?