windonws7下vs2010编译Mysql 5.6

How to Build MySQL 5.6 on Windows from Source Code

I just set up a new Windows 7 machine, and built MySQL 5.6 for the first time, so I wanted to share my steps for anyone interested.

** Prerequisites **
1. Install Microsoft Visual Studio (I installed VS 2010 Express – free)
2. Install cmake
3. Install bison (make sure no spaces in path)

** Build Instructions **

cd c:\mysql\mysql-5.6.10
mkdir bld
cd bld
cmake ..
cmake --build . --config relwithdebinfo --target package

(You don’t technically need the ‘bld’ dir, but I prefer it to keep the main dir ‘clean’. Then if you need to re-build, you can quickly just delete the whole ‘bld’ directory, and start fresh.)

Here is my actual output for those interested:

c:\>cd c:\mysql\mysql-5.6.10
c:\mysql\mysql-5.6.10>mkdir bld
c:\mysql\mysql-5.6.10>cd bld
c:\mysql\mysql-5.6.10\bld>cmake ..
-- Building for: Visual Studio 10
-- Running cmake version 2.8.10.2
-- 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
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10
-- Check for working CXX compiler using: Visual Studio 10 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check size of void *
-- Check size of void * - done
-- MySQL 5.6.10
-- Packaging as: mysql-5.6.10-win32
-- Looking for include file sasl/sasl.h
-- Looking for include file sasl/sasl.h - not found
-- Looking for include file sys/devpoll.h
-- Looking for include file sys/devpoll.h - not found
-- Looking for include file signal.h
-- Looking for include file signal.h - found
-- Looking for include file sys/devpoll.h
-- Looking for include file sys/devpoll.h - not found
-- Looking for include file sys/epoll.h
-- Looking for include file sys/epoll.h - not found
-- Looking for include file sys/event.h
-- Looking for include file sys/event.h - not found
-- Looking for include file sys/queue.h
-- Looking for include file sys/queue.h - not found
-- Looking for TAILQ_FOREACH
-- Looking for TAILQ_FOREACH - not found
-- Looking for include file pthread.h
-- Looking for include file 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.10.2
-- Not building NDB
-- Googlemock was not found. gtest-based unit tests will be disabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automatically download and build required 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
-- Cannot find wix 3, installer project will not be generated
-- Configuring done
-- Generating done
-- Build files have been written to: C:/mysql/mysql-5.6.10

c:\mysql\mysql-5.6.10\bld>cmake --build . --config relwithdebinfo --target package
...
... tons of build/compilation output ...
...
    406 Warning(s)
    0 Error(s)

Time Elapsed 00:16:46.65

There you go!

The zip package (mysql-5.6.10-win32.zip in this case) will be located in bld/.

I will say that is a lot of warnings, though I’m fairly used to them on Windows. However, I plan to try VS 2012 Express to see if that makes any difference.

Hope this helps. :)

Related Build Links:

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值