Developer's Toolbox: Tools to Migrate Apps from Windows to Linux

Novell Cool Solutions: Feature
By Richard Smith

Digg This - Slashdot This

Posted: 14 Jul 2004

This month we're going to take a look at some tools that will provide you with part of what you need to make the move from Windows to Linux. While these tools may not seem to be specifically developer focused, their goal is to facilitate the ease of migration for your applications from Windows to Linux.

Let's begin with some WINE

Wine Is Not an Emulator (or Wine) is an open source implementation of the Windows programming interfaces designed to be used on Linux and other flavors of Unix (for the remainder of this article when referring to Linux as a target environment, this should be taken to include other Unix variations). If you'd like to check out the Wine web site please be sure to visit http://www.winehq.org (http://www.wine.org is also an interesting site, especially if you have an interest in French wines, but will be of little use in your Porting and Migration effort unless?). Wine takes a twofold approach to allowing for the porting or migration of Windows applications to Linux by providing not only an environment that allows you to install and execute Windows binaries, but also a very rich programming interface (Winelib).

Just install and run

The Wine execution environment allows many Windows (this includes Win32, Win16 and also DOS) applications to be installed on a Linux system and run using the Wine emulator. This allows you to take applications directly from Windows to Linux transparently, without the need to have access to source code or make changes to how the applications is run. For more about using Wine to execute non-modified Windows applications please see http://www.novell.com/coolsolutions/cooldev/features/a_from_windows_via_wine_cdev.html.

How about a dual-boot scenario?

Wine also allows you to leverage an existing Windows installation in a dual-boot situation. By modifying Wine's configuration files, you can have Wine execute your Windows applications installed on a Windows partition on your hard drive without the need to load Windows.

This is very useful for developers since it allows you to evaluate your application in both environments and determine the best possible setup for your users. You can also manage the transition from Windows to Linux and not disrupt your users by allowing them to use both Windows and Linux using the same installation of the application.

The major drawback to this method of using Wine is that you still are required to have a license for the Windows installation you are using. This is a scenario you need to evaluate to determine if it is the right way for you to go.

So, what if you don't mind re-compiling?

Okay, so you have the source code to the application you wish to migrate to Linux from Windows. Why not take advantage of recompiling it to remove the need to run the application through the Wine runtime environment? You can gain significant advantages in speed and also the benefits of being able to leverage the native Linux. This last benefit also would allow your application to be run on hardware not supported by Windows, but supported by Linux.

Winelib is a development toolkit that allows you to recompile your Win32 application to run on Linux. You should note that it specifically targets Win32 and does not support 16-bit Windows applications due to issues with Win16-type requirements not being supported within the Linux development environment.

To aid with the conversion of your Windows-based project to Winelib, a perl script, Winemaker, is provided with Winelib. Winemaker does an analysis of your code, fixes many of the issues that are problematic moving code from Windows to other operating systems, and can generate makefiles to help in the build process. Winemaker takes care of the major hurdles in the conversion process by fixing the case of your filenames and references to them within your source code (Linux/Unix is case-sensitive while Windows is not) and changes the '\' characters to '/' to insure paths to files are working correctly.

What if my application relies on MFC?

Winelib also provides a means of handling applications that require Windows MFC. You must recompile the Windows MFC from source code using Winelib. The Winelib User's Guide provides a section on dealing with MFC, right down to what you must do to insure that you are licensed to recompile and redistribute code containing MFC.

It also gives recommendations on actually compiling MFC with Winelib.

Wine for the Enterprise

Now many companies will resist the use of a project such as Wine because of a lack of formal support and development. One thing to consider is that Wine has been around for a long time. It began in 1993 as a way for users to run Windows 3.1 applications on the then-emerging Linux platform. It has grown as Linux and Windows have grown to providing additional support such as for Win32 as it was developed and became widely used.

The Wine website contains links to a database of over 2000 Windows-based applications and their current status regarding Wine compatibility. The applications listed are rated by how well they run if installed in a Windows environment and executed through Wine or if they are installed in a Wine-only environment.

But if you still find the need for someone to call if you have a problem, there are some solutions that use Wine and provide support as well. CrossOver Office from CodeWeavers (http://www.codeweavers.com/) and Cedega (formerly known as WineX) from TransGaming Technologies (http://www.transgaming.com) are both commercial implementations of Wine that provide users with support options and extended documentation.

CrossOver Office is primarily focused on productivity software (Microsoft Office, Lotus Notes and other similar applications) and other popular applications such as Macromedia's Dreamweaver MX and Flash MX and Adobe Photoshop. Along with that, CrossOver provides support for many web browser plugins like QuickTime and Shockwave.

CrossOver Office is available in a number of versions to fit a variety of licensing needs, including a server-based version.

Cedega is a subscription-based version of Wine that adds additional support for DirectX, the Windows-based gaming API's. Nearly all games created for Windows currently use Microsoft's DirectX API for video, sound, networking, etc., and TransGaming has brought support for DirectX to Linux. TransGaming lists over 300 games as being supported by Cedega, including many of the latest titles such as Electronic Art's Battlefield Vietnam and NCSoft's online game, City of Heroes.

Now you might be saying, "Gaming, who cares?" Well, gaming is a massive industry and many users will be reluctant to make the migration to a desktop that doesn't support gaming.

Look for more in-depth articles on both CrossOver Office and Cedega here in the near future.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© Micro Focus