Bug #61587 Please document the requirements for Valgrind-aware builds
Submitted: 21 Jun 2011 13:00 Modified: 22 Jun 2014 8:33
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S4 (Feature request)
Version:5.5 OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[21 Jun 2011 13:00] Laurynas Biveinis
Description:
Currently there is WITH_VALGRIND option for cmake, which intuitively suggests that this option is enough to build MySQL without false positive errors. But additionally there is WITH_PURIFY C preprocessor define which also seems to be required for Valgrind-clean MySQL.

Neither WITH_VALGRIND nor WITH_PURIFY are documented, or, alternatively, the "official" procedure for building Valgrind-clean MySQL is not documented, if one does not consider BUILD/setup.sh to be documentation.

Thanks.

How to repeat:
See above.
[21 Jun 2011 13:03] MySQL Verification Team
Thank you for the bug report.
[21 Jun 2011 13:04] Laurynas Biveinis
s/WITH_PURIFY/HAVE_purify/g, sorry for the typo.
[21 Feb 2012 11:53] Laurynas Biveinis
5.5.21 removed HAVE_purify use in InnoDB:

 * InnoDB Storage Engine: References to C preprocessor symbols
   and macros HAVE_purify, UNIV_INIT_MEM_TO_ZERO, and
   UNIV_SET_MEM_TO_ZERO were removed from the InnoDB source code.
   They were only used in debug builds instrumented for Valgrind.
   They are replaced by calls to the UNIV_MEM_INVALID() macro.
   (Bug #13418934)

When the rest of the server removes it too, this bug may be closed.
[30 Jul 2013 7:06] Laurynas Biveinis
See http://bugs.mysql.com/bug.php?id=69855.
[3 Apr 2014 16:07] Laurynas Biveinis
HAVE_purify has been removed from 5.7.4, thus this bug can be considered fixed there.
[17 Jun 2014 11:57] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly.

http://dev.mysql.com/doc/internals/en/debug-configurations.html

To compile in the Valgrind headers and expose the Valgrind API to MySQL code, enable the WITH_VALGRIND option. Combine this with WITH_DEBUG to generate a debug build that is Valgrind-aware:

cmake .. -DWITH_DEBUG=1 -DWITH_VALGRIND=1

For MySQL 5.5 and 5.6, also enable Purify flags explicitly (this is unnecessary in 5.7 and up):

cmake .. -DWITH_DEBUG=1 -DWITH_VALGRIND=1 \
  -DCMAKE_C_FLAGS=-DHave_purify -DCMAKE_CXX_FLAGS=-DHave_purify
[22 Jun 2014 8:33] Laurynas Biveinis
Shouldn't Have_purify be HAVE_purify in the cmake command line?
[22 Jun 2014 20:09] Paul DuBois
Indeed yes. Thanks, will fix.