Bug #25451 Compile error with MS VC++ 2005 on Windows
Submitted: 7 Jan 2007 5:15 Modified: 3 May 2007 10:47
Reporter: Tom Donovan (Candidate Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0.32 OS:Microsoft Windows (Windows)
Assigned to: Magnus Blåudd CPU Architecture:Any

[7 Jan 2007 5:15] Tom Donovan
Description:
Microsoft Visual C++ 2005 cannot compile extra\yassl\taocrypt\src\integer.cpp

  error C2244 - "unable to match function definition to an existing declaration"

This can be fixed by changing the definition of 'allocate' in integer.cpp (line 91) to better match the declaration in integer.hpp (line 96).

This problem appears to be a weakness in the VC++ 2005 compiler, as both
AllocatorBase<T>::pointer and AlignedAllocator<T>::pointer are typedefs for T*

How to repeat:
Compile MySQL 5.0.32 with Microsoft Visual C++ 2005

Suggested fix:
--- extra/yassl/taocrypt/src/integer.cpp_orig    2007-01-07 00:07:33.439159800 -0500
+++ extra/yassl/taocrypt/src/integer.cpp 2007-01-07 00:07:46.220315200 -0500
@@ -88,7 +88,7 @@
 #ifdef SSE2_INTRINSICS_AVAILABLE

 template <class T>
-CPP_TYPENAME AllocatorBase<T>::pointer AlignedAllocator<T>::allocate(
+CPP_TYPENAME AlignedAllocator<T>::pointer AlignedAllocator<T>::allocate(
                                            size_type n, const void *)
 {
     CheckSize(n);
[8 Jan 2007 1:06] Godofredo Miguel Solorzano
Thank you for the bug report. I was unable to repeat compiling current
source 5.0.34 with Visual Studio 2005 Professional Edition:

------ Build started: Project: taocrypt, Configuration: Release Win32 ------
Compiling...
integer.cpp
Build log was saved at "file://c:\mysql-5.0.34\extra\yassl\taocrypt\Release\BuildLog.htm"
taocrypt - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
[8 Jan 2007 18:06] Tom Donovan
The problem occurs when compiling with the Visual C++ 2005 Express edition, either the original or SP1.  Perhaps 'Pro' has a later compiler revision.

The version of VC2005 Express edition which I used is:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86

I also see the same problem with the older version 14.00.50727.42 compiler.

The current public 5.0 bk source for integer.cpp appears to be unchanged, although there is no tag for 5.0.34 (per http://mysql.bkbits.net:8080/mysql-5.0/?PAGE=tags) so I am not sure if we are using the same source.

Some additional refs to this problem:
http://sourceforge.net/forum/forum.php?thread_id=1639717&forum_id=439591
http://osdir.com/ml/cryptopp-list@eskimo.com/msg02894.html
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1068108&SiteID=1
https://connect.microsoft.com/feedback/viewfeedback.aspx?FeedbackID=248321&wa=wsignin1.0&s...

It appears to be widespread, but inconsistent - and prevents many people from compiling yassl/taocrypt (or MySQL) with VC2005.

-tom-
[8 Jan 2007 21:32] Godofredo Miguel Solorzano
Thank you for the feedback. Indeed that line of code I compiled is the
same as you had reported:

Setting environment for using Microsoft Visual Studio 2005 x86 tools.

c:\>cat c:\mysql-5.0.34\extra\yassl\taocrypt\src\integer.cpp | findstr CPP_TYPENAME
CPP_TYPENAME AllocatorBase<T>::pointer AlignedAllocator<T>::allocate(

c:\>cl /help
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

and in the Help->About menu reports:

Microsoft Visual Studio 2005
Version 8.0.50727.42  (RTM.050727-4200)

also I checked for update and I got 0 files for Visual Studio 2005.

So looks to me it is a compiler issue and not a code bug.
[9 Jan 2007 19:57] Tom Donovan
I discussed the bug with the yaSSL/taocrypt folks, and they agreed to fix it.

The definition & declaration are not identical, even though most compilers accept them because they are 'equivalent enough'.

see: http://sourceforge.net/forum/message.php?msg_id=4094609

Todd Ouska at yaSSL says "I'm pusing a new version today or tomorrow and I'll let mySQL know when I do"

It would be a real help to the Windows/MySQL community if you could either make the same fix or take the new version of taocrypt.  This will avoid having an extra undocumented "fix this by hand before building" step for many (but not all) Windows MySQL users.

Many thanks for all your help with this Miguel,

-tom-
[9 Jan 2007 20:00] Godofredo Miguel Solorzano
Thank you for the feedback. I am changing to verified for our source tree
to be updated with the fix you have mentioned. Thanks a lot again.
[3 May 2007 10:47] Magnus Blåudd
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html
[3 May 2007 10:53] Magnus Blåudd
Hi Tom,

we always fix the bugs in upstream yaSSL CVS repository on sourceforge and then import them to MySQL's repository. As an effect of that you patch was imported by
http://lists.mysql.com/commits/18554 which fixed bug#25189

Thanks!

/Magnus