Archive for the ‘cmake’ Category

MySQL 5.5 Windows Build Appendix : Full Outputs and Common Errors from Building MySQL 5.5 on Windows

Январь 20th, 2012

The other day, I posted a “how-to” article for building MySQL 5.5 on Windows from the source code tree.

In an attempt to keep the post as brief as possible, I omitted many outputs, as well as a number of common bugs/problems one could encounter, and so I just wanted to follow-up with some of that in this “appendix” of sorts.

This way, folks who run into any issues might find solutions to those problems here.

I’ll start with the outputs first, followed by the common problems.

Outputs (When works as expected):

..

Output from Obtaining Source Code:

C:\Users\Chris>cd C:\

C:\>bzr init-repo --trees mysql-5.5
Shared repository with trees (format: 2a)
Location:
  shared repository: mysql-5.5

C:\>cd mysql-5.5

C:\mysql-5.5>bzr branch lp:mysql-server/5.5 mysql-5.5
Connected (version 2.0, client Twisted)
Authentication (publickey) successful!
Secsh channel 1 opened.
Branched 3674 revision(s).

..

Output from Building/Compiling Source Code:

C:\mysql-5.5>cd mysql-5.5

C:\mysql-5.5\mysql-5.5>cmake . -DBUILD_CONFIG=mysql_release -G "Visual Studio 9 2008"
-- Check for working C compiler: cl
-- Check for working C compiler: cl -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: cl
-- Check for working CXX compiler: cl -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void *
-- Check size of void * - done
-- MySQL 5.5.21
-- Disable authenticode signing for executables
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - not found.
-- Found Threads: TRUE
-- Looking for fedisableexcept
-- Looking for fedisableexcept - not found
-- Check size of time_t
-- Check size of time_t - done
-- Performing Test TIME_T_UNSIGNED
-- Performing Test TIME_T_UNSIGNED - Failed
-- Cannot find wix 3, installer project will not be generated
-- Configuring done
-- Generating done
-- Build files have been written to: C:/mysql-5.5/mysql-5.5

..

Output from VS 2008 Express Build:

1>------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
1>Checking Build System
1>CMake is re-running because build system is out-of-date.
1>-- MySQL 5.5.21
1>-- Configuring done
1>-- Generating done
1>-- Build files have been written to: C:/mysql-5.5/mysql-5.5
..........................................
...  ...
..........................................
========== Build: 93 succeeded, 0 failed, 5 up-to-date, 10 skipped ==========

..

Output from Testing:

-DBUILD_CONFIG=mysql_release

mysql> select version();
+------------------+
| version()        |
+------------------+
| 5.5.21-debug-log |
+------------------+
mysql> show engines;
+--------------------+---------+-------------------...
| Engine             | Support | Comment	   ...
+--------------------+---------+-------------------...
| FEDERATED          | NO      | Federated MySQL st...
| MRG_MYISAM         | YES     | Collection of iden...
| MyISAM             | YES     | MyISAM storage eng...
| BLACKHOLE          | YES     | /dev/null storage ...
| CSV                | YES     | CSV storage engine...
| MEMORY             | YES     | Hash based, stored...
| ARCHIVE            | YES     | Archive storage en...
| InnoDB             | DEFAULT | Supports transacti...
| PERFORMANCE_SCHEMA | YES     | Performance Schema...
+--------------------+---------+-------------------...

..

Error Section:

..

Error Connecting to Launchpad via Bazaar (bzr):

C:>bzr branch lp:mysql-server/5.5 mysql-5.5

Connected (version 2.0, client Twisted)
Authentication (publickey) failed.
bzr: ERROR: Connection error: Unable to authenticate to SSH host as
  chriscalender@bazaar.launchpad.net
supported auth types: ['publickey']

Solution:

If you encounter the above, then likely you’ve selected the wrong key or it’s not correct. See this page for even further details.

..

CMake Errors:

Signtool.exe Error:

CMake Error at cmake/install_macros.cmake:155 (MESSAGE):
  signtool is not found.  Signing executables not possible
-- Configuring incomplete, errors occurred!

Solution:

In my case, I searched my computer and had a signtool.exe, just not in a location that was in the $PATH, so I added that tool to the $PATH.

..

Stdint.h not found Error:

-- Looking for stdint.h
-- Looking for stdint.h - not found

Solution:

You can download stdint.h from here, and then save it to C:\Program Files\Microsoft Visual Studio 9.0\VC\include\.

Before re-running CMake again, you should delete CMakeCache.txt.

..

CMAKE_HAVE_PTHREAD_H not found Error:

-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - not found.

Solution:

This is a known bug, but harmless on Windows, so you can ignore it.

..

CMake TIME_T_UNSIGNED Failed Error:

-- Performing Test TIME_T_UNSIGNED
-- Performing Test TIME_T_UNSIGNED - Failed

Solution:

This is also a known bug, but it can also be safely ignored.

..

CMakeLists.txt Location Error:

CMake Error: The source directory "C:/build/mysql-5.5" does not appear to contain CMakeLists.txt.

Solution:

You’re in the wrong directory, ‘cd’ to the location where CMakeLists.txt resides.

..

Build / Compile Errors:

..

Visual Studio 2005 Errors:

If you try to compile MySQL 5.5 with VS 2005, you’ll likely see tons of syntax errors (I won’t post them all here). While you can use VS 2005 for building MySQL 5.1 and MariaDB 5.1, you’ll need to use VS 2008 to build MySQL 5.5.

..

m4: Invalid argument Error:

4>------ Build started: Project: GenServerSource, Configuration: Debug Win32 ------
4>Generating sql_yacc.cc, sql_yacc.h
4>C:\Program Files\GnuWin32\bin\bison.exe: m4: Invalid argument
4>Project : error PRJ0019: A tool returned an error code from "Generating sql_yacc.cc, sql_yacc.h"

Installing this to a location with no spaces should help. However, I did that and still had problems. The only way I found to move past this (at least for now) is to copy the file to $BUILD-DIR/sql/ (specifically, in this case, C:\mysql-5.5\mysql-5.5\sql\). After that, and after deleting CMakeCache.txt (in $BUILD/), I could finally move past this error.

..

Hope this helps :)

 
 


PlanetMySQL Voting: Vote UP / Vote DOWN

building MySQL 5.5 with cmake

Апрель 29th, 2010
mysql with cmakeYesterday I was testing a branch of MySQL 5.5 to help a colleague, and I was set aback at discovering that, with the default build options, the server did not include the Archive engine.
In other times, I would have to dig into the build scripts or to examine the output of ./configure --help, but that is no longer necessary. MySQL 5.5 is built using cmake, the cross platform make.

Why does this change make me feel better? Because cmake configuration is more user friendly than the old autoconf/automake/libtools horror syntax. Not only that, but there is a GUI!
I am a command line guy, as you probably know, but when the purpose of a GUI is not only to show off but to make difficult choices easy, then I all for it.

In my particular case, I enjoyed the idea of setting the options with a contextual help that told me the choices for each item.
If you want to know more about the whole process of building MySQL with CMake, there is a comprehensive guide in MySQL Forge.
Before I forget, though, there is something that reconciles my command line nature and the need for a good interface. Instead of using cmake-gui, I can get the same results with ccmake

It is not as pretty as the graphical UI, but it has the advantage of working in a remote terminal, which for me is a must.
So, if you want to try it, grab the latest MySQL 5.5 tree and follow the instructions.

PlanetMySQL Voting: Vote UP / Vote DOWN

Building MySQL Server with CMake on Linux/Unix

Март 3rd, 2010

CMake is a cross-platform, open-source build system, maintained by Kitware, Inc.

From the CMake.org home page:

CMake is a family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice.

It has been used for building the MySQL Server on Windows since MySQL 5.0 – the initial CMake build support was added in August 2006.

