/ 中存储网

Windows下编译MySQL5.6.7和MariaDB5.5.27

2014-07-13 16:25:10 来源:中存储网
听说mysql5.6.7的优化器改了不少,想陆续学习一下。为了能用vc跟踪,就在winodws下用vc来编译了。
(注意,mariadb5.5.27也用同样方法编译通过,可以学习牛人在server端的大量改进了!)
用Visual C++ 2008 express版本,编译。免费的,而且正版,多棒。
进入Visual Studio 2008命令提示(不是直接运行cmd)
D:mysql-5.6.7-rc>cmake . -G “Visual Studio 9 2008″
– Check for working C compiler using: Visual Studio 9 2008
– Check for working C compiler using: Visual Studio 9 2008 — works
– Detecting C compiler ABI info
– Detecting C compiler ABI info – done
– Check for working CXX compiler using: Visual Studio 9 2008
– Check for working CXX compiler using: Visual Studio 9 2008 — works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info – done
– Check size of void *
– Check size of void * – done
– MySQL 5.6.7-rc
– Packaging as: mysql-5.6.7-rc-win32
– Looking for include files HAVE_SASL_SASL_H
– Looking for include files HAVE_SASL_SASL_H – not found.
– Looking for include files HAVE_DEVPOLL
– Looking for include files HAVE_DEVPOLL – not found.
– Looking for include files HAVE_SIGNAL_H
– Looking for include files HAVE_SIGNAL_H – found
– Looking for include files HAVE_SYS_DEVPOLL_H
– Looking for include files HAVE_SYS_DEVPOLL_H – not found.
– Looking for include files HAVE_SYS_EPOLL_H
– Looking for include files HAVE_SYS_EPOLL_H – not found.
– Looking for include files HAVE_SYS_EVENT_H
– Looking for include files HAVE_SYS_EVENT_H – not found.
– Looking for include files HAVE_SYS_QUEUE_H
– Looking for include files HAVE_SYS_QUEUE_H – not found.
– Looking for TAILQ_FOREACH
– Looking for TAILQ_FOREACH – not found.
– Looking for include files CMAKE_HAVE_PTHREAD_H
– Looking for include files CMAKE_HAVE_PTHREAD_H – not found.
– Found Threads: TRUE
– Looking for _aligned_malloc
– Looking for _aligned_malloc – found
– Looking for _aligned_free
– Looking for _aligned_free – found
– Looking for fedisableexcept
– Looking for fedisableexcept – not found
– Looking for posix_memalign
– Looking for posix_memalign – not found
– Looking for ntohll
– Looking for ntohll – not found
– Looking for clock_gettime
– Looking for clock_gettime – not found
– Looking for epoll_create
– Looking for epoll_create – not found
– Looking for epoll_ctl
– Looking for epoll_ctl – not found
– Looking for inet_ntop
– Looking for inet_ntop – not found
– Looking for kqueue
– Looking for kqueue – not found
– Looking for kqueue
– Looking for kqueue – not found
– Looking for signal
– Looking for signal – found
– Looking for timeradd
– Looking for timeradd – not found.
– Looking for timerclear
– Looking for timerclear – not found.
– Looking for timercmp
– Looking for timercmp – not found.
– Looking for timerisset
– Looking for timerisset – not found.
– Check size of time_t
– Check size of time_t – done
– Performing Test TIME_T_UNSIGNED
– Performing Test TIME_T_UNSIGNED – Failed
– Looking for sched_getcpu
– Looking for sched_getcpu – not found
– Looking for asprintf
– Looking for asprintf – not found
– Using cmake version 2.8.2
– Not building NDB

Googletest was not found. gtest-based unit tests will be disabled. You
can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build
req
uired components from source.
– If you are inside a firewall, you may need to use an http proxy: export http_proxy=http://foo.bar.com:80
Warning: Bison executable not found in PATH
– Cannot find wix 3, installer project will not be generated
– Configuring done
– Generating done
– Build files have been written to: D:/mysql-5.6.7-rc
D:mysql-5.6.7-rc>cmake . -L
– MySQL 5.6.7-rc
– Packaging as: mysql-5.6.7-rc-win32
– Using cmake version 2.8.2
– Not building NDB
Warning: Bison executable not found in PATH
– Configuring done
– Generating done
– Build files have been written to: D:/mysql-5.6.7-rc
– Cache values
CMAKE_BUILD_TYPE:STRING=RelWithDebInfo
CMAKE_INSTALL_PREFIX:PATH=C:/Program Files/MySQL
COMMUNITY_BUILD:BOOL=ON
ENABLED_PROFILING:BOOL=ON
ENABLE_DEBUG_SYNC:BOOL=ON
ENABLE_DOWNLOADS:BOOL=OFF
ENABLE_GCOV:BOOL=OFF
ENABLE_GPROF:BOOL=OFF
FEATURE_SET:STRING=community
INSTALL_LAYOUT:STRING=STANDALONE
MYSQL_DATADIR:PATH=C:/Program Files/MySQL/MySQL Server 5.6/data
MYSQL_MAINTAINER_MODE:BOOL=OFF
OPTIMIZER_TRACE:BOOL=ON
WITH_ARCHIVE_STORAGE_ENGINE:BOOL=ON
WITH_BLACKHOLE_STORAGE_ENGINE:BOOL=ON
WITH_DEBUG:BOOL=OFF
WITH_DEFAULT_COMPILER_OPTIONS:BOOL=ON
WITH_DEFAULT_FEATURE_SET:BOOL=ON
WITH_EMBEDDED_SERVER:BOOL=ON
WITH_EXAMPLE_STORAGE_ENGINE:BOOL=OFF
WITH_EXTRA_CHARSETS:STRING=all
WITH_FEDERATED_STORAGE_ENGINE:BOOL=ON
WITH_INNOBASE_STORAGE_ENGINE:BOOL=ON
WITH_INNODB_MEMCACHED:BOOL=OFF
WITH_LIBEVENT:STRING=bundled
WITH_PARTITION_STORAGE_ENGINE:BOOL=ON
WITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON
WITH_SSL:STRING=bundled
WITH_UNIT_TESTS:BOOL=ON
WITH_ZLIB:STRING=bundled
WIX_DIR:PATH=WIX_DIR-NOTFOUND
Visual C++ 2008用F7编译
3>—— 已启动生成: 项目: sql_embedded, 配置: Debug Win32 ——
2>正在编译…
3>正在编译…
2>sql_locale.cc
3>sql_locale.cc
2>.sql_locale.cc(621) : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
3>..sqlsql_locale.cc(621) : warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
2>.sql_locale.cc(789) : error C2146: 语法错误 : 缺少“}”(在标识符“嗒忇喃嵿嗒苦”的前面)
3>..sqlsql_locale.cc(789) : error C2146: 语法错误 : 缺少“}”(在标识符“嗒忇喃嵿嗒苦”的前面)
2>.sql_locale.cc(789) : error C2146: 语法错误 : 缺少“;”(在标识符“嗒忇喃嵿嗒苦”的前面)
2>.sql_locale.cc(789) : error C2143: 语法错误 : 缺少“;”(在“字符串”的前面)
3>..sqlsql_locale.cc(789) : error C2146: 语法错误 : 缺少“;”(在标识符“嗒忇喃嵿嗒苦”的前面)
2>.sql_locale.cc(789) : error C4430: 缺少类型说明符 – 假定为 int。注意: C++ 不支持默认 int
3>..sqlsql_locale.cc(789) : error C2143: 语法错误 : 缺少“;”(在“字符串”的前面)
2>.sql_locale.cc(789) : error C2143: 语法错误 : 缺少“;”(在“}”的前面)
3>..sqlsql_locale.cc(789) : error C4430: 缺少类型说明符 – 假定为 int。注意: C++ 不支持默认 int
2>.sql_locale.cc(789) : error C2059: 语法错误 : “}”
3>..sqlsql_locale.cc(789) : error C2143: 语法错误 : 缺少“;”(在“}”的前面)
2>.sql_locale.cc(791) : error C2146: 语法错误 : 缺少“}”(在标识符“嗒珖嗒”的前面)
3>..sqlsql_locale.cc(789) : error C2059: 语法错误 : “}”
2>.sql_locale.cc(791) : error C2146: 语法错误 : 缺少“;”(在标识符“嗒珖嗒”的前面)
3>..sqlsql_locale.cc(791) : error C2146: 语法错误 : 缺少“}”(在标识符“嗒珖嗒”的前面)
2>.sql_locale.cc(791) : error C4430: 缺少类型说明符 – 假定为 int。注意: C++ 不支持默认 int
3>..sqlsql_locale.cc(791) : error C2146: 语法错误 : 缺少“;”(在标识符“嗒珖嗒”的前面)
2>.sql_locale.cc(791) : error C2059: 语法错误 : “字符串”
3>..sqlsql_locale.cc(791) : error C4430: 缺少类型说明符 – 假定为 int。注意: C++ 不支持默认 int
2>.sql_locale.cc(791) : error C2143: 语法错误 : 缺少“;”(在“}”的前面)
3>..sqlsql_locale.cc(791) : error C2059: 语法错误 : “字符串”
2>.sql_locale.cc(791) : error C2059: 语法错误 : “}”
3>..sqlsql_locale.cc(791) : error C2143: 语法错误 : 缺少“;”(在“}”的前面)
2>.sql_locale.cc(793) : error C2146: 语法错误 : 缺少“}”(在标识符“嗒多珌嗒曕珝嗒班嗒距”的前面)
3>..sqlsql_locale.cc(791) : error C2059: 语法错误 : “}”
2>.sql_locale.cc(793) : error C2146: 语法错误 : 缺少“;”(在标识符“嗒多珌嗒曕珝嗒班嗒距”的前面)
3>..sqlsql_locale.cc(793) : error C2146: 语法错误 : 缺少“}”(在标识符“嗒多珌嗒曕珝嗒班嗒距”的前面)
2>.sql_locale.cc(793) : error C2143: 语法错误 : 缺少“;”(在“字符串”的前面)
3>..sqlsql_locale.cc(793) : error C2146: 语法错误 : 缺少“;”(在标识符“嗒多珌嗒曕珝嗒班嗒距”的前面)
字符集问题
用notepad++打开sql_locale.cc
在菜单“格式”中选择“以UTF-8格式编码”,保存
VC用F7编译
21>CMake Error at D:/mysql-5.6.7-rc/sql/create_initial_db.cmake:100 (MESSAGE):
21>  Could not create initial database
21>   
21>  
121008 11:56:14 [Warning] TIMESTAMP with implicit DEFAULT value is
deprecated. Please use –explicit_defaults_for_timestamp server option
(see documentation for more details).
21>  Assertion failed: 0, file .mysqld.cc, line 5011
21> 
21>  This application has requested the Runtime to terminate it in an unusual
21>  way.
21>  Please contact the application’s support team for more information.
21> 
21>  This application has requested the Runtime to terminate it in an unusual
21>  way.
21>  Please contact the application’s support team for more information.
21>  03:56:14 UTC – mysqld got exception 0×80000003 ;
21>  This could be because you hit a bug.  It is also possible that this binary
21>  or one of the libraries it was linked against is corrupt, improperly built,
21>  or misconfigured.  This error can also be caused by malfunctioning
21>  hardware.
21>  We will try our best to scrape up some info that will hopefully help
21>  diagnose the problem, but since we have already crashed,
21>  something is definitely wrong and this may fail.
21> 
21>  key_buffer_size=0
21>  read_buffer_size=131072
21>  max_used_connections=0
21>  max_threads=151
21>  thread_count=0
21>  connection_count=0
21>  It is possible that mysqld could use up to
21>  key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 59364
21>  K bytes of memory
21>  Hope that’s ok; if not, decrease some variables in the equation.
21> 
21>  Thread pointer: 0×0
21>  Attempting backtrace.  You can use the following information to find out
21>  where mysqld died.  If you see no messages after this, something went
21>  terribly wrong…
21>  ec90b3 mysqld.exe!my_sigabrt_handler()[my_thr_init.c:499]
21>  1386aab mysqld.exe!raise()[winsig.c:590]
21>  1391485 mysqld.exe!abort()[abort.c:71]
21>  1385bf7 mysqld.exe!_wassert()[assert.c:346]
21>  a9a9f5 mysqld.exe!test_lc_time_sz()[mysqld.cc:5011]
21>  a96f94 mysqld.exe!win_main()[mysqld.cc:5227]
21>  a9aaab mysqld.exe!mysql_service()[mysqld.cc:5554]
21>  a9ae46 mysqld.exe!mysqld_main()[mysqld.cc:5748]
21>  a91010 mysqld.exe!main()[main.cc:25]
21>  1384f57 mysqld.exe!__tmainCRTStartup()[crt0.c:266]
21>  1384e2f mysqld.exe!mainCRTStartup()[crt0.c:182]
21>  7618ed6c kernel32.dll!BaseThreadInitThunk()
21>  77d5377b ntdll.dll!RtlInitializeExceptionChain()
21>  77d5374e ntdll.dll!RtlInitializeExceptionChain()
21>  The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
21>  information that should help you find out what is causing the crash.
21>Project : error PRJ0019: 某个工具从以下位置返回了错误 “Generating initdb.dep”
21>生成日志保存在“file://d:mysql-5.6.7-rcsqlinitial_database.dirDebugBuildLog.htm”
21>initial_database – 1 个错误,0 个警告
19>生成日志保存在“file://d:mysql-5.6.7-rcpluginauthqa_auth_interface.dirDebugBuildLog.htm”
19>qa_auth_interface – 0 个错误,0 个警告
20>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
20>Copyright (C) Microsoft Corporation.  All rights reserved.
20>生成日志保存在“file://d:mysql-5.6.7-rcpluginauthqa_auth_server.dirDebugBuildLog.htm”
20>qa_auth_server – 0 个错误,0 个警告
30>—— 已跳过生成: 项目: PACKAGE, 配置: Debug Win32 ——
30>没有为此解决方案配置选中要生成的项目
31>—— 已跳过生成: 项目: INSTALL, 配置: Debug Win32 ——
31>没有为此解决方案配置选中要生成的项目
========== 生成: 成功 22 个,失败 1 个,最新 98 个,跳过 8 个 ==========
这个错误在编译以前的版本时也遇到了,猜测test_lc_time_sz不是个很重要的步骤,就改成直接返回了。修改mysqld.cc,我增加了两行
#ifndef EMBEDDED_LIBRARY
#ifndef DBUG_OFF
/*
  Debugging helper function to keep the locale database
  (see sql_locale.cc) and max_month_name_length and
  max_day_name_length variable values in consistent state.
*/
static void test_lc_time_sz()
{
  DBUG_ENTER(“test_lc_time_sz”);
  /*gulei added*/
  DBUG_VOID_RETURN;
  for (MY_LOCALE **loc= my_locales; *loc; loc++)
  {
    uint max_month_len= 0;
    uint max_day_len = 0;
再编译就过了
用vc跟踪代码还是很直观的,大家可以试试。