Bug #7706 MinGW compilation not very friendly
Submitted: 6 Jan 2005 14:28 Modified: 9 Jun 2005 17:30
Reporter: Mirza Hadzic Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.8a OS:Windows (Windows 2000)
Assigned to: Jim Winstead CPU Architecture:Any

[6 Jan 2005 14:28] Mirza Hadzic
Description:
Three problems with mingw-compiled apps on windows (I don't recompile mysql, use normal MySQL installation libs):

1) When I compile program, I have to include mysql headers in this way:
#define rint _rint	 
	#include <my_global.h>
    	#include <mysql.h>
#undef rint 
Otherwise cannot compile. I found this solution on internet, don't know what is the problem with rint...

2) There are warnings on duplicate #defined 7 symbols:
finite
my_reinterpret_cast
int3store
int5store
doubleget
doublestore
float4get

But it compiles anyway, looks like this doesn't metter much (?)

3) libmySQL.a is not part of windows installation. Please add it there. If you have mingw installed, It can be produced from libmySQL.dll like:
dlltool --input-def libmySQL.def --dllname libmySQL.dll --output-lib libmySQL.a -k
I found this also on internet, but it is annoying for new users, I guess.

How to repeat:
Install mingw to Win and try to compile simple app that interact with mysql.
[6 Jan 2005 22:07] MySQL Verification Team
Thank you for the bug report.
[21 Jan 2005 0:03] Jim Winstead
I was not able to repeat the rint problem using MinGW 3.1.0-1 (and looking at the source, do not see how it could be a problem), but was able to fix the macro redefinitions.

I've documented the steps for producing libmysql.a and opened a new feature request (Bug #8059) to get it added to our Windows packages.
[21 Jan 2005 13:23] Mirza Hadzic
I investigate rint problem:
if you include <math.h> as most program do, this has on line 544:

/* 7.12.9.4 */
/* round, using fpu control word settings */
extern __inline__ double __cdecl rint (double x)
{
  double retval;
  __asm__ ("frndint;": "=t" (retval) : "0" (x));
  return retval;
}

which conflicts with mysql's config-win.h line 189:

inline double rint(double nr)
{
  double f = floor(nr);
  double c = ceil(nr);
  return (((c-nr) >= (nr-f)) ? f :c);
}
[9 Jun 2005 17:30] Jim Winstead
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/

Additional info:

This was fixed by another commit.
[22 Jul 2005 14:06] Mirza Hadzic
Please reopen this bug as in 4.1.13 version those symbols are double #defined too.