From 0de9a4ababac1e7f510558dfd0bece894cf7e69c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Nov 2010 13:24:20 +0100 Subject: MWL#74: Shared libmysqld.so library. Switch makefiles to use libtool to build libmysqld.so, as well as all its dependencies. The previous MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS() declaration is removed, as it does not work well with a libtool build. Instead, plugins that need it can specify an alternate object in MYSQL_PLUGIN_STATIC() that will be used for embedded library. The plugin must then take care itself of compiling the special object for embedded, rebuilding the source files previously listed in MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS() with @plugin_embedded_defs@ in CFLAGS/CXXFLAGS. The extra target @XXX_embedded_static_target@ is available for the special object, this will be empty when --without-embedded-server. All in-tree plugins are changed to build their static targets with libtool. Additional plugins that want to work with libmysqld.so will need to be similarly modified to build with libtool (or otherwise provide an -fPIC object). Dynamically loaded plugins are not affected. The old libraries like libmysys.a, libmyisam.a and similar libraries, which were installed by `make install` though this is of little use, are still built and installed to not break package scripts etc. that expect them. These libraries are kept static to avoid introducing new .so dependencies. The patch also fixes a handfull of duplicate symbol linker errors, where we included some object twice during linking; these for one reason or another did not produce errors before but caused problems on some platforms with this patch (eg. Mac OS X linker is more strict for shared objects). This patch only does what is necessary to build libmysqld.so. There are some more cleanups that are possible now that we are using libtool more fully, which could done in subsequent patches (though we may not bother as we are switching from autotools to CMake anyway): - In libmysql_r/, we should be able to just link libmysys.la etc, instead of symlinking and re-compiling sources into the directory. - In libmysql/, we can similarly avoid symlinking and recompiling sources if we instead build a libmysys_nothread.la library with appropriate CFLAGS and link that. - In sql/, we can build a separate target libmysql_int.la with appropriate CFLAGS for embedded and use that in libmysqld/ instead of symlinking sources. - libmysys.a, libmyisam.a and similar libraries could be installed as .so also to save on code size; or alternatively could be not installed at all. client/Makefile.am: Updated for using libtool config/ac-macros/plugins.m4: Replace MUSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS with mechanism for plugins to specify alternate object for embedded. configure.in: Fix linking duplicate objects related to THREAD_LOBJECTS. dbug/Makefile.am: Updated for using libtool extra/Makefile.am: Fix relative paths. libmysqld/Makefile.am: Build libmysqld.la using libtool libmysqld/examples/Makefile.am: Updated to use libtool mysys/Makefile.am: Updated to use libtool. Fix linking duplicate objects related to THREAD_LOBJECTS. mysys/my_uuid.c: Fix conflicting global mutex name by making it static. regex/Makefile.am: Updated to use libtool sql/Makefile.am: Updated to use libtool sql/item_func.cc: Fix conflicting mutex name. sql/mysql_priv.h: Fix conflicting mutex name sql/mysqld.cc: Fix conflicting mutex name. Add missing call of my_uuid_end(). storage/archive/Makefile.am: Updated to use libtool storage/archive/plug.in: Updated to use libtool storage/blackhole/Makefile.am: Updated to use libtool storage/blackhole/plug.in: Updated to use libtool storage/csv/Makefile.am: Updated to use libtool storage/csv/plug.in: Updated to use libtool storage/example/Makefile.am: Updated to use libtool storage/federated/Makefile.am: Updated to use libtool storage/federated/plug.in: Updated to use libtool storage/federatedx/Makefile.am: Updated to use libtool storage/federatedx/plug.in: Updated to use libtool storage/heap/Makefile.am: Updated to use libtool storage/heap/plug.in: Updated to use libtool storage/innobase/Makefile.am: Updated to use libtool storage/innobase/plug.in.disabled: Updated to use libtool storage/innodb_plugin/Makefile.am: Updated to use libtool storage/maria/CMakeLists.txt: Fix linking duplicate object in maria_dump_log, causes failure on Mac OS X storage/maria/Makefile.am: Updated to use libtool Fix linking duplicate object in maria_dump_log, causes link failure on Mac OS X storage/maria/ma_loghandler.c: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/ma_loghandler.h: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/maria_dump_log.c: Move maria_dump_log code to separate file to fix duplicate object link failures. storage/maria/plug.in: Updated to use libtool storage/myisam/Makefile.am: Updated to use libtool storage/myisam/plug.in: Updated to use libtool storage/myisammrg/Makefile.am: Updated to use libtool storage/myisammrg/plug.in: Updated to use libtool storage/pbxt/plug.in: Updated to use libtool storage/pbxt/src/Makefile.am: Updated to use libtool storage/xtradb/Makefile.am: Updated to use libtool storage/xtradb/plug.in: Updated to use libtool strings/Makefile.am: Updated to use libtool unittest/unit.pl: Don't attempt to run libtool internal files as unit tests. vio/Makefile.am: Updated to use libtool --- dbug/Makefile.am | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'dbug') diff --git a/dbug/Makefile.am b/dbug/Makefile.am index 528a6a02fbf..e8acb0ca2c0 100644 --- a/dbug/Makefile.am +++ b/dbug/Makefile.am @@ -16,10 +16,11 @@ # MA 02111-1307, USA INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -LDADD = libdbug.a ../mysys/libmysys.a ../strings/libmystrings.a +LDADD = libdbug.a $(top_builddir)/mysys/libmysys.a $(top_builddir)/strings/libmystrings.a pkglib_LIBRARIES = libdbug.a +noinst_LTLIBRARIES = libdbug.la noinst_HEADERS = dbug_long.h -libdbug_a_SOURCES = dbug.c sanity.c +libdbug_la_SOURCES = dbug.c sanity.c EXTRA_DIST = CMakeLists.txt example1.c example2.c example3.c \ user.r monty.doc dbug_add_tags.pl \ my_main.c main.c factorial.c dbug_analyze.c \ @@ -65,3 +66,7 @@ output5.r: factorial # a hack to have executable in builddir, not in srcdir tests-t: tests-t.pl cp -f $(srcdir)/tests-t.pl ./tests-t + +libdbug_a_SOURCES= +libdbug.a: libdbug.la + $(CP) .libs/libdbug.a $@ -- cgit v1.2.1 From 0eae06c43007d7e59275af2d437b3c19537bab46 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 6 Dec 2010 12:52:06 +0100 Subject: Bug#473914: mysql_client_test fail with in debug compilaton on windows x64 Reason: inconsistent compilation, federatedx is compiled without SAFEMALLOC flag, while anything else is compiled with SAFEMALLOC. As a consequence, my_hash_init used inside federatedx initialization does not provide correct caller info parameters (file, line) , so they are initialized with whatever is on stack. When info about allocated memory is output in COM_DEBUG command, the server crashes trying to output string starting at 0xcccccccccccccccc. The fix is to remove SAFEMALLOC preprocessor flags from every CMakeLists.txt, except the top-level one. Also, SAFEMALLOC is not defined by default now, instead there is WITH_DEBUG_FULL CMake option which adds -DSAFEMALLOC to C and C++ flags in debug compilation. This option is off by default, because 1) Debug C runtime already has heap debugging builtin with overwrite and leak detection 2)safemalloc considerably slows down the tests. Note also that - SAFEMALLOC is gone in MySQL5.5 - On Windows, heap related overflows can also be found using free pageheap utility (that is also part of application verifier). This is even more efficient if there are no other layers on top of Windows heap allocator, e.g it is most efficient with release version. --- dbug/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'dbug') diff --git a/dbug/CMakeLists.txt b/dbug/CMakeLists.txt index 8b27f79dcf4..fabb592dccc 100644 --- a/dbug/CMakeLists.txt +++ b/dbug/CMakeLists.txt @@ -18,7 +18,6 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/dbug) SET(DBUG_SOURCES dbug.c factorial.c sanity.c) IF(NOT SOURCE_SUBLIBS) - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX") INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) ADD_LIBRARY(dbug ${DBUG_SOURCES}) ENDIF(NOT SOURCE_SUBLIBS) -- cgit v1.2.1 From 39616eb9ef974c69e73bcb80cd7e3c40228910fd Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 23 Feb 2011 02:06:58 +0200 Subject: Fixed compiler warnings and some test failures found by buildbot dbug/dbug.c: Fixed compiler warnings on windows mysql-test/r/index_intersect_innodb.result: Don't print number of rows as this varies mysql-test/suite/funcs_1/r/processlist_val_no_prot.result: Update to use new State mysql-test/suite/handler/heap.result: Update results mysql-test/suite/handler/heap.test: Changed key used in test as the key 'b' will not guarantee order of the two last elements (as the key value is the same) mysql-test/suite/pbxt/r/lock_multi.result: Update to use new State mysql-test/t/index_intersect.test: Don't print number of rows as this varies mysql-test/valgrind.supp: Added suppression for linux mysys/hash.c: Fixed compiler warnings on windows plugin/handler_socket/handlersocket/database.cpp: Fixed compiler warnings sql-common/client_plugin.c: Changed variable to define to avoid compiler warnings when variable is not used sql-common/my_time.c: Initialize all my_time elements to avoid compiler warnings storage/oqgraph/ha_oqgraph.cc: Use right function (to avoid compiler warning) storage/pbxt/src/table_xt.cc: Initialize variables (to avoid compiler warnings) --- dbug/dbug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dbug') diff --git a/dbug/dbug.c b/dbug/dbug.c index 490c91cbf0f..afed84a1c01 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -1481,7 +1481,7 @@ next: subdir=0; while (ctlp < end && *ctlp != ',') ctlp++; - len=ctlp-start; + len= (int) (ctlp-start); if (start[len-1] == '/') { len--; @@ -1544,7 +1544,7 @@ static struct link *ListCopy(struct link *orig) { struct link *new_malloc; struct link *head; - int len; + size_t len; head= NULL; while (orig != NULL) @@ -1999,7 +1999,7 @@ static void DBUGOpenFile(CODE_STATE *cs, { if (end) { - int len=end-name; + int len= (int) (end-name); memcpy(cs->stack->name, name, len); cs->stack->name[len]=0; } -- cgit v1.2.1