From f89c9fc4b7b5d82c79775cb848225900b45a6b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sat, 19 Dec 2015 13:25:55 +0200 Subject: [PATCH 1/6] MDEV-7526: TokuDB doesn't build on OS X This patch fixes one compilation error related to __db_lsn struct. The struct can not be defined as empty according to the main C standard. In C++, this is handled by forcing a size of 1. To eliminate the error we add a dummy char field of size 1. This has no effect on the C++ compiled code, but also removes the compiler error. --- storage/tokudb/ft-index/buildheader/make_tdb.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storage/tokudb/ft-index/buildheader/make_tdb.cc b/storage/tokudb/ft-index/buildheader/make_tdb.cc index 53706649231..610ce670db5 100644 --- a/storage/tokudb/ft-index/buildheader/make_tdb.cc +++ b/storage/tokudb/ft-index/buildheader/make_tdb.cc @@ -481,7 +481,9 @@ static void print_db_key_range_struct (void) { static void print_db_lsn_struct (void) { field_counter=0; - sort_and_dump_fields("db_lsn", false, NULL); + /* A dummy field to make sizeof(DB_LSN) equal in C and C++ */ + const char *extra[] = { "char dummy", NULL }; + sort_and_dump_fields("db_lsn", false, extra); } static void print_dbt_struct (void) { From 64149590c47d1cf6b1b227d8c90bdc23d20a8956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sat, 19 Dec 2015 13:31:44 +0200 Subject: [PATCH 2/6] MDEV-7526: TokuDB doesn't build on OS X This patch fixes another compilation error caused by specifying attribute nonnull for all the parameters of the copyout function. This is incorrect as the function actually gets called with null parameters indirectly and thus only the output parameter should be nonnull. --- storage/tokudb/ft-index/util/dmt.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/tokudb/ft-index/util/dmt.h b/storage/tokudb/ft-index/util/dmt.h index d4b032f5d6f..43e44df6a70 100644 --- a/storage/tokudb/ft-index/util/dmt.h +++ b/storage/tokudb/ft-index/util/dmt.h @@ -679,16 +679,16 @@ private: __attribute__((nonnull)) void rebalance(subtree *const subtree); - __attribute__((nonnull)) + __attribute__((nonnull(3))) static void copyout(uint32_t *const outlen, dmtdata_t *const out, const dmt_node *const n); - __attribute__((nonnull)) + __attribute__((nonnull(3))) static void copyout(uint32_t *const outlen, dmtdata_t **const out, dmt_node *const n); - __attribute__((nonnull)) + __attribute__((nonnull(4))) static void copyout(uint32_t *const outlen, dmtdata_t *const out, const uint32_t len, const dmtdata_t *const stored_value_ptr); - __attribute__((nonnull)) + __attribute__((nonnull(4))) static void copyout(uint32_t *const outlen, dmtdata_t **const out, const uint32_t len, dmtdata_t *const stored_value_ptr); template Date: Sat, 19 Dec 2015 13:52:27 +0200 Subject: [PATCH 3/6] MDEV-7526: TokuDB doesn't build on OS X Removed unused functions from tokudb_dump.cc. --- storage/tokudb/ft-index/tools/tokudb_dump.cc | 70 -------------------- 1 file changed, 70 deletions(-) diff --git a/storage/tokudb/ft-index/tools/tokudb_dump.cc b/storage/tokudb/ft-index/tools/tokudb_dump.cc index 2da50bb793a..b162c5caece 100644 --- a/storage/tokudb/ft-index/tools/tokudb_dump.cc +++ b/storage/tokudb/ft-index/tools/tokudb_dump.cc @@ -247,76 +247,6 @@ outputplaintextstring(char* str) g.plaintext = old_plaintext; } -static inline int -hextoint(int ch) -{ - if (ch >= '0' && ch <= '9') { - return ch - '0'; - } - if (ch >= 'a' && ch <= 'z') { - return ch - 'a' + 10; - } - if (ch >= 'A' && ch <= 'Z') { - return ch - 'A' + 10; - } - return EOF; -} - -static inline int -printabletocstring(char* inputstr, char** poutputstr) -{ - char highch; - char lowch; - char nextch; - char* cstring; - - assert(inputstr); - assert(poutputstr); - assert(*poutputstr == NULL); - - cstring = (char*)toku_malloc((strlen(inputstr) + 1) * sizeof(char)); - if (cstring == NULL) { - PRINT_ERROR(errno, "printabletocstring"); - goto error; - } - - for (*poutputstr = cstring; *inputstr != '\0'; inputstr++) { - if (*inputstr == '\\') { - if ((highch = *++inputstr) == '\\') { - *cstring++ = '\\'; - continue; - } - if (highch == '\0' || (lowch = *++inputstr) == '\0') { - PRINT_ERROR(0, "unexpected end of input data or key/data pair"); - goto error; - } - if (!isxdigit(highch)) { - PRINT_ERROR(0, "Unexpected '%c' (non-hex) input.\n", highch); - goto error; - } - if (!isxdigit(lowch)) { - PRINT_ERROR(0, "Unexpected '%c' (non-hex) input.\n", lowch); - goto error; - } - nextch = (char)((hextoint(highch) << 4) | hextoint(lowch)); - if (nextch == '\0') { - /* Database names are c strings, and cannot have extra NULL terminators. */ - PRINT_ERROR(0, "Unexpected '\\00' in input.\n"); - goto error; - } - *cstring++ = nextch; - } - else *cstring++ = *inputstr; - } - /* Terminate the string. */ - *cstring = '\0'; - return EXIT_SUCCESS; - -error: - PRINT_ERROR(0, "Quitting out due to errors.\n"); - return EXIT_FAILURE; -} - static inline int verify_library_version(void) { From e386523a41245d8b03f1338934c1aa965530e4fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Sat, 19 Dec 2015 13:53:43 +0200 Subject: [PATCH 4/6] MDEV-7526: TokuDB doesn't build on OS X Fixed compile warning related to if statement always being true. The if statement can not be false, as the address of a member field is always true. --- storage/tokudb/ft-index/ft/txn/rollback.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/storage/tokudb/ft-index/ft/txn/rollback.cc b/storage/tokudb/ft-index/ft/txn/rollback.cc index 62048039c26..ea2f2a07c50 100644 --- a/storage/tokudb/ft-index/ft/txn/rollback.cc +++ b/storage/tokudb/ft-index/ft/txn/rollback.cc @@ -147,9 +147,7 @@ static inline PAIR_ATTR make_rollback_pair_attr(long size) { PAIR_ATTR rollback_memory_size(ROLLBACK_LOG_NODE log) { size_t size = sizeof(*log); - if (&log->rollentry_arena) { - size += log->rollentry_arena.total_footprint(); - } + size += log->rollentry_arena.total_footprint(); return make_rollback_pair_attr(size); } From 591e74c7e8f682f2eada7496f50aa73f38bd168d Mon Sep 17 00:00:00 2001 From: DevilSatan <2530212445@qq.com> Date: Sat, 20 Jun 2015 16:59:22 +0800 Subject: [PATCH 5/6] MDEV-7526: TokuDB doesn't build on OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A string definition is inconsistent and thus causes a compilation error. Signed-off-by: Vicențiu Ciorbaru --- storage/tokudb/ha_tokudb.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index b4e2c1a311e..2eb8004a296 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -379,7 +379,7 @@ static int free_share(TOKUDB_SHARE * share) { } const char *ha_tokudb::table_type() const { - extern const char * const tokudb_hton_name; + extern const char *tokudb_hton_name; return tokudb_hton_name; } From e126baafbc78f15c794082f0a93740d81041d038 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 21 Dec 2015 10:19:02 +0100 Subject: [PATCH 6/6] =?UTF-8?q?MDEV-9249=20MariaDB=20un-buildable=20on=20l?= =?UTF-8?q?inux64:=20fails=20@=20"error:=20=E2=80=98ERR=5Fremove=5Fstate?= =?UTF-8?q?=E2=80=99=20was=20not=20declared=20in=20this=20scope"=20when=20?= =?UTF-8?q?linking=20against=20OpenSSL=201.0.2e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ERR_remove_state is deprecated, use ERR_remove_thread_state if possible --- cmake/ssl.cmake | 5 +++++ config.h.cmake | 2 +- include/violite.h | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index ca950229129..43665d04a88 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -26,6 +26,7 @@ MACRO (MYSQL_USE_BUNDLED_SSL) SET(SSL_INCLUDE_DIRS ${INC_DIRS}) SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL) SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL -DMULTI_THREADED") + SET(HAVE_ERR_remove_thread_state OFF CACHE INTERNAL "yassl doesn't have ERR_remove_thread_state") CHANGE_SSL_SETTINGS("bundled") #Remove -fno-implicit-templates #(yassl sources cannot be compiled with it) @@ -70,9 +71,13 @@ MACRO (MYSQL_CHECK_SSL) MARK_AS_ADVANCED(CRYPTO_LIBRARY) INCLUDE(CheckSymbolExists) SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h" HAVE_SHA512_DIGEST_LENGTH) + CHECK_SYMBOL_EXISTS(ERR_remove_thread_state "openssl/err.h" + HAVE_ERR_remove_thread_state) SET(CMAKE_REQUIRED_INCLUDES) + SET(CMAKE_REQUIRED_LIBRARIES) IF(OPENSSL_FOUND AND CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH) SET(SSL_SOURCES "") SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY}) diff --git a/config.h.cmake b/config.h.cmake index 73dc918bc3c..02952f6f395 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -465,7 +465,7 @@ #cmakedefine HAVE_BSD_SIGNALS 1 #cmakedefine HAVE_SVR3_SIGNALS 1 #cmakedefine HAVE_V7_SIGNALS 1 - +#cmakedefine HAVE_ERR_remove_thread_state 1 #cmakedefine HAVE_SOLARIS_STYLE_GETHOST 1 diff --git a/include/violite.h b/include/violite.h index 14c99e8d8fe..ea7e3d7897c 100644 --- a/include/violite.h +++ b/include/violite.h @@ -123,6 +123,10 @@ typedef my_socket YASSL_SOCKET_T; #include #include +#ifdef HAVE_ERR_remove_thread_state +#define ERR_remove_state(X) ERR_remove_thread_state(NULL) +#endif + enum enum_ssl_init_error { SSL_INITERR_NOERROR= 0, SSL_INITERR_CERT, SSL_INITERR_KEY,