[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FAQ - FEMM under GNU/Linux using Wine



David asked me to provide some details on how to make FEMM work on a Linux box. Hopefully, these instructions will prove helpful to somebody.

First, what is wine (from the Wine HQ site: http://www.winehq.com/):
"Wine is an implementation of the Windows 3.x and Win32 APIs on top of X and Unix. Think of Wine as a Windows compatibility layer. Wine provides both a development toolkit (Winelib) for porting Windows sources to Unix and a program loader, allowing unmodified Windows 3.1/95/NT binaries to run under Intel Unixes. Wine works on most popular Intel Unixes, including Linux, FreeBSD, and Solaris."

There are precompiled packages as well as source code for Wine at http://www.winehq.com/download.shtml. Initially I got the source tar-ball and compiled it on my RedHat 7.1 (that took a while, it is a fairly large package, approx 1M lines of code). If you need help unpacking etc, there are instructions on the download page.

An older version of Wine came on my RedHat 7.1 distribution (powertools) and that one seems to work as well (wine-20010131-3.i386.rpm). Install the RPM as root and run 'wine' as a regular user to create the ~/.wine configuration directory.
User specific configuration was better handled in the RPM distribution, so that is what I would recommend.

You may have to make the following definition in your ~/.bash_profile to find some libaries:
LD_LIBRARY_PATH=/usr/local/lib; export LD_LIBRARY_PATH
(or modify it appropriately if it is already defined)

When you have installed the Wine package there is a special 'C-drive' directory somewhere on your computer (the location depends on what package you choose). There should be a configuration file ~/.wine/config. It defines how your hard drive is mapped for the purpose of windoze. For example, the "C:" drive on my machine is now defined like this:
[Drive C]
"Path" = "/usr/share/wine-c"
"Type" = "hd"
"Label" = "MS-DOS"
"Filesystem" = "win95"

Your configuration may have a differnt 'mount points' for the windows stuff, but I use /usr/share/wine-c for windows specific files. Think of this as your 'C: drive': You'll find a 'windows' directory and a 'Program Files' directory etc.

Now put the FEMM installation file in one of the directories mentioned as valid 'windoze' directories in the config file. I did the installation as root (so that I can leave /usr/share as a root-only area). I downloaded the FEMM installation file (femm30.exe) in /tmp. I then said 'wine /tmp/femm30.exe' as root. Installation should proceed as you are used to from windows.

When you try to run FEMM (wine "/usr/share/wine-c/Program Files/femm30/bin/femme.exe"), wine will tell you that some DLLs are missing. You will have to grab them from some windows installation that you have access to. For FEMM this means finding windows/system/{msvcirt,msvcrt40,mfc40}.dll and copying them to /usr/share/wine-c/windows/system (or whatever your configuration tells you). I also put some common executables in the windows directory: winhelp.exe, winhlp32.exe, regedit.exe. In addition I made sure that {shell, shell32, comdlg, comdlg32, commctrl, comctl32}.dll are available in the windows/system directory. This is recommended in the Wine installation instruction, but not strictly required.

When you collect DLLs and executables, try to be consistent and use the same version of windows! Wine will tell you what it cannot find, so just keep filling that directory until you have what you need! I wonder how Redmond feels about using their DLLs this way?

If you invoke wine with the flag '--managed' it allows your favorite linux windows manager to handle its windows. I don't get the title bar in KDE, but apart from that everything seems to work pretty well.

I defined a little bash script to invoke femm from linux. In an executable file (chmod +x <file>) called 'femm' residing in a directory listed in my bash $PATH variable:
#!/bin/bash
wine --managed \
'/usr/share/wine-c/Program Files/femm30/bin/femme.exe' $*

The simple little test model I ran on my 500 MHz PIII took 37 seconds to complete. I'd be interested in hearing how that stacks up to a native windows implementation. I posted the .fem definition in the 'Files' area of this discussion group: look for hollow-20.fem.

Good luck,

Stefan Engstrom