Solaris and OpenSolaris Tips
Compiling Percona MySQL 5.1 on Solaris
As of February 23, 2010 the Percona patches for MySQL 5.1.43 would not compile on a fairly stock Solaris 10 system using gcc. There were two main problems: a misnamed function call, and using a function that does not exist in Solaris 10.
The Problems
Bug reports for both problems were opened, and may be found at the following links:
- os_atomic_increment undeclared error compiling 5.1.43 with gcc on Solaris 10
- Solaris 10 (x86) does not have strsep (used in sql/sql_show.cc)
Solutions
os_atomic_increment undeclared
The Percona patches correctly determined support for atomic operations and that Solaris atomic functions should be used. The problem was the use of os_atomic_increment() instead of os_atomic_increment_lint().
The function os_atomic_increment() was a generic function used by both os_atomic_increment_lint() and os_atomic_increment_ulint() on Linux systems, and was not defined for Solaris and Windows systems. Normally that wouldn't be a problem, however the storage/innobase/include/sync0rw.ic file accidentally used os_atomic_increment() instead of os_atomic_increment_lint() causing compile problems on Solaris (and presumably Windows as well).
Solaris 10 does not have strsep()
The Percona userstat patch uses strsep() in sql/sql_show.cc, but Solaris 10 does not have strsep() in its libc. The only way to correct this was to add a replacement strsep() function that is compiled when the configure script fails to detect strsep() on the system.
NOTE: A better way to fix this would be to create a compatibility file and link to the replacement functions there. Due to time constraints this patch adds the replacement strsep() function to the sql/sql_show.cc file directly. It's not very elegant, but it works.
NOTE 2: The replacement strsep() function is based on the getToken function found at http://www.winehq.org/pipermail/wine-patches/2001-November/001322.html.
Patches
These patches are meant to be applied to the MySQL 5.1 directory after the Percona patches have been applied. As of February 25, 2010 the Percona patches, and the patches below, target MySQL 5.1.43.
os_atomic_increment()
solaris_10_os_atomic_increment.patch
NOTE: This fix was committed on February 24, 2010 and should negate the need for this patch.
