Bug #56146 InnoDB will not compile with VS2005 due to CONDITION_VARIABLE
Submitted: 20 Aug 2010 14:11 Modified: 5 May 2011 14:56
Reporter: Kevin Lewis Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5 OS:Windows
Assigned to: CPU Architecture:Any
Tags: compiler VS2005 CONDITION_VARIABLE

[20 Aug 2010 14:11] Kevin Lewis
Description:
A recent change to InnoDB has caused it to not compile on VS2005.  The change was to add CONDITION_VARIABLE as a more appropriate synchronization type for the windows platform.  It is used within the macro definition __WIN__ in innobase/include/os0sync.h.  On all other platforms it uses pthread_cond_t.

This type was introduced in Microsoft VISTA and is not available for older OSes like Windows Server 2003 and Windows XP/2000.  Only the the 2 newest compilers from Microsoft, VS2008 and VS2010, know about this typedef and include it in WinBase.h.

In order to use this variable with older microsoft compilers, special code must be added.  The question to first ask is whether we want to continue to support VS2005 since it has been superceeded with 2 later versions.

How to repeat:
compile with VS2005

Suggested fix:
If we want to continue to support VS2005, then the following is a fix suggested by Vlad which will allow CONDITION_VARIABLE to be used anywhere in the MySQL codebase. 

=== modified file 'config.c.cmake'
+#ifdef _WIN32
+  #if (_MSC_VER<  1500)
+    typedef struct _RTL_CONDITION_VARIABLE {
+      void* Ptr;
+    } RTL_CONDITION_VARIABLE, *PRTL_CONDITION_VARIABLE;
+    typedef RTL_CONDITION_VARIABLE CONDITION_VARIABLE, *PCONDITION_VARIABLE;
+  #endif
+#endif
[20 Aug 2010 16:24] MySQL Verification Team
Thank you for the bug report.

 	

Build log was saved at "file://c:\build\5.5\storage\innobase\innobase.dir\Debug\BuildLog.htm"
innobase - 24 error(s), 50 warning(s
[26 Aug 2010 15:33] Kevin Lewis
This problem is only involved with using VS2005 to compile the 5.5 MySQL.  If a newer compiler is used from Microsoft such as VS2008 or VS2010, then it compiles correctly and can run even on systems that do not support this new type of synchronization primitive.
[5 May 2011 14:56] Daniel Fischer
VS 2008 is the minimum for 5.5.