Win7+vs2010:mysql source code compilation and debugging

Source: Internet
Author: User

win7+vs2010 Source code compilation mysql

recently, because in the internship, the focus is on some database development, in order to better understand the implementation mechanism of the database. Now it's the idea to study the source code of MySQL database. Well, then, just do it. First we need to implement the compilation of the source code. Here we choose win7+vs2010 to achieve, but tried very many times have failed. This is the problem I encountered many times when configuring the environment, various blog posts are always not very complete, or do not explain some of the problems encountered in the solution, which may be related to the detailed operating system and environment. This article is about the situation I installed.


1. Preparatory work

(1) os:win7 flagship 64-bit + VS2010 (2013 also tried)

(2) MySQL source code (Windows Edition):mysql-5.6.19.zip (down box select source codes)

(3) Perl Tool:activeperl-5.16.3.1604-mswin32-x64-298023.msi

(4) cmake:cmake-3.0.0-win32-x86. exe

(5) Bison:bison-2.4.1-setup.exe

Installation needs to be noted. Typically installed under the root folder. such as C:\Cmake C:\GnuWin32 C:\Perl64, of course, can also be other folders, the general path do not appear in Chinese characters, spaces and special characters (this seems very important).

Detailed installation See the following blog: windows+vs2012 environment compiled debugging MySQL source code

In addition to bison installation need to pay attention to accidents. Others are almost always installed by default, and these details are best followed. So as not to be wrong. Perl, Cmake, Bison after the installation is finished , Add the path of the bin under their installation folder to the environment variable ( Windows environment variable join ). such as C:\Cmake\bin. Okay, so here's the basics OK. to be on the safe side we need to verify that the installation is successful:



2. Start the installation

Create a folder for installation in any of the disks you like: Create MySQL on the D drive and unzip the mysql-5.6.19.zip into the folder. Then switch to the installation folder in CMD, which is D:\mysql\mysql-5.6.19. ({install}=D:\mysql\mysql-5.6.19), which includes for example the following file folders:


Then run the following command under {install}:

>mkdir BLD

>CD BLD

>cmake.

This allows you to see output similar to the following, for example:


There are some errors. There is no solution at this moment, but in fact this does not affect our build vs MySQL.sln project file.

In fact, only to see the following this can be, a variety of not found also does not matter.

assuming the use of Cmake The graphical interface, in fact, is almost the same. Don't repeat it here.

Next we will be able to build solution in VS2010 (the corresponding build solution), but in order to reduce the warning or error as much as possible. We first need to make changes to the following documents:


The method of change is very easy. is to save these files in UTF-8 (with the BOM header) format.

General use of nodepad++ tools and so on.

The final step is to find the TEST_LC_TIME_SZ () function in {install}\mysql-5.6.19\sql\mysqld.cc, and change the Dbug_assert (0) to Dbug_assert (1).

Here we are. The purpose of converting the source code to vs in the project file. Then we'll be able to build solution. Assuming there is no error stating that there is no problem, some small warnings may be due to the C + + compiler being stricter than the compiler. Next we start debugging.


3. Commissioning

Then, debug the Mysqldproject: Properties, debugging, and command parameters. Set to --console, for example the following:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbglhb3lvdwppbmi=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">

Then launch the instance,

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbglhb3lvdwppbmi=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">

This allows you to see the following command-line interface:

CMD under Go to folder {install}\client. Then run the following command, for example. will be able to start connecting to the MySQL service that was just turned on. This indicates that the MySQL service has been started. The next step is to start the MySQL customer service, and here I am using the command line startup mode.

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbglhb3lvdwppbmi=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">
Okay, so here we are basically finished with the purpose of compiling and debugging MySQL database under Win7 vs now. You can start studying the source code below.

4. New Issues

(1) VS2010:

Link:fatal Error LNK1123: Failed during transition to COFF: invalid or corrupt file [F:\mysql\bld\CMakeFiles\CMakeTmp\cmTryCompileExec2556624813.vcxproj ] Workaround: This is because. The Cvtres.exe in net is in conflict with VS2010. Delete the Cvtres.exe in VS2010 to be able (folder F:\Install\VS2010\VC\bin). Note Install is the folder in which you installed VS2010.


In order to better indicate the direction for the later, but also for the future to facilitate their own inquiries, so did this simple guide. Also hope that the friends installed in accordance with this document encounter any problem can be discussed together, and then constantly intact the document. So that later people can be useful, at the same time to create a responsible writing atmosphere.


Win7+vs2010:mysql source code compilation and debugging

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.