Commit f46dba5a authored by Staale Smedseng's avatar Staale Smedseng

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 built with
MYSQL_CLIENT_NO_THREADS defined. This requires a documentation
change, and more details for this will be supplied if this
patch is approved.
      
The MYSQL_CLIENT_NO_THREADS define was renamed from
UNDEF_THREADS_HACK, to get a more suitable (less suspicious)
name for the define. (The UNDEF_THREADS_HACK is retained for
backwards compatibility, though.)
      
This patch is also in anticipation of WL#4958, which will
remove this problem altogether by dropping the building of
libmysqlclient.
parent 7c28ec97
...@@ -80,14 +80,14 @@ mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ ...@@ -80,14 +80,14 @@ mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
mysqlshow_SOURCES= mysqlshow.c mysqlshow_SOURCES= mysqlshow.c
mysqlslap_SOURCES= mysqlslap.c mysqlslap_SOURCES= mysqlslap.c
mysqlslap_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK mysqlslap_CFLAGS= -DTHREAD -UMYSQL_CLIENT_NO_THREADS
mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \ @CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \ $(LIBMYSQLCLIENT_LA) \
$(top_builddir)/mysys/libmysys.a $(top_builddir)/mysys/libmysys.a
mysqltest_SOURCES= mysqltest.cc mysqltest_SOURCES= mysqltest.cc
mysqltest_CXXFLAGS= -DTHREAD -UUNDEF_THREADS_HACK mysqltest_CXXFLAGS= -DTHREAD -UMYSQL_CLIENT_NO_THREADS
mysqltest_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \ mysqltest_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \ @CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \ $(LIBMYSQLCLIENT_LA) \
...@@ -99,7 +99,7 @@ mysql_upgrade_SOURCES= mysql_upgrade.c \ ...@@ -99,7 +99,7 @@ mysql_upgrade_SOURCES= mysql_upgrade.c \
$(top_srcdir)/mysys/my_getpagesize.c $(top_srcdir)/mysys/my_getpagesize.c
# Fix for mit-threads # Fix for mit-threads
DEFS = -DUNDEF_THREADS_HACK \ DEFS = -DMYSQL_CLIENT_NO_THREADS \
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \ -DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
-DDATADIR="\"$(localstatedir)\"" -DDATADIR="\"$(localstatedir)\""
......
...@@ -31,7 +31,7 @@ noinst_HEADERS = readline.h chardefs.h keymaps.h \ ...@@ -31,7 +31,7 @@ noinst_HEADERS = readline.h chardefs.h keymaps.h \
EXTRA_DIST= emacs_keymap.c vi_keymap.c EXTRA_DIST= emacs_keymap.c vi_keymap.c
DEFS = -DUNDEF_THREADS_HACK -DHAVE_CONFIG_H -DNO_KILL_INTR DEFS = -DMYSQL_CLIENT_NO_THREADS -DHAVE_CONFIG_H -DNO_KILL_INTR
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
#endif #endif
/* The client defines this to avoid all thread code */ /* The client defines this to avoid all thread code */
#if defined(UNDEF_THREADS_HACK) #if defined(MYSQL_CLIENT_NO_THREADS) || defined(UNDEF_THREADS_HACK)
#undef THREAD #undef THREAD
#undef HAVE_LINUXTHREADS #undef HAVE_LINUXTHREADS
#undef HAVE_NPTL #undef HAVE_NPTL
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# This file is public domain and comes with NO WARRANTY of any kind # This file is public domain and comes with NO WARRANTY of any kind
target = libmysqlclient.la target = libmysqlclient.la
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@ target_defs = -DMYSQL_CLIENT_NO_THREADS -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
LIBS = @CLIENT_LIBS@ LIBS = @CLIENT_LIBS@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes) @ZLIB_INCLUDES@ $(openssl_includes) @ZLIB_INCLUDES@
...@@ -104,7 +104,7 @@ do-lib-dist: ...@@ -104,7 +104,7 @@ do-lib-dist:
echo "# A very minimal Makefile to compile" > $$dir/Makefile; \ echo "# A very minimal Makefile to compile" > $$dir/Makefile; \
echo "# the minimized libmysql library" >> $$dir/Makefile; \ echo "# the minimized libmysql library" >> $$dir/Makefile; \
echo "# This file is autogenerated from Makefile.am" >> $$dir/Makefile; \ echo "# This file is autogenerated from Makefile.am" >> $$dir/Makefile; \
echo 'CFLAGS= -I. -DUNDEF_THREADS_HACK' >>$$dir/Makefile; \ echo 'CFLAGS= -I. -DMYSQL_CLIENT_NO_THREADS' >>$$dir/Makefile; \
echo "obj=$$objs" >>$$dir/Makefile; \ echo "obj=$$objs" >>$$dir/Makefile; \
echo 'all: libmysql.a' >>$$dir/Makefile; \ echo 'all: libmysql.a' >>$$dir/Makefile; \
echo 'libmysql.a: $$(obj)' >>$$dir/Makefile; \ echo 'libmysql.a: $$(obj)' >>$$dir/Makefile; \
......
...@@ -56,7 +56,7 @@ bug25714_SOURCES= bug25714.c ...@@ -56,7 +56,7 @@ bug25714_SOURCES= bug25714.c
bug25714_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES) bug25714_DEPENDENCIES= $(LIBRARIES) $(pkglib_LTLIBRARIES)
# Fix for mit-threads # Fix for mit-threads
DEFS = -DUNDEF_THREADS_HACK DEFS = -DMYSQL_CLIENT_NO_THREADS
thread_test.o: thread_test.c thread_test.o: thread_test.c
$(COMPILE) -c $(INCLUDES) $< $(COMPILE) -c $(INCLUDES) $<
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment