Not counting obtaining the source code, and once you have the prerequisites satisfied, [Windows] users can build from source code in 5 easy steps.
Prerequisites – Install & ensure they are in the $PATH:
- CMake <-- Download
- Make <-- 3.75 or newer
- C++ compiler <-- Visual Studio 2008 Express - Free Download
- Bison <-- Download (ensure m4.exe is also included, which it should be)
Optional (but most likely you’ll want):
- Perl <-- For Test Suite/Scripts. Strawberry Perl is a great option.
- Bazaar <-- If want latest source tree
Tip: Install these in locations where spaces are not in the path. Specifically, watch for the Bison/m4 as there is a known bug with regards to that.
..
Now that that’s out of the way, we can begin. You just need to decide if you want to build from source code you download or from the latest development tree.
This will walk through building from the latest development tree (since the downloaded version requires no extra steps – just grab it from any mirror).
Also, this post assumes you can connect to the Launchpad repository via Bazaar and download the source (i.e., you’ll have to create SSH keys to connect to Launchpad – see this write-up for more details. You might also need Pageant too, if you don’t already have it.)
I. Prerequisite Checks:
C:\>cmake --version cmake version 2.6-patch 4 C:\>make --version GNU Make 3.81 C:\>c++ --version c++ (GCC) 4.4.3 C:\>bison --version bison (GNU Bison) 2.4.1 C:\>m4 --version m4 (GNU M4) 1.4.13 C:\>perl --version This is perl 5, version 12, subversion 3 C:\>bzr --version Bazaar (bzr) 2.4.1
..
II. Obtain Source Code (skip this if you download the source directly from a mirror):
- Open Pageant -> Add Key -> Select your SSH Key (for Launchpad)
- cd C:\
- bzr init-repo –trees mysql-5.5
- cd mysql-5.5
- bzr branch lp:mysql-server/5.5 mysql-5.5
..
III. Build/Compile Source Code:
- cd mysql-5.5
- cmake . -DBUILD_CONFIG=mysql_release -G “Visual Studio 9 2008″
- Copy m4.exe to $basedir/sql <-- this avoids any m4.exe errors
- Open Solution in VS: File -> Open -> Project/Solution -> C:\mysql-5.5\mysql-5.5\MySQL.sln
- Now build in VS: Build -> Build Solution (or F7)
========== Build: 93 succeeded, 0 failed, 5 up-to-date, 10 skipped ==========
There you have it! (Assuming you have “0 failed”, otherwise, you’ve got some debugging to do.)
Build Notes (step #2 above):
The -DBUILD_CONFIG=mysql_release flag uses the same build options used for official releases, which are stored in cmake/build_configurations/mysql_release.cmake.
The simplest you could use is: cmake . -G “Visual Studio 9 2008″
Or you could specify a number of options: cmake . -DMYSQL_SERVER_SUFFIX=-chris -DWITHOUT_FEDERATED_STORAGE_ENGINE=1 -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 -G “Visual Studio 9 2008″
The -G lets know which compiler will be used. In this case, I’m using VS 2008 Express. If you were using VS 2005, it’d be “Visual Studio 8 2005″, but I’m not sure if VS 2005 will even work.
This command should end with something like “– Build files have been written to: C:/…” or you’ll need to debug.
Lastly, the cmake command creates the MySQL.sln file and all .vcproj files.
..
IV. Kicking the tires …
I believe since I’m using the Express edition, I cannot create a nice package for Windows (perhaps I’m wrong about this).
But any way, I can piece it together easily enough:
- Make main dir mysql-5.5.xx
- Make subdir bin/ - copy in all .exe files (from client/debug, sql/debug, */debug, etc.)*
- Make subdir data/ - copy from sql/data/
- Make subdir scripts/ – copy from scripts/ (at least all perl, sql, and sh scripts)
- Make subdir share/ - copy from sql/share/
- Create my.ini
* Notes re: .exe files: mysqld.exe is located in /sql/debug/ and mysql.exe is located in /client/debug/. The remaining .exe files are located in /client/debug/, /sql/debug/, /extra/debug/, /libmysql/debug/, /mysys/debug/, /scripts/debug/, /storage/myisam/debug/, /storage/heap/debug/, and /tests/debug/.
Now start mysqld:
mysql> select version(); +------------------+ | version() | +------------------+ | 5.5.21-debug-log | +------------------+
Of course you should test it a bit more than that, but I’ll leave that to you.
PlanetMySQL Voting: Vote UP / Vote DOWN
