Bug #1859 | mysql_init bug under CYGWIN | ||
---|---|---|---|
Submitted: | 17 Nov 2003 4:55 | Modified: | 16 Dec 2003 8:26 |
Reporter: | Fabrice Marchal | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S1 (Critical) |
Version: | 4.0.16 | OS: | Windows (Win2K) |
Assigned to: | CPU Architecture: | Any |
[17 Nov 2003 4:55]
Fabrice Marchal
[1 Dec 2003 14:38]
Dean Ellis
Copying comments from duplicate issue #1979: Description: I dont know if this is a problem of mysql, g++ or cygwin but the following simple code keeps crashing with g++3.3.1 Platform: cygwin-1.5.5, mysql 3.23 and mysql 4.1 as well Note that the code does not crash if all the mysql_ calls are made from inside the "main()" block. GDB reports that the crash occurs when returning from the Connection() constructor. How to repeat: #include "mysql.h" #include <iostream> using namespace std; class Connection{ MYSQL *mysql; public: Connection(){ mysql = mysql_init( NULL ); if( mysql == 0 ){ cerr << "failed to init" << endl; exit(-1); } mysql_real_connect( mysql, "", "", "", "test", 3306, NULL, 0); } }; int main( int argc, char** args ){ Connection con; } Suggested fix:
[13 Dec 2003 18:33]
Michael Widenius
A short comment on this issue: We don't support the MySQL server under cygwin becasue to our knowledge the thread handling under cygwin is not safe and the server works very good with VC++ /Intel C++ compiler and native Windows threads. It should however be possible to compile the MYSQL client with cygwin support as long as you have defined -DUNDEF_THREADS_HACK (or not defined -DTHREAD). Unfortunately we don't have anyone her at MySQL AB that is working actively with cygwin so we can't help you with this. We are however willing to look at any patch you can come up with that may fix this problem. Regards, Monty
[15 Dec 2003 5:13]
Fabrice Marchal
Thanks for your reply. I am not sure I made my point clear enough though: I am indeed linking against libmySQL.lib that is provided with the MYSQL Win32 install. The server is not running "under cygwin" per se, but my client code is compiled under cygwin and linked agains the compiled libraries provided in the distro. If I understand right, these libs are wrappers around .DLL lib calls. Doing a "nm" reveals that those libs use PTHREAD but I am not sure how. So your suggestion is either to fix it myself or to go for another compiler environment for my own client (e.g. VC++)?
[16 Dec 2003 8:26]
MySQL Verification Team
How Monty explained: we can't to help you with Cygwin because currently nobody works with that stuff at MySQL, the other option you have is to use VC++ 6.0 which it is our current Windows build stuff.