您的位置:首页 > 数据库 > MariaDB

在windows编译MariaDB

2016-05-18 16:57 501 查看
OS: Windows XP sp3

IDE: VS2010(including the (free) express editions)

MariaDB: V5.5

(清华大学 TUNA 镜像源可用)

(.tar.gz为源码;.zip为执行程序)

Source: https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-5.5.55/source/mariadb-5.5.55.tar.gz
Zip: https://mirrors.tuna.tsinghua.edu.cn/mariadb//mariadb-5.5.55/win32-packages/mariadb-5.5.55-win32.zip
首先安装如下工具和Boost库:

(1) Bazzar
https://launchpad.net/bzr/2.5/2.5.1/+download/bzr-2.5.1-1-setup.exe
(2) Bison from GnuWin32
http://jaist.dl.sourceforge.net/project/gnuwin32/bison/2.4.1/bison-2.4.1-setup.exe
(3) Cmake
https://cmake.org/files/v3.4/cmake-3.4.3-win32-x86.exe
V3.4.3是可以在XP中运行的。

Boost库:

(1) 下载
http://www.boost.org/users/download/
当前最新版本为V1.63.0

(2) 设置系统变量

a. BOOST_HOME

C:\boost_1_63_0

b. 增加变量到path

然后执行编译:

检查系统变量path,以保证包含如下设置:

C:\Program Files\Bazaar;C:\GnuWin32\bin;C:\boost_1_63_0;C:\Program Files\CMake\bin


(1)cmake ..

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\zc01>d:

D:\>cd mariadb-5.5.55

D:\mariadb-5.5.55>mkdir bld

D:\mariadb-5.5.55>cd bld

D:\mariadb-5.5.55\bld>cmake ..
-- Building for: Visual Studio 10 2010
-- Running cmake version 3.4.3
-- The C compiler identification is MSVC 16.0.30319.1
-- The CXX compiler identification is MSVC 16.0.30319.1
-- Check for working C compiler using: Visual Studio 10 2010
-- Check for working C compiler using: Visual Studio 10 2010 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10 2010
-- Check for working CXX compiler using: Visual Studio 10 2010 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for isnan
-- Looking for isnan - not found
-- Looking for snprintf
-- Looking for snprintf - not found
-- Looking for _snprintf
-- Looking for _snprintf - found
-- MariaDB 5.5.55
-- Check size of void *
-- Check size of void * - done
-- Packaging as: mariadb-5.5.55-win32
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Looking for isnan
-- Looking for isnan - not found
-- Check size of time_t
-- Check size of time_t - done
-- Performing Test STRUCT_TIMESPEC_HAS_TV_SEC
-- Performing Test STRUCT_TIMESPEC_HAS_TV_SEC - Failed
-- Performing Test STRUCT_TIMESPEC_HAS_TV_NSEC
-- Performing Test STRUCT_TIMESPEC_HAS_TV_NSEC - Failed
-- Looking for malloc_stats_print in jemalloc
-- Looking for malloc_stats_print in jemalloc - not found
-- Performing Test HAVE_WVLA
-- Performing Test HAVE_WVLA - Failed
-- Performing Test HAVE_WERROR
-- Performing Test HAVE_WERROR - Failed
-- Boost version: 1.63.0
-- Performing Test HAVE_XUCRED
-- Performing Test HAVE_XUCRED - Failed
Warning: Bison executable not found in PATH
-- Looking for MFC
-- Looking for MFC - not found
-- Cannot find wix 3, installer project will not be generated
-- Configuring done
-- Generating done
-- Build files have been written to: D:/mariadb-5.5.55/bld

D:\mariadb-5.5.55\bld>


  

(2) sql/sql_locale.cc

使用Notepad++打开此文件并另存为同名。“以 UTF-8 无 BOM 格式编码” -> “以 UTF-8 格式编码”!



(3) 生成

cmake --build . --config Relwithdebinfo


最后,拷贝文件。

拷贝以下两个文件覆盖到D:\progFiles\MariaDB55\bin,以替换不能在XP运行的程序。

bld\sql\RelWithDebInfo\mysqld.exe

bld\sql\RelWithDebInfo\mysqld.pdb

FAQ:

1. error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE'

在进行storage\oqgraph目录编译时发生错误。

"D:\mariadb-5.5.55\bld\ALL_BUILD.vcxproj" (default target) (1) ->
"D:\mariadb-5.5.55\bld\storage\oqgraph\oqgraph.vcxproj" (default target) (131)
->
(ClCompile target) ->
D:\boost_1_63_0\boost/graph/named_graph.hpp(314): error C2338: Named graphs c
annot use vecS as vertex container and remove vertices; the lack of vertex desc
riptor stability (which iterator stability is a proxy for) means that the name
-> vertex mapping would need to be completely rebuilt after each deletion.  See https://svn.boost.org/trac/boost/ticket/7863 for more information and a test c
ase. [D:\mariadb-5.5.55\bld\storage\oqgraph\oqgraph.vcxproj]

3055 Warning(s)
1 Error(s)

Time Elapsed 00:03:41.48

D:\mariadb-5.5.55\bld>


  

解决办法:

注释掉named_graph.hpp(C:\boost_1_63_0\boost\graph)的314行代码。

参考文档:

1. Building MariaDB on Windows
https://mariadb.com/kb/en/mariadb/Building_MariaDB_on_Windows/
2. 关于mysqld不是有效的win32程序
http://www.cnblogs.com/xiaobin-hlj80/p/5500152.html
3. 安装boost库(Windows)
http://www.cnblogs.com/xiaobin-hlj80/p/5503842.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: