Donate Share

MySQL for Python

Tracker: Bugs

5 #define of uint breaks compiling on Mac OS X 10.5 - ID: 1808476
Last Update: Comment added ( sf-robot )

It looks like at some point the following code was slapped in to work
around a compile failing on some platform or another:
---8<---
#ifndef uint
#define uint unsigned int
#endif
--->8---
This breaks compiling on Mac OS X 10.5 -- and probably on other BSD
derivatives as well -- because uint is later typedef'd in one of the system
headers. gcc of course barfs on a typedef that ends up reading (after macro
expansion):
---8<---
typedef unsigned int unsigned int;
--->8---

Obligatory patch below:

diff -u MySQL-python-1.2.2/_mysql.c MySQL-python-1.2.2.patched/_mysql.c
--- MySQL-python-1.2.2/_mysql.c 2007-02-27 18:35:56.000000000 -0800
+++ MySQL-python-1.2.2.patched/_mysql.c 2007-10-05 23:46:59.000000000
-0700
@@ -34,9 +34,6 @@
#else
#include "my_config.h"
#endif
-#ifndef uint
-#define uint unsigned int
-#endif
#include "mysql.h"
#include "mysqld_error.h"
#include "errmsg.h"



Kaelin Colclasure ( kaelin ) - 2007-10-06 07:06

5

Closed

Fixed

Kyle VanderBeek

MySQLdb

MySQLdb-1.2

Public


Comments ( 7 )

Date: 2009-03-18 18:56
Sender: sf-robotSourceForge.net Site Admin

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).


Date: 2009-02-24 02:49
Sender: kylevAccepting Donations

I put this in 1.2br as well. It will appear in 1.2.3b2.


Date: 2008-06-06 21:23
Sender: kylevAccepting Donations


mcraft59: Your problem is unrelated to to this bug. You're probably
suffering the same issue that many Mac users have seen in that OSX comes
with 32-bit python but you've installed 64-bit MySQL. Either install
32-bit MySQL or find a way just to get the 32-bit client libraries
installed.


Date: 2008-06-06 19:27
Sender: mcraft59


above code gives the following warnings on mac os x 10.5

ld: warning in build/temp.macosx-10.5-i386-2.5/_mysql.o, file is not of
required architecture
ld: warning in /usr/local/mysql/lib/libmysqlclient_r.dylib, file is not of
required architecture

I'm still able to install and import the MySQLdb from the command line
interpreter.

If it helps I used the mysql5.dmg installer for intel mac.


Date: 2008-04-01 16:17
Sender: adustmanProject AdminAccepting Donations


Fixed in SVN trunk. Beware that trunk is broken atm.


Date: 2007-11-16 21:04
Sender: batloggAccepting Donations


i can confirm that the patch above works. a new release would be really
appreciated.


Date: 2007-10-30 18:54
Sender: kylevAccepting Donations


I'd instead recommend just not using the less-portable uint type
altogether. It's only used twice, and breaks on many BSD-ish platforms.
Using "unsigned int" is C standard and completely portable.

--- _mysql.c (revision 514)
+++ _mysql.c (working copy)
@@ -34,9 +34,6 @@
#else
#include "my_config.h"
#endif
-#ifndef uint
-#define uint unsigned int
-#endif
#include "mysql.h"
#include "mysqld_error.h"
#include "errmsg.h"
@@ -481,8 +478,8 @@
#endif
char *host = NULL, *user = NULL, *passwd = NULL,
*db = NULL, *unix_socket = NULL;
- uint port = MYSQL_PORT;
- uint client_flag = 0;
+ unsigned int port = MYSQL_PORT;
+ unsigned int client_flag = 0;
static char *kwlist[] = { "host", "user", "passwd", "db", "port",
"unix_socket", "conv",
"connect_timeout", "compress",



Attached File

No Files Currently Attached

Changes ( 7 )

Field Old Value Date By
allow_comments 1 2009-03-18 18:56 sf-robot
close_date 2009-02-24 03:24 2009-03-18 18:56 sf-robot
status_id Pending 2009-03-18 18:56 sf-robot
status_id Open 2009-02-24 03:24 kylev
close_date - 2009-02-24 03:24 kylev
assigned_to adustman 2009-02-24 02:49 kylev
resolution_id None 2008-04-01 16:17 adustman