Bug #28456 | my_global.h inappropriately depends on kernel header asm/atomic.h | ||
---|---|---|---|
Submitted: | 15 May 2007 22:45 | Modified: | 1 Nov 2012 10:31 |
Reporter: | Monty Taylor | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | MySQL Server: Compiling | Severity: | S3 (Non-critical) |
Version: | 5.0.38 | OS: | Linux |
Assigned to: | CPU Architecture: | Any |
[15 May 2007 22:45]
Monty Taylor
[17 May 2007 8:42]
Sveta Smirnova
Thank you for the report. Verified as described using code analysis. See also http://docs.fedoraproject.org/release-notes/fc6/en_US/sn-Devel.html: 12.2.1. Kernel header files <skip> * The <asm/atomic.h> and <asm/bitops.h> header files have been removed. These were not designed for use in userspace, and would fail to compile on some architectures while silently giving non-atomic behaviour on others. The C compiler provides its own atomic builtin functions that are suitable for use in userspace programs instead.
[22 May 2007 1:45]
Marc ALFF
Related to Bug#21554
[23 Oct 2007 15:39]
Baron Schwartz
I downloaded mysql-5.0.45-linux-x86_64-glibc23.tar.gz and encountered the error mentioned by the reporter, while trying to build a UDF with the following command: gcc -fPIC -Wall -I/home/baron/5.0.45/include/ -shared -o now_usec.so now_usec.cc Since the bug report seems to indicate atomic add might not be all that important, I tried just removing the #include <asm/atomic.h> line, and the UDF built okay. But now, master [localhost] {msandbox} (mysql) > create function now_usec returns string soname 'now_usec.so'; ERROR 1126 (HY000): Can't open shared library 'now_usec.so' (errno: 22 /lib/now_usec.so: undefined symbol: __gxx_personality_v0) I'm adding this comment in hopes it's related. Ubuntu 7.04 on AMD64: baron@tigger rsandbox $ uname -a Linux tigger 2.6.20-16-generic #2 SMP Sun Sep 23 18:31:23 UTC 2007 x86_64 GNU/Linux
[25 Oct 2007 7:47]
Robin Johnson
I confirm that this compile bug still exists in 5.0.46. The patch from #21554 applies with a little bit of manual fixup. Downstream Gentoo bug is https://bugs.gentoo.org/show_bug.cgi?id=197004
[27 Aug 2009 18:02]
Mark Callaghan
See this too -- http://lists.mysql.com/packagers/264 Note that the RHEL/CentOS source RPMs patch configure so that HAVE_ATOMIC_ADD is always not defined and then the thread_safe_* functions use a mutex, so RHEL/CentOS users lose a bit of performance. #ifdef HAVE_ATOMIC_ADD #define thread_safe_increment(V,L) atomic_inc((atomic_t*) &V) #define thread_safe_decrement(V,L) atomic_dec((atomic_t*) &V) #define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V) #define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V) #else #define thread_safe_increment(V,L) \ (pthread_mutex_lock((L)), (V)++, pthread_mutex_unlock((L))) #define thread_safe_decrement(V,L) \ (pthread_mutex_lock((L)), (V)--, pthread_mutex_unlock((L))) #define thread_safe_add(V,C,L) (pthread_mutex_lock((L)), (V)+=(C), pthread_mutex_unlock((L))) #define thread_safe_sub(V,C,L) \ (pthread_mutex_lock((L)), (V)-=(C), pthread_mutex_unlock((L))) #endif /* HAVE_ATOMIC_ADD */
[1 Nov 2012 10:31]
Ståle Deraas
Only relevant for 5.0, and as such not feasible to fix.