Commit 2f5d3724 authored by Etienne Guesnet's avatar Etienne Guesnet Committed by Daniel Black

Add build on AIX

parent ee69c153
...@@ -89,6 +89,10 @@ IF(WIN32) ...@@ -89,6 +89,10 @@ IF(WIN32)
SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "") SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "")
SET(INSTALL_SQLBENCHDIR "" CACHE STRING "") SET(INSTALL_SQLBENCHDIR "" CACHE STRING "")
SET(INSTALL_SUPPORTFILESDIR "" CACHE STRING "") SET(INSTALL_SUPPORTFILESDIR "" CACHE STRING "")
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "AIX")
# AIX freesource is RPM, but different than Linux RPM
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")
ELSEIF(RPM) ELSEIF(RPM)
SET(WITH_SSL system CACHE STRING "") SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "")
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#Enable 64 bit file offsets #Enable 64 bit file offsets
SET(_LARGE_FILES 1) SET(_LARGE_FILES 1)
IF(__AIX_COMPILER_XL)
# Fix xlC oddity - it complains about same inline function defined multiple times # Fix xlC oddity - it complains about same inline function defined multiple times
# in different compilation units # in different compilation units
INCLUDE(CheckCXXCompilerFlag) INCLUDE(CheckCXXCompilerFlag)
...@@ -24,10 +25,4 @@ INCLUDE(CheckCXXCompilerFlag) ...@@ -24,10 +25,4 @@ INCLUDE(CheckCXXCompilerFlag)
IF(HAVE_QSTATICINLINE) IF(HAVE_QSTATICINLINE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qstaticinline") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -qstaticinline")
ENDIF() ENDIF()
ENDIF()
# The following is required to export all symbols
# (also with leading underscore)
STRING(REPLACE "-bexpall" "-bexpfull" CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS
"${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}")
STRING(REPLACE "-bexpall" "-bexpfull" CMAKE_SHARED_LIBRARY_LINK_C_FLAGS
"${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}")
...@@ -209,6 +209,10 @@ MACRO(MYSQL_ADD_PLUGIN) ...@@ -209,6 +209,10 @@ MACRO(MYSQL_ADD_PLUGIN)
TARGET_LINK_LIBRARIES (${target} mysqlservices ${ARG_LINK_LIBRARIES}) TARGET_LINK_LIBRARIES (${target} mysqlservices ${ARG_LINK_LIBRARIES})
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
TARGET_LINK_OPTIONS(${target} PRIVATE "-Wl,-bE:${CMAKE_SOURCE_DIR}/libservices/mysqlservices_aix.def")
ENDIF()
# Server plugins use symbols defined in mysqld executable. # Server plugins use symbols defined in mysqld executable.
# Some operating systems like Windows and OSX and are pretty strict about # Some operating systems like Windows and OSX and are pretty strict about
# unresolved symbols. Others are less strict and allow unresolved symbols # unresolved symbols. Others are less strict and allow unresolved symbols
...@@ -217,7 +221,7 @@ MACRO(MYSQL_ADD_PLUGIN) ...@@ -217,7 +221,7 @@ MACRO(MYSQL_ADD_PLUGIN)
# Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate # Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate
# an additional dependency. # an additional dependency.
IF(ARG_RECOMPILE_FOR_EMBEDDED OR ARG_STORAGE_ENGINE) IF(ARG_RECOMPILE_FOR_EMBEDDED OR ARG_STORAGE_ENGINE)
IF(MSVC) IF(MSVC OR CMAKE_SYSTEM_NAME MATCHES AIX)
TARGET_LINK_LIBRARIES(${target} server) TARGET_LINK_LIBRARIES(${target} server)
ELSEIF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") ELSEIF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
TARGET_LINK_LIBRARIES (${target} mariadbd) TARGET_LINK_LIBRARIES (${target} mariadbd)
......
...@@ -320,6 +320,10 @@ int main(int argc,char *argv[]) ...@@ -320,6 +320,10 @@ int main(int argc,char *argv[])
code=atoi(*argv); code=atoi(*argv);
msg = strerror(code); msg = strerror(code);
// On AIX, unknow error return " Error <CODE> occurred."
char unknow_aix[30];
snprintf(unknow_aix, sizeof(unknow_aix), " Error %3d occurred.", code);
/* /*
We don't print the OS error message if it is the same as the We don't print the OS error message if it is the same as the
unknown_error message we retrieved above, or it starts with unknown_error message we retrieved above, or it starts with
...@@ -328,7 +332,8 @@ int main(int argc,char *argv[]) ...@@ -328,7 +332,8 @@ int main(int argc,char *argv[])
if (msg && if (msg &&
my_strnncoll(&my_charset_latin1, (const uchar*) msg, 13, my_strnncoll(&my_charset_latin1, (const uchar*) msg, 13,
(const uchar*) "Unknown Error", 13) && (const uchar*) "Unknown Error", 13) &&
(!unknown_error || strcmp(msg, unknown_error))) (!unknown_error || strcmp(msg, unknown_error)) &&
(!strcmp(msg, unknow_aix)))
{ {
found= 1; found= 1;
if (verbose) if (verbose)
......
...@@ -135,13 +135,6 @@ ...@@ -135,13 +135,6 @@
#endif /* _WIN32*/ #endif /* _WIN32*/
/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
#if defined(_AIX) && defined(_LARGE_FILE_API)
#undef _LARGE_FILE_API
#undef __GNUG__
#endif
/* /*
The macros below are used to allow build of Universal/fat binaries of The macros below are used to allow build of Universal/fat binaries of
MySQL and MySQL applications under darwin. MySQL and MySQL applications under darwin.
...@@ -270,22 +263,6 @@ C_MODE_END ...@@ -270,22 +263,6 @@ C_MODE_END
#endif #endif
#endif /* !defined(__WIN__) */ #endif /* !defined(__WIN__) */
/* Go around some bugs in different OS and compilers */
#ifdef _AIX /* By soren@t.dk */
#define _H_STRINGS
#define _SYS_STREAM_H
/* #define _AIX32_CURSES */ /* XXX: this breaks AIX 4.3.3 (others?). */
#define ulonglong2double(A) my_ulonglong2double(A)
#define my_off_t2double(A) my_ulonglong2double(A)
C_MODE_START
inline double my_ulonglong2double(unsigned long long A) { return (double)A; }
C_MODE_END
#endif /* _AIX */
#ifdef UNDEF_HAVE_INITGROUPS /* For AIX 4.3 */
#undef HAVE_INITGROUPS
#endif
/* gcc/egcs issues */ /* gcc/egcs issues */
#if defined(__GNUC) && defined(__EXCEPTIONS) #if defined(__GNUC) && defined(__EXCEPTIONS)
...@@ -295,16 +272,6 @@ C_MODE_END ...@@ -295,16 +272,6 @@ C_MODE_END
#if defined(_lint) && !defined(lint) #if defined(_lint) && !defined(lint)
#define lint #define lint
#endif #endif
#if SIZEOF_LONG_LONG > 4 && !defined(_LONG_LONG)
#define _LONG_LONG 1 /* For AIX string library */
#endif
/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
#if defined(_AIX) && defined(_LARGE_FILE_API)
#undef _LARGE_FILE_API
#undef __GNUG__
#endif
#ifndef stdin #ifndef stdin
#include <stdio.h> #include <stdio.h>
...@@ -332,13 +299,6 @@ C_MODE_END ...@@ -332,13 +299,6 @@ C_MODE_END
#include <sys/types.h> #include <sys/types.h>
#endif #endif
/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
#if defined(_AIX) && defined(_LARGE_FILE_API)
#undef _LARGE_FILE_API
#undef __GNUG__
#endif
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> #include <fcntl.h>
#endif #endif
...@@ -1197,12 +1157,6 @@ typedef struct { const char *dli_fname, dli_fbase; } Dl_info; ...@@ -1197,12 +1157,6 @@ typedef struct { const char *dli_fname, dli_fbase; } Dl_info;
#define HAVE_EXTERNAL_CLIENT #define HAVE_EXTERNAL_CLIENT
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
/* Workaround for _LARGE_FILES and _LARGE_FILE_API incompatibility on AIX */
#if defined(_AIX) && defined(_LARGE_FILE_API)
#undef _LARGE_FILE_API
#undef __GNUG__
#endif
/* /*
Provide defaults for the CPU cache line size, if it has not been detected by Provide defaults for the CPU cache line size, if it has not been detected by
CMake using getconf CMake using getconf
......
#! .
base64_service
debug_sync_service
encryption_scheme_service
encryption_service
json_service
logger_service
my_crypt_service
my_md5_service
my_print_error_service
my_sha1_service
my_sha2_service
my_snprintf_service
progress_report_service
thd_alloc_service
thd_autoinc_service
thd_error_context_service
thd_kill_statement_service
thd_rnd_service
thd_specifics_service
thd_timezone_service
thd_wait_service
wsrep_service
...@@ -11,7 +11,7 @@ insert t1 values (1); ...@@ -11,7 +11,7 @@ insert t1 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD --system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD
--echo # Some systems fail with errcode 40, or 90 (MIPS) when doing openat, --echo # Some systems fail with errcode 40, or 90 (MIPS) when doing openat,
--echo # while others don't have openat and fail with errcode 20. --echo # while others don't have openat and fail with errcode 20.
--replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /[49]0/20/ /".*"/"<errmsg>"/ --replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /[49]0/20/ /85/20/ /".*"/"<errmsg>"/
repair table t1; repair table t1;
drop table t1; drop table t1;
...@@ -19,7 +19,7 @@ drop table t1; ...@@ -19,7 +19,7 @@ drop table t1;
eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR'; eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR';
insert t2 values (1); insert t2 values (1);
--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD --system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD
--replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /[49]0/20/ /".*"/"<errmsg>"/ --replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /[49]0/20/ /85/20/ /".*"/"<errmsg>"/
repair table t2; repair table t2;
drop table t2; drop table t2;
......
...@@ -25,7 +25,7 @@ exec rm -r $MYSQLTEST_VARDIR/tmp/foo; ...@@ -25,7 +25,7 @@ exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo; exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
set debug_sync='now SIGNAL go'; set debug_sync='now SIGNAL go';
connection default; connection default;
replace_regex / '.*\/tmp\// 'MYSQLTEST_VARDIR\/tmp\// /31/20/ /40/20/ /20.*/20 <errmsg>)/; replace_regex / '.*\/tmp\// 'MYSQLTEST_VARDIR\/tmp\// /31/20/ /40/20/ /85/20/ /20.*/20 <errmsg>)/;
error 29; error 29;
reap; reap;
flush tables; flush tables;
...@@ -49,7 +49,7 @@ exec rm -r $MYSQLTEST_VARDIR/tmp/foo; ...@@ -49,7 +49,7 @@ exec rm -r $MYSQLTEST_VARDIR/tmp/foo;
exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo; exec ln -s $datadir/mysql $MYSQLTEST_VARDIR/tmp/foo;
set debug_sync='now SIGNAL run'; set debug_sync='now SIGNAL run';
connection default; connection default;
replace_regex / '.*\/test\// '.\/test\// /31/20/ /40/20/ /20.*/20 <errmsg>)/; replace_regex / '.*\/test\// '.\/test\// /31/20/ /40/20/ /85/20/ /20.*/20 <errmsg>)/;
error ER_FILE_NOT_FOUND; error ER_FILE_NOT_FOUND;
reap; reap;
flush tables; flush tables;
......
...@@ -215,17 +215,22 @@ ELSE() ...@@ -215,17 +215,22 @@ ELSE()
SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL}) SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL})
ENDIF() ENDIF()
IF(MSVC) IF(MSVC OR CMAKE_SYSTEM_NAME MATCHES AIX)
SET(libs_to_export_symbols sql mysys dbug strings) SET(libs_to_export_symbols sql mysys dbug strings)
# Create shared library of already compiled object # Create shared library of already compiled object
# Export all symbols from selected libraries, to be used # Export all symbols from selected libraries, to be used
# by plugins # by plugins
IF(MSVC)
SET(VERSIONINFO_RC ${PROJECT_BINARY_DIR}/versioninfo_dll.rc)
ELSE()
SET(VERSIONINFO_RC)
ENDIF()
ADD_LIBRARY(server SHARED ADD_LIBRARY(server SHARED
$<TARGET_OBJECTS:sql> $<TARGET_OBJECTS:sql>
$<TARGET_OBJECTS:mysys> $<TARGET_OBJECTS:mysys>
$<TARGET_OBJECTS:dbug> $<TARGET_OBJECTS:dbug>
$<TARGET_OBJECTS:strings> $<TARGET_OBJECTS:strings>
${PROJECT_BINARY_DIR}/versioninfo_dll.rc ${VERSIONINFO_RC}
) )
# We need to add all dependencies of sql/mysys/dbug/strings # We need to add all dependencies of sql/mysys/dbug/strings
...@@ -246,7 +251,11 @@ IF(MSVC) ...@@ -246,7 +251,11 @@ IF(MSVC)
${all_deps} ${all_deps}
sql_builtins sql_builtins
) )
IF(MSVC)
SET_TARGET_PROPERTIES(server PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) SET_TARGET_PROPERTIES(server PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
ELSE()
SET_TARGET_PROPERTIES(server PROPERTIES AIX_EXPORT_ALL_SYMBOLS TRUE)
ENDIF()
MYSQL_INSTALL_TARGETS(server DESTINATION ${INSTALL_BINDIR} COMPONENT Server) MYSQL_INSTALL_TARGETS(server DESTINATION ${INSTALL_BINDIR} COMPONENT Server)
ENDIF() ENDIF()
...@@ -273,7 +282,7 @@ IF(NOT WITHOUT_DYNAMIC_PLUGINS) ...@@ -273,7 +282,7 @@ IF(NOT WITHOUT_DYNAMIC_PLUGINS)
ENDIF() ENDIF()
ENDIF(NOT WITHOUT_DYNAMIC_PLUGINS) ENDIF(NOT WITHOUT_DYNAMIC_PLUGINS)
IF(MSVC) IF(MSVC OR CMAKE_SYSTEM_NAME MATCHES AIX)
TARGET_LINK_LIBRARIES(mariadbd server) TARGET_LINK_LIBRARIES(mariadbd server)
ELSE() ELSE()
TARGET_LINK_LIBRARIES(mariadbd LINK_PRIVATE sql sql_builtins) TARGET_LINK_LIBRARIES(mariadbd LINK_PRIVATE sql sql_builtins)
......
...@@ -2763,7 +2763,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, ...@@ -2763,7 +2763,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
delayed_row *row= 0; delayed_row *row= 0;
Delayed_insert *di=thd->di; Delayed_insert *di=thd->di;
const Discrete_interval *forced_auto_inc; const Discrete_interval *forced_auto_inc;
size_t user_len, host_len, ip_len; size_t user_len, host_len, ip_length;
DBUG_ENTER("write_delayed"); DBUG_ENTER("write_delayed");
DBUG_PRINT("enter", ("query = '%s' length %lu", query.str, DBUG_PRINT("enter", ("query = '%s' length %lu", query.str,
(ulong) query.length)); (ulong) query.length));
...@@ -2798,7 +2798,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, ...@@ -2798,7 +2798,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
goto err; goto err;
} }
user_len= host_len= ip_len= 0; user_len= host_len= ip_length= 0;
row->user= row->host= row->ip= NULL; row->user= row->host= row->ip= NULL;
if (thd->security_ctx) if (thd->security_ctx)
{ {
...@@ -2807,12 +2807,12 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, ...@@ -2807,12 +2807,12 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
if (thd->security_ctx->host) if (thd->security_ctx->host)
host_len= strlen(thd->security_ctx->host) + 1; host_len= strlen(thd->security_ctx->host) + 1;
if (thd->security_ctx->ip) if (thd->security_ctx->ip)
ip_len= strlen(thd->security_ctx->ip) + 1; ip_length= strlen(thd->security_ctx->ip) + 1;
} }
/* This can't be THREAD_SPECIFIC as it's freed in delayed thread */ /* This can't be THREAD_SPECIFIC as it's freed in delayed thread */
if (!(row->record= (char*) my_malloc(PSI_INSTRUMENT_ME, if (!(row->record= (char*) my_malloc(PSI_INSTRUMENT_ME,
table->s->reclength + table->s->reclength +
user_len + host_len + ip_len, user_len + host_len + ip_length,
MYF(MY_WME)))) MYF(MY_WME))))
goto err; goto err;
memcpy(row->record, table->record[0], table->s->reclength); memcpy(row->record, table->record[0], table->s->reclength);
...@@ -2832,7 +2832,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, ...@@ -2832,7 +2832,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
if (thd->security_ctx->ip) if (thd->security_ctx->ip)
{ {
row->ip= row->record + table->s->reclength + user_len + host_len; row->ip= row->record + table->s->reclength + user_len + host_len;
memcpy(row->ip, thd->security_ctx->ip, ip_len); memcpy(row->ip, thd->security_ctx->ip, ip_length);
} }
} }
row->query_id= thd->query_id; row->query_id= thd->query_id;
......
...@@ -178,7 +178,11 @@ void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)() ...@@ -178,7 +178,11 @@ void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)()
The result will be in the process stderr (var/log/master.err) The result will be in the process stderr (var/log/master.err)
*/ */
#ifndef _AIX
extern int yydebug; extern int yydebug;
#else
static int yydebug;
#endif
yydebug= 1; yydebug= 1;
} }
#endif #endif
......
...@@ -52,6 +52,11 @@ IF(APPLE) ...@@ -52,6 +52,11 @@ IF(APPLE)
ADD_DEFINITIONS(-fno-common) ADD_DEFINITIONS(-fno-common)
ENDIF() ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
# Workaround linker bug on AIX
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-berok")
ENDIF()
MYSQL_ADD_PLUGIN(aria ${ARIA_SOURCES} STORAGE_ENGINE MANDATORY MYSQL_ADD_PLUGIN(aria ${ARIA_SOURCES} STORAGE_ENGINE MANDATORY
LINK_LIBRARIES myisam mysys mysys_ssl LINK_LIBRARIES myisam mysys mysys_ssl
RECOMPILE_FOR_EMBEDDED) RECOMPILE_FOR_EMBEDDED)
......
...@@ -27,6 +27,11 @@ SET(MYISAM_SOURCES ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c ...@@ -27,6 +27,11 @@ SET(MYISAM_SOURCES ft_boolean_search.c ft_nlq_search.c ft_parser.c ft_static.c
rt_split.c sort.c sp_key.c mi_extrafunc.h myisamdef.h rt_split.c sort.c sp_key.c mi_extrafunc.h myisamdef.h
rt_index.h mi_rkey.c) rt_index.h mi_rkey.c)
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
# Workaround linker bug on AIX
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-berok")
ENDIF()
MYSQL_ADD_PLUGIN(myisam ${MYISAM_SOURCES} MYSQL_ADD_PLUGIN(myisam ${MYISAM_SOURCES}
STORAGE_ENGINE STORAGE_ENGINE
MANDATORY MANDATORY
......
...@@ -33,6 +33,11 @@ IF (SSL_DEFINES) ...@@ -33,6 +33,11 @@ IF (SSL_DEFINES)
ADD_DEFINITIONS(${SSL_DEFINES}) ADD_DEFINITIONS(${SSL_DEFINES})
ENDIF() ENDIF()
IF(CMAKE_SYSTEM_NAME MATCHES AIX)
# Workaround linker bug on AIX
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-berok")
ENDIF()
# #
# Maintainer: keep this list sorted, to avoid merge collisions. # Maintainer: keep this list sorted, to avoid merge collisions.
# Tip: ls -1 *.h, ls -1 *.cc # Tip: ls -1 *.h, ls -1 *.cc
......
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