#At file:///export/home/tmp/ss156133/z/43397-51/ based on
revid:joro@stripped
3015 Staale Smedseng 2009-07-08
Bug #43397 mysql headers redefine pthread_mutex_init
unnecessarily
The problem is that libmysqlclient.so is built with THREAD
undefined, while a client compiling against the same header
files will see THREAD as defined and definitions in
my_pthread.h will be included, possibly resulting in undefined
symbols that cannot be resolved with libmysqlclient.so.
The suggested solution is to require that clients wanting to
link with libmysqlclient.so should be build with NO_THREADS
defined. This requires a documentation change, and more
details for this will be supplied if this patch is approved.
The NO_THREADS define was renamed from UNDEF_THREADS_HACK, to
get a more suitable (less suspicious) name for the define.
This patch is also in anticipation of WL#4958, which will
remove this problem altogether by dropping the building of
the libmysqlclient.
modified:
client/Makefile.am
cmd-line-utils/readline/Makefile.am
include/my_global.h
libmysql/Makefile.am
tests/Makefile.am
=== modified file 'client/Makefile.am'
--- a/client/Makefile.am 2008-09-06 00:51:17 +0000
+++ b/client/Makefile.am 2009-07-08 14:03:46 +0000
@@ -80,14 +80,14 @@ mysqlimport_LDADD = $(CXXLDFLAGS) $(CLI
mysqlshow_SOURCES= mysqlshow.c
mysqlslap_SOURCES= mysqlslap.c
-mysqlslap_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK
+mysqlslap_CFLAGS= -DTHREAD -UNO_THREADS
mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \
$(top_builddir)/mysys/libmysys.a
mysqltest_SOURCES= mysqltest.cc
-mysqltest_CXXFLAGS= -DTHREAD -UUNDEF_THREADS_HACK
+mysqltest_CXXFLAGS= -DTHREAD -UNO_THREADS
mysqltest_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \
@@ -99,7 +99,7 @@ mysql_upgrade_SOURCES= mysql_up
$(top_srcdir)/mysys/my_getpagesize.c
# Fix for mit-threads
-DEFS = -DUNDEF_THREADS_HACK \
+DEFS = -DNO_THREADS \
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
-DDATADIR="\"$(localstatedir)\""
=== modified file 'cmd-line-utils/readline/Makefile.am'
--- a/cmd-line-utils/readline/Makefile.am 2007-09-26 18:19:33 +0000
+++ b/cmd-line-utils/readline/Makefile.am 2009-07-08 14:03:46 +0000
@@ -31,7 +31,7 @@ noinst_HEADERS = readline.h chardefs.h k
EXTRA_DIST= emacs_keymap.c vi_keymap.c
-DEFS = -DUNDEF_THREADS_HACK -DHAVE_CONFIG_H -DNO_KILL_INTR
+DEFS = -DNO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR
# Don't update the files from bitkeeper
%::SCCS/s.%
=== modified file 'include/my_global.h'
--- a/include/my_global.h 2009-05-31 12:16:15 +0000
+++ b/include/my_global.h 2009-07-08 14:03:46 +0000
@@ -276,7 +276,7 @@
#endif
/* The client defines this to avoid all thread code */
-#if defined(UNDEF_THREADS_HACK)
+#if defined(NO_THREADS)
#undef THREAD
#undef HAVE_LINUXTHREADS
#undef HAVE_NPTL
=== modified file 'libmysql/Makefile.am'
--- a/libmysql/Makefile.am 2007-11-22 11:39:07 +0000
+++ b/libmysql/Makefile.am 2009-07-08 14:03:46 +0000
@@ -21,7 +21,7 @@
# This file is public domain and comes with NO WARRANTY of any kind
target = libmysqlclient.la
-target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
+target_defs = -DNO_THREADS -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
LIBS = @CLIENT_LIBS@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes) @ZLIB_INCLUDES@
@@ -104,7 +104,7 @@ do-lib-dist:
echo "# A very minimal Makefile to compile" > $$dir/Makefile; \
echo "# the minimized libmysql library" >> $$dir/Makefile; \
echo "# This file is autogenerated from Makefile.am" >> $$dir/Makefile; \
- echo 'CFLAGS= -I. -DUNDEF_THREADS_HACK' >>$$dir/Makefile; \
+ echo 'CFLAGS= -I. -DNO_THREADS' >>$$dir/Makefile; \
echo "obj=$$objs" >>$$dir/Makefile; \
echo 'all: libmysql.a' >>$$dir/Makefile; \
echo 'libmysql.a: $$(obj)' >>$$dir/Makefile; \
=== modified file 'tests/Makefile.am'
--- a/tests/Makefile.am 2007-07-24 07:03:01 +0000
+++ b/tests/Makefile.am 2009-07-08 14:03:46 +0000
@@ -56,7 +56,7 @@ bug25714_SOURCES= bug25714.c
bug25714_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
# Fix for mit-threads
-DEFS = -DUNDEF_THREADS_HACK
+DEFS = -DNO_THREADS
thread_test.o: thread_test.c
$(COMPILE) -c $(INCLUDES) $<
Attachment: [text/bzr-bundle] bzr/staale.smedseng@sun.com-20090708140346-15lpfmniin2vruly.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (staale.smedseng:3015) Bug#43397 | Staale Smedseng | 8 Jul 2009 |