I've got Python 2.6.1 on Windows Vista with Microsoft Visual Studio 9.0. Everything is configured for 64-bit. I've successfully built other Python 2.6 64-bit applications (numpy).
I've installed MySQL 5.1 64-bit with the include files. I've patched the registry so the MySQL can be found (see http://bugs.mysql.com/?id=42423 for more info).
Now when I run setup.py build from a trunk checkout, I get the following error:
PS C:\Users\jaraco\projects\mysql-python\MySQLdb> ./setup bdist
running bdist
running bdist_dumb
running build
running build_py
copying MySQLdb\release.py -> build\lib.win-amd64-2.6\MySQLdb
running build_ext
building '_mysql' extension
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG "-Dversion_i
nfo=(1, 3, 0, 'final', 0)" -Dversion=1.3.0 "-IC:\Program Files\MySQL\MySQL Server 5.1\include" -IC:\Python\include -
IC:\Python\PC /Tc_mysql.c /Fobuild\temp.win-amd64-2.6\Release_mysql.obj /Zl
_mysql.c
c:\users\jaraco\projects\mysql-python\mysqldb_mysql.h(12) : fatal error C1083: Cannot open include file: 'my_config.h':
No such file or directory
error: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe"' failed with exit status 2
It's not finding my_config.h. Indeed, I don't see that file anywhere.
I've never built MySQLdb before.
Have I encountered this error because I'm compiling against 5.1 instead of 5.0? Any other suggestions?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems that including <winsock2.h> before <windows.h> is necessary to prevent windows.h from including winsock.h.
I added that fix, but now run into a compiler error. It appears that in addition to some compiler warnings relating to the 64-bit compile, a manifest file is not being generated.
building '_mysql' extension
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,2,3,'beta',1) -Dversion=1.2.3 "-IC:\Program Files\MySQL\MySQL Server 5.1\include" -IC:\Python\include -IC:\Python\PC /Tc_mysql.c /Fobuild\temp.win-amd64-2.6\Release_mysql.obj /Zl_mysql.c
C:\Program Files\MySQL\MySQL Server 5.1\include\config-win.h(26) : warning C4005: '_WIN32_WINNT' : macro redefinition
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\sdkddkver.h(151) : see previous definition of '_WIN32_WIN
NT'
C:\Program Files\MySQL\MySQL Server 5.1\include\config-win.h(181) : warning C4005: 'SIZEOF_OFF_T' : macro redefinition
c:\python\include\pyconfig.h(341) : see previous definition of 'SIZEOF_OFF_T'
C:\Program Files\MySQL\MySQL Server 5.1\include\config-win.h(282) : warning C4005: 'HAVE_STDDEF_H' : macro redefinition
c:\python\include\pyconfig.h(641) : see previous definition of 'HAVE_STDDEF_H'
C:\Program Files\MySQL\MySQL Server 5.1\include\config-win.h(290) : warning C4005: 'HAVE_ISNAN' : macro redefinition
c:\python\include\pyconfig.h(406) : see previous definition of 'HAVE_ISNAN'
_mysql.c(256) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(281) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(408) : warning C4244: 'initializing' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(1015) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(1110) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(1297) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1299) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1335) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1337) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1363) : warning C4018: '<' : signed/unsigned mismatch
_mysql.c(2091) : warning C4244: 'function' : conversion from '__int64' to 'long', possible loss of data
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO "/LIBPATH:C:\Program Files\MySQL\MySQL Server 5.1\lib\opt" /LIBPATH:C:\Python\libs /LIBPATH:C:\Python\PCbuild\amd64 kernel32.lib advapi32.lib wsock32.lib mysqlclient.lib /EXPORT:init_mysql build\temp.win-amd64-2.6\Release_mysql.obj /OUT:build\lib.win-amd64-2.6_mysql.pyd /IMPLIB:build\temp.win-amd64-2.6\Release_mysql.lib /MANIFESTFILE:build\temp.win-amd64-2.6\Release_mysql.pyd.manifest
_mysql.obj : warning LNK4197: export 'init_mysql' specified multiple times; using first specification
Creating library build\temp.win-amd64-2.6\Release_mysql.lib and object build\temp.win-amd64-2.6\Release_mysql.exp
_mysql.obj : warning LNK4217: locally defined symbol strncat imported in function _mysql_row_to_dict
_mysql.obj : warning LNK4217: locally defined symbol strncpy imported in function _mysql_row_to_dict
_mysql.obj : warning LNK4217: locally defined symbol sprintf imported in function _mysql_ConnectionObject_repr
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\x64\mt.exe -nologo -manifest build\temp.win-amd64-2.6\Release_mysql.pyd.manifest -outputresource:build\lib.win-amd64-2.6_mysql.pyd;2
build\temp.win-amd64-2.6\Release_mysql.pyd.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.
error: command 'mt.exe' failed with exit status 31
mt.exe is correct. The manifest is not there. There are 3 files: _mysql.{exp, lib, obj}
The previous warnings don't seem to indicate a failure, only warnings. Any suggestions?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just curious if you had any luck with compiling under win-64. I've been trying but unfortunately I'm not as familiar with compiling such things as I wish to be. For the most part this is the last piece of the puzzle holding us back from switching over to a 64-bit pipeline for the Compositing software at the company I work for.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've got Python 2.6.1 on Windows Vista with Microsoft Visual Studio 9.0. Everything is configured for 64-bit. I've successfully built other Python 2.6 64-bit applications (numpy).
I've installed MySQL 5.1 64-bit with the include files. I've patched the registry so the MySQL can be found (see http://bugs.mysql.com/?id=42423 for more info).
Now when I run setup.py build from a trunk checkout, I get the following error:
PS C:\Users\jaraco\projects\mysql-python\MySQLdb> ./setup bdist
running bdist
running bdist_dumb
running build
running build_py
copying MySQLdb\release.py -> build\lib.win-amd64-2.6\MySQLdb
running build_ext
building '_mysql' extension
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG "-Dversion_i
nfo=(1, 3, 0, 'final', 0)" -Dversion=1.3.0 "-IC:\Program Files\MySQL\MySQL Server 5.1\include" -IC:\Python\include -
IC:\Python\PC /Tc_mysql.c /Fobuild\temp.win-amd64-2.6\Release_mysql.obj /Zl
_mysql.c
c:\users\jaraco\projects\mysql-python\mysqldb_mysql.h(12) : fatal error C1083: Cannot open include file: 'my_config.h':
No such file or directory
error: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe"' failed with exit status 2
It's not finding my_config.h. Indeed, I don't see that file anywhere.
I've never built MySQLdb before.
Have I encountered this error because I'm compiling against 5.1 instead of 5.0? Any other suggestions?
Okay. I see now from the discussions that the 1.2 branch is more up-to-date. I switched to that branch and now I get further.
Next, I run into a problem related to Visual Studio 9.0:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winsock2.h(1527) : error C2375: 'accept' : redefinition; differen
t linkage
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winsock.h(735) : see declaration of 'accept'
I found this on it: http://www.codeguru.com/forum/showthread.php?threadid=469459
Apparently, the fix is to remove all references to winsock.h from the source.
I'll investigate and follow-up.
The solution to this problem is to edit your
<PYTHONDIR>\Lib\distutils\msvc9compiler.py
and add the line:
ld_args.append('/MANIFEST')
just above the line that reads
ld_args.append('/MANIFESTFILE:' + temp_manifest)
( I originally found this solution here:
http://mail.python.org/pipermail/python-bugs-list/2009-February/071383.html )
Cool. Thanks for finding that. I'll try that out later.
It seems that including <winsock2.h> before <windows.h> is necessary to prevent windows.h from including winsock.h.
I added that fix, but now run into a compiler error. It appears that in addition to some compiler warnings relating to the 64-bit compile, a manifest file is not being generated.
building '_mysql' extension
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,2,3,'beta',1) -Dversion=1.2.3 "-IC:\Program Files\MySQL\MySQL Server 5.1\include" -IC:\Python\include -IC:\Python\PC /Tc_mysql.c /Fobuild\temp.win-amd64-2.6\Release_mysql.obj /Zl_mysql.c
C:\Program Files\MySQL\MySQL Server 5.1\include\config-win.h(26) : warning C4005: '_WIN32_WINNT' : macro redefinition
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\sdkddkver.h(151) : see previous definition of '_WIN32_WIN
NT'
C:\Program Files\MySQL\MySQL Server 5.1\include\config-win.h(181) : warning C4005: 'SIZEOF_OFF_T' : macro redefinition
c:\python\include\pyconfig.h(341) : see previous definition of 'SIZEOF_OFF_T'
C:\Program Files\MySQL\MySQL Server 5.1\include\config-win.h(282) : warning C4005: 'HAVE_STDDEF_H' : macro redefinition
c:\python\include\pyconfig.h(641) : see previous definition of 'HAVE_STDDEF_H'
C:\Program Files\MySQL\MySQL Server 5.1\include\config-win.h(290) : warning C4005: 'HAVE_ISNAN' : macro redefinition
c:\python\include\pyconfig.h(406) : see previous definition of 'HAVE_ISNAN'
_mysql.c(256) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(281) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(408) : warning C4244: 'initializing' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(1015) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(1110) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'int', possible loss of data
_mysql.c(1297) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1299) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1335) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1337) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
_mysql.c(1363) : warning C4018: '<' : signed/unsigned mismatch
_mysql.c(2091) : warning C4244: 'function' : conversion from '__int64' to 'long', possible loss of data
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO "/LIBPATH:C:\Program Files\MySQL\MySQL Server 5.1\lib\opt" /LIBPATH:C:\Python\libs /LIBPATH:C:\Python\PCbuild\amd64 kernel32.lib advapi32.lib wsock32.lib mysqlclient.lib /EXPORT:init_mysql build\temp.win-amd64-2.6\Release_mysql.obj /OUT:build\lib.win-amd64-2.6_mysql.pyd /IMPLIB:build\temp.win-amd64-2.6\Release_mysql.lib /MANIFESTFILE:build\temp.win-amd64-2.6\Release_mysql.pyd.manifest
_mysql.obj : warning LNK4197: export 'init_mysql' specified multiple times; using first specification
Creating library build\temp.win-amd64-2.6\Release_mysql.lib and object build\temp.win-amd64-2.6\Release_mysql.exp
_mysql.obj : warning LNK4217: locally defined symbol strncat imported in function _mysql_row_to_dict
_mysql.obj : warning LNK4217: locally defined symbol strncpy imported in function _mysql_row_to_dict
_mysql.obj : warning LNK4217: locally defined symbol sprintf imported in function _mysql_ConnectionObject_repr
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\x64\mt.exe -nologo -manifest build\temp.win-amd64-2.6\Release_mysql.pyd.manifest -outputresource:build\lib.win-amd64-2.6_mysql.pyd;2
build\temp.win-amd64-2.6\Release_mysql.pyd.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.
error: command 'mt.exe' failed with exit status 31
mt.exe is correct. The manifest is not there. There are 3 files: _mysql.{exp, lib, obj}
The previous warnings don't seem to indicate a failure, only warnings. Any suggestions?
I'm changing the thread subject for clarity.
Just curious if you had any luck with compiling under win-64. I've been trying but unfortunately I'm not as familiar with compiling such things as I wish to be. For the most part this is the last piece of the puzzle holding us back from switching over to a 64-bit pipeline for the Compositing software at the company I work for.