Saturday, October 31, 2009

mingw32, wine, library paths

Here is yet another thing I'm posting here just because Google searches turn up this blog sometimes and it might help someone save some time. Audience is people building Windows binaries on Linux with the mingw32 cross compiler and testing them in Wine. I do this sometimes for work on the Audacity project, which with a few minor modifications builds nicely with mingw32 -- it doesn't work exactly like a VS compile, but it lets me test wxMSW behavior, which is sometimes useful.

So you're running Linux, you've set up a mingw32 cross compiler (on Ubuntu just get all the mingw32 packages), and built some libraries with it. And you've built programs that use those libraries. But all the libraries are installed in places like /usr/i586-mingw32msvc/lib and /usr/local/i586-mingw32/lib. As far as I can tell, as of Wine 1.0, to get Wine programs to see libraries in those locations is to add them to PATH in a registry key. Typically Wine is configured so that your Unix root shows up at drive Z. So run regedit and go to HKLM/System/CurrentControlSet/Control/Session Manager/Environment and add to PATH, for example, ;Z:\usr\i586-mingw32msvc\lib;Z:\usr\local\i586-mingw32\lib (your paths may vary).

You'll also need to install the mingw32 runtime DLL to your Wine, which is usually something like gunzip -c /usr/share/doc/mingw32-runtime/mingwm10.dll.gz > ~/.wine/drive_c/windows/system32/mingw10.dll.

If you don't like having Z: point at root (for some people it's good for Wine to be highly integrated -- others would rather have it as far from their normal system as possible) you can point drives specifically at your library paths using winecfg, or other similar tricks. Symlinks from within ~/.wine/drive_c might be another appealing option.