For building MySQL on all other platforms, the GNU autotools (autoconf, automake and libtool) are currently being used.

CMake is used in some other MySQL projects as well, e.g.

On February 22nd, Vladislav Vaintroub pushed the changes required to implement WorkLog#5161 "CMake-based unified build system" into the "mysql-next-mr" branch (aka the "Celosia" mile stone).

From this version on, CMake can also be used to build MySQL on Linux and other Unix platforms. For the time being, the autoconf/automake files are still available as well, but will be phased out once the CMake build enviroment has reached the desired level of maturity. The change was announced on February 28th on our "internals" developer discussion list.

The purpose of WL#5161 is to simplify the MySQL build system. It is much easier and less error-prone to maintain a unified build system for all platforms than two separate ones.

CMake has been chosen because of several reasons; the worklog description lists a few pro-CMake arguments (slightly rephrased):

  • CMake works on Windows. The GNU buildsystem does not really work and likely never will work natively on Windows (Using Cygwin is not really an option).
  • Traditionally, new MySQL features that required changes in the build environment (e.g. the plugin system, unit tests, most recently googletest integration) were always implemented on Unix first, leaving Windows behind (sometimes for years). This would not happen with a unified build system.
  • MySQL already uses CMake since 2006 on Windows, so we do not need to start from scratch, only port what we have to Unix.
  • CMake runs on every OS and compiler we support.
  • It is simple to obtain and install on a wide range of platforms. It is available in all major Linux package repositories (e.g. Ubuntu, Fedora, OpenSUSE). It is also in the OpenSolaris repository, known as SUNWCmake. It's in FreeBSD ports and available for Mac OS X. It is also very simple to compile it from source, the single prerequisite is a working C++ compiler and make utility.
  • CMake has support for features we need and might need, e.g. system checks or cross-compiling.
  • CMake provides integrated support for packaging. It can handle both simple packages (tar.gz or zip archives) and more complex things like DEB and RPM without much extra coding.
  • Good integration with the popular IDEs (Visual Studio, Xcode, Eclipse CDT, KDevelop). Developing in an IDE makes the development process more enjoyable, and potentially it lowers the barrier for external contributors. Of course, CMake can generate traditional Unix Makefiles, which appear to be are superior to the ones generated by GNU autotools (for example, they have progress indicators, colored output and working dependencies).
  • The scripting language used by CMake is simpler than m4 used by autotools.
  • CMake is a single small tool, not a bunch of different tools as in GNU system (autoconf, autoheader, automake, libtool)

I'd like to mention a few additional reasons:

  • Out-of-source builds – CMake can separate the build directory from the source directory. This is convenient, as your working source tree is not cluttered with object files and other fragments of the build process.
  • Build configuration using a GUI. The cmake-gui package (based on Nokia/TrollTech's Qt library) provides a convenient way of enabling and configuring the various available build options. This is much better than having to memorize all the required defines and configuration flags.
  • Integrated support for creating a wide range of package formats.

The CMake Wiki lists a number of other "nice to have" features.

From a developer perspective, I hope that it will make it much easier to finally implement two things that many developers working with MySQL have been waiting for (now that the build code has been cleaned up):

Building MySQL with CMake is quite simple and straighforward – the process is outlined on the MySQL Forge Wiki. The document is still work in progress and we'd like to encourage you to take a look at it, try to follow the steps and update/improve the Wiki page, if needed! Your feedback on the build process is appreciated. Feel free to join our internals mailing list to discuss your impressions and observations or submit a bug report via the Bug Database. It's likely that the build still has a few rough edges that we'd like to fix quickly (e.g. BUG#51502 – a fix for this one is already commited to the mysql-next-mr-bugfixing source tree and will be merged into the mysql-next-mr trunk soon).

If you're new to CMake, you might want to take a look at the "Getting Started With CMake (An End-User's Perspective) For Cross-Platform Building" screencast or the "Running CMake" article.

Happy hacking!


PlanetMySQL Voting: Vote UP / Vote DOWN