Friday, September 3, 2010

Building 32-bit MySQL clients with 64-bit MySQL install

Had to build a 32-bit MySQL client (MySQL-python) on a 64-bit Windows Vista hosted install of 64-bit MySQL. 
I used setuptools to get the initial download of MySQL-python. “easy_install –b temp mysql-python”.  But installation failed due to 64-bit MySQL libraries (and the registry setting in site.cfg).
  1. First, I downloaded the no-install 32-bit version of MySQL extracted it out and copied the libraries directory to “C:\Program Files\MySQL\lib32”. Now I have the 32-bit libraries in “C:\Program Files\MySQL\lib32” and the 64-bit libraries in “C:\Program Files\MySQL\lib”.
  2. Then tweaked the MySQL-python site.cfg so the registry_key was correct (registry_key = SOFTWARE\MySQL AB\MySQL Server 5.1) .
  3. Next tweaked the setup_windows.py so it would use lib32 instead of the 64-bit libraries (library_dirs = [ os.path.join(mysql_root, r'lib32\opt') ]
  4. Finally, it was a simple run of “python setup.py clean”; “python setup.py install” to get MySQL-python installed.
Purely a hack but it got the job done.

No comments: