6
B eyond the easily replaceable large office and graphics packages, the market bustles with countless, typically smaller programs that cater to the needs of small- to medium-sized niches. Commonly, companies or govern- ment offices create their own custom, mission-critical applications. The famous Wine system libraries [1] provide a means for running Windows applications from within Linux. Right now, version 1.4 is the stable release, and development release 1.5.6 is also available. Configuring Wine has completely changed in the course of the years. Al- though Wine was once regarded as complicated, it has become significantly easier and clearer, and it handles many annoying details that were formerly left to the admin. These details that once caused grief and are now rel- atively painless include integrating removable devices such as DVDs or integrating the CUPS printing sys- tem. An equally significant change in the architecture of Wine was the in- troduction of prefixes (since 2003, also known as bottles). Setting up a prefix means you can install and op- erate Windows software within a pre-defined context without conflict- ing with other software. A recent project at the Robert Musil Institute of the University of Klagenfurt provides an interesting case study for Wine in the real world. The institute recently pro- duced a new edition of the works of Austrian author Robert Musil (Figure 1). The electronic version of this new edition is based on the Folio Views application, which only runs on Win- dows. We used Wine to create a ver- sion that can easily launch from Linux. (See the box titled “Virtual: Robert Musil in Klagenfurt.”) Decant and Install Wine is quickly installed on any pop- ular distribution, and Ubuntu’s re- pository proves particularly friendly. Building a Wine environment for Windows applications Versatile Vintage More and more Windows applications run on Linux thanks to Wine. If you spend a little time on configuration and troubleshooting, you won’t be stuck in Windows – even with applications that no one dreamed would run on Linux. By Harald Jele Figure 1: A graffiti portrait of Robert Musil at the “Musilhaus” in Klagenfurt. Dr. Harald Jele works for the University of Klagenfurt and is currently engaged with the technical aspects of putting Klagenfurt author Robert Musil’s works on Linux, Mac OS X, and the network. AUTHOR WINE 14 Configure your Wine environment for trouble-free Windows app execution. EXT2FSD 22 Connect to Linux filesystems from Windows. CROSSOVER 26 The other way to run Windows apps without Windows. COVER STORIES 14 COVER STORIES Practical Wine AUGUST 2012 ISSUE 141 LINUX-MAGAZINE.COM | LINUXPROMAGAZINE.COM

Building a Wine environment for Windows applications ...€¦ · 02 02 Wine1.2‑gecko ‑ Microsoft Windows compatibility layer (web browser) 03 03 Wine1.2‑gecko ‑ Microsoft

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Building a Wine environment for Windows applications ...€¦ · 02 02 Wine1.2‑gecko ‑ Microsoft Windows compatibility layer (web browser) 03 03 Wine1.2‑gecko ‑ Microsoft

Beyond the easily replaceable large office and graphics packages the market bustles with countless typically smaller programs that cater to the needs of small- to medium-sized niches Commonly companies or govern-

ment offices create their own custom mission-critical applicationsThe famous Wine system libraries [1] provide a means for running

Windows applications from within Linux Right now version 14 is the stable release and development release 156 is also available

Configuring Wine has completely changed in the course of the years Al-though Wine was once regarded as complicated it has become significantly easier and clearer and it handles many annoying details that were formerly left

to the admin These details that once caused grief and are now rel-atively painless include integrating removable devices such as DVDs or integrating the CUPS printing sys-tem

An equally significant change in the architecture of Wine was the in-troduction of prefixes (since 2003 also known as bottles) Setting up a prefix means you can install and op-erate Windows software within a pre-defined context without conflict-ing with other software

A recent project at the Robert Musil Institute of the University of Klagenfurt provides an interesting case study for Wine in the real world The institute recently pro-duced a new edition of the works of Austrian author Robert Musil (Figure 1) The electronic version of this new edition is based on the Folio Views application which only runs on Win-dows We used Wine to create a ver-sion that can easily launch from Linux (See the box titled ldquoVirtual Robert Musil in Klagenfurtrdquo)

Decant and InstallWine is quickly installed on any pop-ular distribution and Ubuntursquos re-pository proves particularly friendly

Building a Wine environment for Windows applications

Versatile VintageMore and more Windows applications run on Linux thanks to Wine If you spend a little

time on configuration and troubleshooting you wonrsquot be stuck in Windows ndash even

with applications that no one dreamed would run on Linux By Harald Jele

Figure 1 A graffiti portrait of Robert Musil at the

ldquoMusilhausrdquo in Klagenfurt

Dr Harald Jele works for the University of Klagenfurt and is currently engaged with the technical aspects of putting Klagenfurt author Robert Musilrsquos works on Linux Mac OS X and the network

Author

WIne 14 Configure your Wine environment for trouble-free Windows app execution

ext2fsD 22 Connect to Linux filesystems from Windows

Crossover 26 The other way to run Windows apps without Windows

CoVeR StoRIeS

14

CoVeR StoRIeSPractical Wine

August 2012 Issue 141 lInux-mAgAzInecom | lInuxpromAgAzInecom

Setting up the wine meta-package with the Apt package man-

ager takes into account the necessary libraries and core appli-cations and also provides the necessary configuration tools in-tegrating Gecko to render HTML views and frequently used fonts from the Windows environment

For a list of available versions search with apt‑cache search wine or aptitude search wine (Listing 1)

Creating a PrefixA prefix creates a virtual environment with custom settings for running a Win-dows application on Wine Wine always creates a prefix if a prefix is needed but not available However the admin can ndash and should ndash explicitly create a prefix in advance Wineboot uses the command

env WINEPREFIX=~name_of_prefix wineboot ‑u

to set the Wine prefix name_of_prefix as the directory structure in the userrsquos home directory Creating a prefix makes it relatively safe to experiment without the user running the risk of trashing the entire software installation with a simple action Careful use of a prefix puts the dreaded Windows system ldquoinstallation death battlesrdquo firmly in the past Also parallel use of software that would na-

tively conflict using Windows on the same computer is now possible because each program believes it has exclusive use of the system

Once a prefix is suitably created and configured you can easily copy it to your new home directory when you

move to a different computer ndash and this also works in multiuser operations The admin just has to maintain the structure of the files

and directories or else correctly create a new structure The best approach is to issue the

command

tar cfzv name_of_prefixtgz name_of_prefix

to prepare the directory with the prefix for the move Then unpack by running tar xfzv in the home direc-

tory of the desired userIf you do not create your own prefix or if you forget to

point to a prefix when you launch a program the results of

The Klagenfurt edition of Robert Musilrsquos works was released in 2009 as an electronic edition on DVD ndash the project used Folio Views a Windows application (Figure 2) To extend the group of potential users the institute decided to offer the second edition which will be published in 2013 with major additions to the con-tent and corrections on Linux with Wine as a pre-built installa-tion in a VirtualBox [16]

In particular the project stakeholders aimed to address users who prefer Linux and Mac OS X Additionally the configuration supports simple integration into a local area network without the need to invest in additional software

vIrtuAl robert Musil in Klagenfurt

Figure 2 the digital version of the entire works of Klagenfurt writer Robert Musil published by

the University of Klagenfurt with Folio Views Wine Linux and VirtualBox

15

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012

admin intervention Wine only shows CD-ROM and DVD drives if they are mounted on the Linux system

A parallel exploration of the prefix di-rectory with Linux tools quickly reveals what is essentially a self-explanatory di-rectory structure ~name_of_prefixdrive_c maps the ldquobootedrdquo hard disk of a typical Windows installation ~name_of_prefixdosdrives lists the drives cre-ated along with their drive letter assign-ments

regeditUsers launch the Wine Regedit tool (Fig-ure 4) with the following command

env WINEPREFIX=~name_of_prefix U

wine Cwindowsregeditexe

The command edits the systemrsquos prefix-specific Registry The tool stores the values that you inspected or edited values in three files below ~name_of_prefix systemreg userreg and userdefreg Even if the temptation is great hard-core shell users should steer clear of these files and use Regedit The Wine wiki provides a handy overview of the Reg-edit boot options [4]

From now on the nerve center for any further configuration of the prefix is the graphical Wine tool winecfg which users can launch by typing

env WINEPREFIX= ~name_of_prefix winecfg

On the one hand this GUI provides a convenient approach to configuring Winersquos behavior and on the other hand it also launches or installs applications That said if you want full control over the installation process there is no alternative to the command-line programs

A Matter of taste native or Built-inThe wine installation puts a considerable number of libraries (DLLs) on the target machine Most of these libraries were re-engineered by the Wine developers which often removes the need to own a Windows license Because these DLLs cover many system calls many applications will work without much assistance If something fails it is often helpful to check out the winecfg applicationrsquos Libraries tab which lets you change the order Wine loads Windows libraries

You can expect headaches after a Wine installation if the supplied libraries fail to provide essential functions for a spe-cific application In this case it is necessary to integrate and use the native DLLs provided by the Microsoft Windows in-stallation instead of the DLLs that come with Wine The winecfg toolrsquos Libraries tab lets you specify native Microsoft libraries

Here one needs to use the Microsoft cfgmgr32 DLL which the admin will have to dig out from a Windows instance and plant in the right position in the Wine directory structure This means the file from the Windows cwindowssystem32cfg‑

all activities will land in the wine subdirectory of the userrsquos home directory (~wine) and the user will have to live with-out prefix benefits

simulated restartWineboot basically performs the same actions a Windows sys-tem would The full range of Wineboot options is described at the Wine project website [2] The directory structure gener-ated by Wineboot gives you a working environment that the admin can inspect more closely with standard Wine tools The command

env WINEPREFIX=~name_of_prefix wine Cwindowsexplorerexe

executes the built-in Explorer in Wine and presents the view of the Wine server on the mounted filesystems along with the files it contains (Figure 3)

Wine Explorer gives the admin an option for verifying that the filesystems are mounted in the desired way when creating or updating the current Wine prefix ndash that is when specifying the correct drive letter from the Windows world Without

01 Playonlinux 01 ‑ Frontend for wine

02 02 Wine12‑gecko ‑ Microsoft Windows compatibility layer (web browser)

03 03 Wine12‑gecko ‑ Microsoft Windows compatibility layer (web browser)

04

05 05 q4wine ‑ Qt4 GUI for wine (WINE)

06 06 Wine ‑ Microsoft Windows Compatibility Layer (Meta Package)

07 07 Wine12 Microsoft Windows Compatibility Layer (Binary Emulator and Library)

08 08Wine12‑dbg ‑ Microsoft Windows Compatibility Layer (debugging symbols)

09 09 wine12‑dev ‑ Microsoft Windows Compatibility Layer (Development files)

10

11 11 winetricks ‑ Microsoft Windows Compatibility Layer (winetricks)

12 12 gnome‑exe‑thumbnailer ‑ Wine exe and other executable thumbnailer for Gnome

13 13separate wine settings

14 14 Wine13 ‑ Microsoft Windows compatibility layer (Binary Emulator and Library)

15 15 wine13‑dbg ‑ Microsoft Windows Compatibility Layer (debugging symbols)

16 16 wine13‑dev ‑ Microsoft Windows Compatibility Layer (Development files)

17

lIstIng 1 Wine Packages on ubuntu 1110

Figure 3 the built-in Wine explorer is perfect for testing a fresh

installation

16

CoVeR StoRIeSPractical Wine

August 2012 Issue 141 lInux-mAgAzInecom | lInuxpromAgAzInecom

mgr32dll directory ended up in the Wine prefix below ~name_of_prefixdrive_cwindowssystem32

Cozy CoexistenceThis change leaves the following entry in the userreg file and a corresponding entry in the Registry

[SoftwareWineDllOverrides] 1320056438 U

cfgmgr32=nativebuiltin

enabling Wine to emulate the behavior that Microsoft intro-duced in Windows XP known as side-by-side (SxS) [5] The cwindowsWinSxS directory contains several versions of the same system library side-by-side broken down by subdirecto-ries Windows applications can request clearly specified ver-sions from the system

Installation routines quite often make use of this ability If an application install fails and no special information is available on the reasons for the failure replacing this directory with the equivalent directory from a Windows installation can be use-ful at least for the duration of the install

However special caution is advised System libraries are quickly replaced entire directories and tools are expeditiously modified and tools such as Winetricks [6] dump a plethora of free Microsoft files into the Wine environment This behavior is not always comprehensible therefore the Wine developers often warn users If you expect help from the community you should refrain from ldquoenhancingrdquo your installation with too many DLLs [7] Installing a Windows application is something users should tackle without in-depth manipulation of the sys-tem

launching ApplicationsUse the following command to launch the typical Windows Setup program for a custom ap-plication or game from a DVD drive mapped to the drive letter D at the command line

env WINEPREFIX=~name_of_prefix U

wine DSetupexe

Wine also offers other mecha-nisms for starting programs The

official syntax according to the Wine wiki is

env WINEPREFIX=~name_of_prefix wine U

start DSetupexe

Or you can use the Unix convention for the pathname

env WINEPREFIX=~name_of_prefix start U

Unix mediaSetupexe

The second variant is recommended especially if the installation routine

or the program does not implement individual paths properly [8]

If the Setup program completes without canceling the chances are good that the installation has worked In this case Wine works just like Windows would If the installation calls for an entry on the desktop with a (linked) icon Wine provides it and an entry appears in the Linux desktop menu for Wine the installed programs are located below this menu

gather InformationIf the installation fails or the Windows application will not launch the following are useful troubleshooting techniques ndash preferably consulted before you start initial testingbull ChecktoseewhethertheapplicationisenteredintheCom-

patibility Database by the commercial Wine developers CodeWeavers [9]

bull LookforanansweronthewebManyattemptsndashsuccessesand failures ndash are documented online but not registered with CodeWeavers

bull InstalltheprogramonanativeWindowsinstanceforthesake of comparison

bull UsethespecialWineDebugger[10]Working with a parallel Windows instance requires some prep-aration because the aim is to capture the details of the installa-tion process and the way the application is called Your tool of choice should log the installation telling you which directories files and Registry entries the installation routine creates and what libraries it adds to the system Even if you can achieve this with a modicum of manual work software such as the free TrackWinstall (Figure 5) [11] offers the same service and some convenience on top

It is ideal to have a tool that after monitoring an installation process creates the directories and files the new Registry en-

Figure 4 Wine comes with its own Registry editor

Figure 5 the results list shows all the changes found on a Windows installation by trackWinstall

17

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012

Hell clearly demonstrates that continuously replacing libraries is an approach with limitations ndash not all versions of the system libraries will cooperate nicely When you reach this point any action you take requires skill research luck and ndash last but not least ndash patience

To access debug information easily pass in the WINEDEBUG en-vironment variable at launch time The value +relay in Wine debug mode outputs all function calls and descriptions of the associated libraries on the console This gives the admin some initial information as to which function call is causing Wine to fail and what DLL is responsible for it

If you redirect standard output into a logfile you can then analyze the startup process in your own good time

env WINEPREFIX=~name_of_prefix WINEDEBUG=+relay wine U

applicationexeampgtdebuglog

tries and the relevant system libraries and lets you easily ex-port them directly into a plain vanilla Wine environment If you then avoid reinstalling you can launch the application via the commands or icons described above

If this approach fails a more in-depth inspection of the appli-cationrsquos activity in the parallel Windows installation is then necessary The first step is to start the application and check the system libraries it loads when launched Simple tools are fine for this task many of these tools are available as freeware or as demo versions for limited free use DLL Show [12] is a veteran already but it still provides good service and reliably reveals applications and associated libraries loaded in the oper-ating systemrsquos memory space

A similar service is provided by Process Info [13] which is free for 30 days of use (Figure 6) The limitations of this tempo-rary version compared with the full version will be irrelevant to most Linux users especially because the tool can be in-stalled and executed in a Wine environment

On the basis of the list of libraries the monitored soft-ware loads admins can gain an initial impression of what they need to pay attention to The output in the launch console might already reveal whether a Wine library fails to offer an application all the relevant functions and thus has to be replaced with a na-tive version In any case loading the Wine Debugger when starting the application should help

CuveacuteeA scenario that Windows ad-ministrators refer to as DLL

Figure 6 Process Info lists the DLLs linked to a Windows executable

Figure 7 Launching a Wine application with the WINEDEBUG=+relay environment variable set generates a

huge volume of output

18

CoVeR StoRIeSPractical Wine

August 2012 Issue 141 lInux-mAgAzInecom | lInuxpromAgAzInecom

The +all parameter for the environment vari-able WINEDEBUG (Figure 7) makes the debugger far more talkative

env WINEPREFIX=~name_of_prefix U

WINEDEBUG=+relay wine applicationexeampgtU

start_applicationlog

Wine then routes all the information accessi-ble in debug mode to standard output This significantly delays the application start but once you gain a little practice this approach can give you a far more in-depth impression of the implemented mechanisms and the pitfalls which you can then try to circumvent

In addition to setting the WINEDEBUG environ-mental variable you can also directly launch an application with the built-in Wine debugger

env WINEPREFIX=~name_of_prefix U

winedbg applicationexe

The Wine debugger gives experienced testers the familiar de-bugging capabilities from within the Wine system library envi-ronment Admins thus have an extensive range of methods for launching applications in a controlled manner

The similarities to other debuggers are not coincidental the commands implemented by the Wine debugger (Figure 8) are a subset of the GNU Project debugger (GDB) The developer website on Wine debugging [10] has a good overview of a sys-tematic approach to an unknown problem that occurs when trying to run a Windows application in a Wine environment

CodeWeavers ndash the Master vintnersIf all this debugging and testing has not helped you get an ap-plication on Linux and Wine running you still have a couple of other options With the motto ldquoLittle guys trying to change the computing world for other little guysrdquo CodeWeavers [14] drives the integration of Windows applications in Wine Al-though the products CrossOver and CrossOver Games are com-mercial and closed source they walk many users ndash and espe-cially gamers ndash through the process of talking Microsoft appli-cations into running on Linux See the article on CrossOver that appears elsewhere in this issue

Also useful with the added benefit of being free and open source is the PlayOnLinux project (POL) [15] which is in-cluded with most distributions and comes with its own graphi-cal front end for Wine The long list of supported software comprises games and programs such as AutoCAD CATIA Mi-crosoft Office iTunes Googlersquos SketchUp and Adobersquos Photo-shop and Dreamweaver If the application in which you are in-terested is not listed in the PlayOnLinux GUI searching for a POL file in the online repository could help Incidentally Play-OnLinux also uses Wine prefixes which can prevent unwanted interaction with other games and programs

Windows to new WorldsCombinations such as Wine Linux and VirtualBox allow for a complete and platform-independent open-source solution that lets you lock non-Linux applications into a container for per-manent keeping Templates containing everything necessary for operations can easily be launched moved or simply in-stalled by copying And if this isnrsquot enough you can reroute the output from the virtual instances using protocols such as VNC RDP or NX thus giving ancient Windows applications multiuser and networking capabilities nnn

Figure 8 Wine Debugger supported commands

[1] Wine headquarters http wiki winehq org

[2] Description of Wineboot http wiki winehq org wineboot

[3] Wine DIB engine http wiki winehq org DIBEngine

[4] Description of Regedit http wiki winehq org regedit

[5] Microsoftrsquos description of side-by-side assemblies (SxS) http msdn microsoft com en‑us library aa376307 aspx

[6] Winetricks http www winetricks org

[7] Details on Winetricks from the Wine wiki http wiki winehq org winetricks

[8] Command-line options in Wine http wiki winehq org FAQ head‑3b297df7a5411abe2b8d37fead01a2b8edc21619

[9] CodeWeavers Crossover Compatibility Center (CCCC) http www codeweavers com compatibility

[10] Wine debugger how-to http www winehq org docs winedev‑guide wine‑debugger

[11] TrackWinstall ftp ftp heise de pub ct ctsi trackwinstall_111 zip

[12] DLL Show http www gregorybraun com DLLShow html

[13] Process Info http www jobe‑software de en index_en htm

[14] CodeWeavers http www codeweavers com

[15] PlayOnLinux http www playonlinux com

[16] Jele H Robert Musil und das Matroschka‑Prinzip httpwwwuuni‑kluacathjelepublikationencontainer_ka_201320111114_matroschka_rmipdf (in German)

Info

19

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012

Page 2: Building a Wine environment for Windows applications ...€¦ · 02 02 Wine1.2‑gecko ‑ Microsoft Windows compatibility layer (web browser) 03 03 Wine1.2‑gecko ‑ Microsoft

Setting up the wine meta-package with the Apt package man-

ager takes into account the necessary libraries and core appli-cations and also provides the necessary configuration tools in-tegrating Gecko to render HTML views and frequently used fonts from the Windows environment

For a list of available versions search with apt‑cache search wine or aptitude search wine (Listing 1)

Creating a PrefixA prefix creates a virtual environment with custom settings for running a Win-dows application on Wine Wine always creates a prefix if a prefix is needed but not available However the admin can ndash and should ndash explicitly create a prefix in advance Wineboot uses the command

env WINEPREFIX=~name_of_prefix wineboot ‑u

to set the Wine prefix name_of_prefix as the directory structure in the userrsquos home directory Creating a prefix makes it relatively safe to experiment without the user running the risk of trashing the entire software installation with a simple action Careful use of a prefix puts the dreaded Windows system ldquoinstallation death battlesrdquo firmly in the past Also parallel use of software that would na-

tively conflict using Windows on the same computer is now possible because each program believes it has exclusive use of the system

Once a prefix is suitably created and configured you can easily copy it to your new home directory when you

move to a different computer ndash and this also works in multiuser operations The admin just has to maintain the structure of the files

and directories or else correctly create a new structure The best approach is to issue the

command

tar cfzv name_of_prefixtgz name_of_prefix

to prepare the directory with the prefix for the move Then unpack by running tar xfzv in the home direc-

tory of the desired userIf you do not create your own prefix or if you forget to

point to a prefix when you launch a program the results of

The Klagenfurt edition of Robert Musilrsquos works was released in 2009 as an electronic edition on DVD ndash the project used Folio Views a Windows application (Figure 2) To extend the group of potential users the institute decided to offer the second edition which will be published in 2013 with major additions to the con-tent and corrections on Linux with Wine as a pre-built installa-tion in a VirtualBox [16]

In particular the project stakeholders aimed to address users who prefer Linux and Mac OS X Additionally the configuration supports simple integration into a local area network without the need to invest in additional software

vIrtuAl robert Musil in Klagenfurt

Figure 2 the digital version of the entire works of Klagenfurt writer Robert Musil published by

the University of Klagenfurt with Folio Views Wine Linux and VirtualBox

15

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012

admin intervention Wine only shows CD-ROM and DVD drives if they are mounted on the Linux system

A parallel exploration of the prefix di-rectory with Linux tools quickly reveals what is essentially a self-explanatory di-rectory structure ~name_of_prefixdrive_c maps the ldquobootedrdquo hard disk of a typical Windows installation ~name_of_prefixdosdrives lists the drives cre-ated along with their drive letter assign-ments

regeditUsers launch the Wine Regedit tool (Fig-ure 4) with the following command

env WINEPREFIX=~name_of_prefix U

wine Cwindowsregeditexe

The command edits the systemrsquos prefix-specific Registry The tool stores the values that you inspected or edited values in three files below ~name_of_prefix systemreg userreg and userdefreg Even if the temptation is great hard-core shell users should steer clear of these files and use Regedit The Wine wiki provides a handy overview of the Reg-edit boot options [4]

From now on the nerve center for any further configuration of the prefix is the graphical Wine tool winecfg which users can launch by typing

env WINEPREFIX= ~name_of_prefix winecfg

On the one hand this GUI provides a convenient approach to configuring Winersquos behavior and on the other hand it also launches or installs applications That said if you want full control over the installation process there is no alternative to the command-line programs

A Matter of taste native or Built-inThe wine installation puts a considerable number of libraries (DLLs) on the target machine Most of these libraries were re-engineered by the Wine developers which often removes the need to own a Windows license Because these DLLs cover many system calls many applications will work without much assistance If something fails it is often helpful to check out the winecfg applicationrsquos Libraries tab which lets you change the order Wine loads Windows libraries

You can expect headaches after a Wine installation if the supplied libraries fail to provide essential functions for a spe-cific application In this case it is necessary to integrate and use the native DLLs provided by the Microsoft Windows in-stallation instead of the DLLs that come with Wine The winecfg toolrsquos Libraries tab lets you specify native Microsoft libraries

Here one needs to use the Microsoft cfgmgr32 DLL which the admin will have to dig out from a Windows instance and plant in the right position in the Wine directory structure This means the file from the Windows cwindowssystem32cfg‑

all activities will land in the wine subdirectory of the userrsquos home directory (~wine) and the user will have to live with-out prefix benefits

simulated restartWineboot basically performs the same actions a Windows sys-tem would The full range of Wineboot options is described at the Wine project website [2] The directory structure gener-ated by Wineboot gives you a working environment that the admin can inspect more closely with standard Wine tools The command

env WINEPREFIX=~name_of_prefix wine Cwindowsexplorerexe

executes the built-in Explorer in Wine and presents the view of the Wine server on the mounted filesystems along with the files it contains (Figure 3)

Wine Explorer gives the admin an option for verifying that the filesystems are mounted in the desired way when creating or updating the current Wine prefix ndash that is when specifying the correct drive letter from the Windows world Without

01 Playonlinux 01 ‑ Frontend for wine

02 02 Wine12‑gecko ‑ Microsoft Windows compatibility layer (web browser)

03 03 Wine12‑gecko ‑ Microsoft Windows compatibility layer (web browser)

04

05 05 q4wine ‑ Qt4 GUI for wine (WINE)

06 06 Wine ‑ Microsoft Windows Compatibility Layer (Meta Package)

07 07 Wine12 Microsoft Windows Compatibility Layer (Binary Emulator and Library)

08 08Wine12‑dbg ‑ Microsoft Windows Compatibility Layer (debugging symbols)

09 09 wine12‑dev ‑ Microsoft Windows Compatibility Layer (Development files)

10

11 11 winetricks ‑ Microsoft Windows Compatibility Layer (winetricks)

12 12 gnome‑exe‑thumbnailer ‑ Wine exe and other executable thumbnailer for Gnome

13 13separate wine settings

14 14 Wine13 ‑ Microsoft Windows compatibility layer (Binary Emulator and Library)

15 15 wine13‑dbg ‑ Microsoft Windows Compatibility Layer (debugging symbols)

16 16 wine13‑dev ‑ Microsoft Windows Compatibility Layer (Development files)

17

lIstIng 1 Wine Packages on ubuntu 1110

Figure 3 the built-in Wine explorer is perfect for testing a fresh

installation

16

CoVeR StoRIeSPractical Wine

August 2012 Issue 141 lInux-mAgAzInecom | lInuxpromAgAzInecom

mgr32dll directory ended up in the Wine prefix below ~name_of_prefixdrive_cwindowssystem32

Cozy CoexistenceThis change leaves the following entry in the userreg file and a corresponding entry in the Registry

[SoftwareWineDllOverrides] 1320056438 U

cfgmgr32=nativebuiltin

enabling Wine to emulate the behavior that Microsoft intro-duced in Windows XP known as side-by-side (SxS) [5] The cwindowsWinSxS directory contains several versions of the same system library side-by-side broken down by subdirecto-ries Windows applications can request clearly specified ver-sions from the system

Installation routines quite often make use of this ability If an application install fails and no special information is available on the reasons for the failure replacing this directory with the equivalent directory from a Windows installation can be use-ful at least for the duration of the install

However special caution is advised System libraries are quickly replaced entire directories and tools are expeditiously modified and tools such as Winetricks [6] dump a plethora of free Microsoft files into the Wine environment This behavior is not always comprehensible therefore the Wine developers often warn users If you expect help from the community you should refrain from ldquoenhancingrdquo your installation with too many DLLs [7] Installing a Windows application is something users should tackle without in-depth manipulation of the sys-tem

launching ApplicationsUse the following command to launch the typical Windows Setup program for a custom ap-plication or game from a DVD drive mapped to the drive letter D at the command line

env WINEPREFIX=~name_of_prefix U

wine DSetupexe

Wine also offers other mecha-nisms for starting programs The

official syntax according to the Wine wiki is

env WINEPREFIX=~name_of_prefix wine U

start DSetupexe

Or you can use the Unix convention for the pathname

env WINEPREFIX=~name_of_prefix start U

Unix mediaSetupexe

The second variant is recommended especially if the installation routine

or the program does not implement individual paths properly [8]

If the Setup program completes without canceling the chances are good that the installation has worked In this case Wine works just like Windows would If the installation calls for an entry on the desktop with a (linked) icon Wine provides it and an entry appears in the Linux desktop menu for Wine the installed programs are located below this menu

gather InformationIf the installation fails or the Windows application will not launch the following are useful troubleshooting techniques ndash preferably consulted before you start initial testingbull ChecktoseewhethertheapplicationisenteredintheCom-

patibility Database by the commercial Wine developers CodeWeavers [9]

bull LookforanansweronthewebManyattemptsndashsuccessesand failures ndash are documented online but not registered with CodeWeavers

bull InstalltheprogramonanativeWindowsinstanceforthesake of comparison

bull UsethespecialWineDebugger[10]Working with a parallel Windows instance requires some prep-aration because the aim is to capture the details of the installa-tion process and the way the application is called Your tool of choice should log the installation telling you which directories files and Registry entries the installation routine creates and what libraries it adds to the system Even if you can achieve this with a modicum of manual work software such as the free TrackWinstall (Figure 5) [11] offers the same service and some convenience on top

It is ideal to have a tool that after monitoring an installation process creates the directories and files the new Registry en-

Figure 4 Wine comes with its own Registry editor

Figure 5 the results list shows all the changes found on a Windows installation by trackWinstall

17

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012

Hell clearly demonstrates that continuously replacing libraries is an approach with limitations ndash not all versions of the system libraries will cooperate nicely When you reach this point any action you take requires skill research luck and ndash last but not least ndash patience

To access debug information easily pass in the WINEDEBUG en-vironment variable at launch time The value +relay in Wine debug mode outputs all function calls and descriptions of the associated libraries on the console This gives the admin some initial information as to which function call is causing Wine to fail and what DLL is responsible for it

If you redirect standard output into a logfile you can then analyze the startup process in your own good time

env WINEPREFIX=~name_of_prefix WINEDEBUG=+relay wine U

applicationexeampgtdebuglog

tries and the relevant system libraries and lets you easily ex-port them directly into a plain vanilla Wine environment If you then avoid reinstalling you can launch the application via the commands or icons described above

If this approach fails a more in-depth inspection of the appli-cationrsquos activity in the parallel Windows installation is then necessary The first step is to start the application and check the system libraries it loads when launched Simple tools are fine for this task many of these tools are available as freeware or as demo versions for limited free use DLL Show [12] is a veteran already but it still provides good service and reliably reveals applications and associated libraries loaded in the oper-ating systemrsquos memory space

A similar service is provided by Process Info [13] which is free for 30 days of use (Figure 6) The limitations of this tempo-rary version compared with the full version will be irrelevant to most Linux users especially because the tool can be in-stalled and executed in a Wine environment

On the basis of the list of libraries the monitored soft-ware loads admins can gain an initial impression of what they need to pay attention to The output in the launch console might already reveal whether a Wine library fails to offer an application all the relevant functions and thus has to be replaced with a na-tive version In any case loading the Wine Debugger when starting the application should help

CuveacuteeA scenario that Windows ad-ministrators refer to as DLL

Figure 6 Process Info lists the DLLs linked to a Windows executable

Figure 7 Launching a Wine application with the WINEDEBUG=+relay environment variable set generates a

huge volume of output

18

CoVeR StoRIeSPractical Wine

August 2012 Issue 141 lInux-mAgAzInecom | lInuxpromAgAzInecom

The +all parameter for the environment vari-able WINEDEBUG (Figure 7) makes the debugger far more talkative

env WINEPREFIX=~name_of_prefix U

WINEDEBUG=+relay wine applicationexeampgtU

start_applicationlog

Wine then routes all the information accessi-ble in debug mode to standard output This significantly delays the application start but once you gain a little practice this approach can give you a far more in-depth impression of the implemented mechanisms and the pitfalls which you can then try to circumvent

In addition to setting the WINEDEBUG environ-mental variable you can also directly launch an application with the built-in Wine debugger

env WINEPREFIX=~name_of_prefix U

winedbg applicationexe

The Wine debugger gives experienced testers the familiar de-bugging capabilities from within the Wine system library envi-ronment Admins thus have an extensive range of methods for launching applications in a controlled manner

The similarities to other debuggers are not coincidental the commands implemented by the Wine debugger (Figure 8) are a subset of the GNU Project debugger (GDB) The developer website on Wine debugging [10] has a good overview of a sys-tematic approach to an unknown problem that occurs when trying to run a Windows application in a Wine environment

CodeWeavers ndash the Master vintnersIf all this debugging and testing has not helped you get an ap-plication on Linux and Wine running you still have a couple of other options With the motto ldquoLittle guys trying to change the computing world for other little guysrdquo CodeWeavers [14] drives the integration of Windows applications in Wine Al-though the products CrossOver and CrossOver Games are com-mercial and closed source they walk many users ndash and espe-cially gamers ndash through the process of talking Microsoft appli-cations into running on Linux See the article on CrossOver that appears elsewhere in this issue

Also useful with the added benefit of being free and open source is the PlayOnLinux project (POL) [15] which is in-cluded with most distributions and comes with its own graphi-cal front end for Wine The long list of supported software comprises games and programs such as AutoCAD CATIA Mi-crosoft Office iTunes Googlersquos SketchUp and Adobersquos Photo-shop and Dreamweaver If the application in which you are in-terested is not listed in the PlayOnLinux GUI searching for a POL file in the online repository could help Incidentally Play-OnLinux also uses Wine prefixes which can prevent unwanted interaction with other games and programs

Windows to new WorldsCombinations such as Wine Linux and VirtualBox allow for a complete and platform-independent open-source solution that lets you lock non-Linux applications into a container for per-manent keeping Templates containing everything necessary for operations can easily be launched moved or simply in-stalled by copying And if this isnrsquot enough you can reroute the output from the virtual instances using protocols such as VNC RDP or NX thus giving ancient Windows applications multiuser and networking capabilities nnn

Figure 8 Wine Debugger supported commands

[1] Wine headquarters http wiki winehq org

[2] Description of Wineboot http wiki winehq org wineboot

[3] Wine DIB engine http wiki winehq org DIBEngine

[4] Description of Regedit http wiki winehq org regedit

[5] Microsoftrsquos description of side-by-side assemblies (SxS) http msdn microsoft com en‑us library aa376307 aspx

[6] Winetricks http www winetricks org

[7] Details on Winetricks from the Wine wiki http wiki winehq org winetricks

[8] Command-line options in Wine http wiki winehq org FAQ head‑3b297df7a5411abe2b8d37fead01a2b8edc21619

[9] CodeWeavers Crossover Compatibility Center (CCCC) http www codeweavers com compatibility

[10] Wine debugger how-to http www winehq org docs winedev‑guide wine‑debugger

[11] TrackWinstall ftp ftp heise de pub ct ctsi trackwinstall_111 zip

[12] DLL Show http www gregorybraun com DLLShow html

[13] Process Info http www jobe‑software de en index_en htm

[14] CodeWeavers http www codeweavers com

[15] PlayOnLinux http www playonlinux com

[16] Jele H Robert Musil und das Matroschka‑Prinzip httpwwwuuni‑kluacathjelepublikationencontainer_ka_201320111114_matroschka_rmipdf (in German)

Info

19

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012

Page 3: Building a Wine environment for Windows applications ...€¦ · 02 02 Wine1.2‑gecko ‑ Microsoft Windows compatibility layer (web browser) 03 03 Wine1.2‑gecko ‑ Microsoft

admin intervention Wine only shows CD-ROM and DVD drives if they are mounted on the Linux system

A parallel exploration of the prefix di-rectory with Linux tools quickly reveals what is essentially a self-explanatory di-rectory structure ~name_of_prefixdrive_c maps the ldquobootedrdquo hard disk of a typical Windows installation ~name_of_prefixdosdrives lists the drives cre-ated along with their drive letter assign-ments

regeditUsers launch the Wine Regedit tool (Fig-ure 4) with the following command

env WINEPREFIX=~name_of_prefix U

wine Cwindowsregeditexe

The command edits the systemrsquos prefix-specific Registry The tool stores the values that you inspected or edited values in three files below ~name_of_prefix systemreg userreg and userdefreg Even if the temptation is great hard-core shell users should steer clear of these files and use Regedit The Wine wiki provides a handy overview of the Reg-edit boot options [4]

From now on the nerve center for any further configuration of the prefix is the graphical Wine tool winecfg which users can launch by typing

env WINEPREFIX= ~name_of_prefix winecfg

On the one hand this GUI provides a convenient approach to configuring Winersquos behavior and on the other hand it also launches or installs applications That said if you want full control over the installation process there is no alternative to the command-line programs

A Matter of taste native or Built-inThe wine installation puts a considerable number of libraries (DLLs) on the target machine Most of these libraries were re-engineered by the Wine developers which often removes the need to own a Windows license Because these DLLs cover many system calls many applications will work without much assistance If something fails it is often helpful to check out the winecfg applicationrsquos Libraries tab which lets you change the order Wine loads Windows libraries

You can expect headaches after a Wine installation if the supplied libraries fail to provide essential functions for a spe-cific application In this case it is necessary to integrate and use the native DLLs provided by the Microsoft Windows in-stallation instead of the DLLs that come with Wine The winecfg toolrsquos Libraries tab lets you specify native Microsoft libraries

Here one needs to use the Microsoft cfgmgr32 DLL which the admin will have to dig out from a Windows instance and plant in the right position in the Wine directory structure This means the file from the Windows cwindowssystem32cfg‑

all activities will land in the wine subdirectory of the userrsquos home directory (~wine) and the user will have to live with-out prefix benefits

simulated restartWineboot basically performs the same actions a Windows sys-tem would The full range of Wineboot options is described at the Wine project website [2] The directory structure gener-ated by Wineboot gives you a working environment that the admin can inspect more closely with standard Wine tools The command

env WINEPREFIX=~name_of_prefix wine Cwindowsexplorerexe

executes the built-in Explorer in Wine and presents the view of the Wine server on the mounted filesystems along with the files it contains (Figure 3)

Wine Explorer gives the admin an option for verifying that the filesystems are mounted in the desired way when creating or updating the current Wine prefix ndash that is when specifying the correct drive letter from the Windows world Without

01 Playonlinux 01 ‑ Frontend for wine

02 02 Wine12‑gecko ‑ Microsoft Windows compatibility layer (web browser)

03 03 Wine12‑gecko ‑ Microsoft Windows compatibility layer (web browser)

04

05 05 q4wine ‑ Qt4 GUI for wine (WINE)

06 06 Wine ‑ Microsoft Windows Compatibility Layer (Meta Package)

07 07 Wine12 Microsoft Windows Compatibility Layer (Binary Emulator and Library)

08 08Wine12‑dbg ‑ Microsoft Windows Compatibility Layer (debugging symbols)

09 09 wine12‑dev ‑ Microsoft Windows Compatibility Layer (Development files)

10

11 11 winetricks ‑ Microsoft Windows Compatibility Layer (winetricks)

12 12 gnome‑exe‑thumbnailer ‑ Wine exe and other executable thumbnailer for Gnome

13 13separate wine settings

14 14 Wine13 ‑ Microsoft Windows compatibility layer (Binary Emulator and Library)

15 15 wine13‑dbg ‑ Microsoft Windows Compatibility Layer (debugging symbols)

16 16 wine13‑dev ‑ Microsoft Windows Compatibility Layer (Development files)

17

lIstIng 1 Wine Packages on ubuntu 1110

Figure 3 the built-in Wine explorer is perfect for testing a fresh

installation

16

CoVeR StoRIeSPractical Wine

August 2012 Issue 141 lInux-mAgAzInecom | lInuxpromAgAzInecom

mgr32dll directory ended up in the Wine prefix below ~name_of_prefixdrive_cwindowssystem32

Cozy CoexistenceThis change leaves the following entry in the userreg file and a corresponding entry in the Registry

[SoftwareWineDllOverrides] 1320056438 U

cfgmgr32=nativebuiltin

enabling Wine to emulate the behavior that Microsoft intro-duced in Windows XP known as side-by-side (SxS) [5] The cwindowsWinSxS directory contains several versions of the same system library side-by-side broken down by subdirecto-ries Windows applications can request clearly specified ver-sions from the system

Installation routines quite often make use of this ability If an application install fails and no special information is available on the reasons for the failure replacing this directory with the equivalent directory from a Windows installation can be use-ful at least for the duration of the install

However special caution is advised System libraries are quickly replaced entire directories and tools are expeditiously modified and tools such as Winetricks [6] dump a plethora of free Microsoft files into the Wine environment This behavior is not always comprehensible therefore the Wine developers often warn users If you expect help from the community you should refrain from ldquoenhancingrdquo your installation with too many DLLs [7] Installing a Windows application is something users should tackle without in-depth manipulation of the sys-tem

launching ApplicationsUse the following command to launch the typical Windows Setup program for a custom ap-plication or game from a DVD drive mapped to the drive letter D at the command line

env WINEPREFIX=~name_of_prefix U

wine DSetupexe

Wine also offers other mecha-nisms for starting programs The

official syntax according to the Wine wiki is

env WINEPREFIX=~name_of_prefix wine U

start DSetupexe

Or you can use the Unix convention for the pathname

env WINEPREFIX=~name_of_prefix start U

Unix mediaSetupexe

The second variant is recommended especially if the installation routine

or the program does not implement individual paths properly [8]

If the Setup program completes without canceling the chances are good that the installation has worked In this case Wine works just like Windows would If the installation calls for an entry on the desktop with a (linked) icon Wine provides it and an entry appears in the Linux desktop menu for Wine the installed programs are located below this menu

gather InformationIf the installation fails or the Windows application will not launch the following are useful troubleshooting techniques ndash preferably consulted before you start initial testingbull ChecktoseewhethertheapplicationisenteredintheCom-

patibility Database by the commercial Wine developers CodeWeavers [9]

bull LookforanansweronthewebManyattemptsndashsuccessesand failures ndash are documented online but not registered with CodeWeavers

bull InstalltheprogramonanativeWindowsinstanceforthesake of comparison

bull UsethespecialWineDebugger[10]Working with a parallel Windows instance requires some prep-aration because the aim is to capture the details of the installa-tion process and the way the application is called Your tool of choice should log the installation telling you which directories files and Registry entries the installation routine creates and what libraries it adds to the system Even if you can achieve this with a modicum of manual work software such as the free TrackWinstall (Figure 5) [11] offers the same service and some convenience on top

It is ideal to have a tool that after monitoring an installation process creates the directories and files the new Registry en-

Figure 4 Wine comes with its own Registry editor

Figure 5 the results list shows all the changes found on a Windows installation by trackWinstall

17

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012

Hell clearly demonstrates that continuously replacing libraries is an approach with limitations ndash not all versions of the system libraries will cooperate nicely When you reach this point any action you take requires skill research luck and ndash last but not least ndash patience

To access debug information easily pass in the WINEDEBUG en-vironment variable at launch time The value +relay in Wine debug mode outputs all function calls and descriptions of the associated libraries on the console This gives the admin some initial information as to which function call is causing Wine to fail and what DLL is responsible for it

If you redirect standard output into a logfile you can then analyze the startup process in your own good time

env WINEPREFIX=~name_of_prefix WINEDEBUG=+relay wine U

applicationexeampgtdebuglog

tries and the relevant system libraries and lets you easily ex-port them directly into a plain vanilla Wine environment If you then avoid reinstalling you can launch the application via the commands or icons described above

If this approach fails a more in-depth inspection of the appli-cationrsquos activity in the parallel Windows installation is then necessary The first step is to start the application and check the system libraries it loads when launched Simple tools are fine for this task many of these tools are available as freeware or as demo versions for limited free use DLL Show [12] is a veteran already but it still provides good service and reliably reveals applications and associated libraries loaded in the oper-ating systemrsquos memory space

A similar service is provided by Process Info [13] which is free for 30 days of use (Figure 6) The limitations of this tempo-rary version compared with the full version will be irrelevant to most Linux users especially because the tool can be in-stalled and executed in a Wine environment

On the basis of the list of libraries the monitored soft-ware loads admins can gain an initial impression of what they need to pay attention to The output in the launch console might already reveal whether a Wine library fails to offer an application all the relevant functions and thus has to be replaced with a na-tive version In any case loading the Wine Debugger when starting the application should help

CuveacuteeA scenario that Windows ad-ministrators refer to as DLL

Figure 6 Process Info lists the DLLs linked to a Windows executable

Figure 7 Launching a Wine application with the WINEDEBUG=+relay environment variable set generates a

huge volume of output

18

CoVeR StoRIeSPractical Wine

August 2012 Issue 141 lInux-mAgAzInecom | lInuxpromAgAzInecom

The +all parameter for the environment vari-able WINEDEBUG (Figure 7) makes the debugger far more talkative

env WINEPREFIX=~name_of_prefix U

WINEDEBUG=+relay wine applicationexeampgtU

start_applicationlog

Wine then routes all the information accessi-ble in debug mode to standard output This significantly delays the application start but once you gain a little practice this approach can give you a far more in-depth impression of the implemented mechanisms and the pitfalls which you can then try to circumvent

In addition to setting the WINEDEBUG environ-mental variable you can also directly launch an application with the built-in Wine debugger

env WINEPREFIX=~name_of_prefix U

winedbg applicationexe

The Wine debugger gives experienced testers the familiar de-bugging capabilities from within the Wine system library envi-ronment Admins thus have an extensive range of methods for launching applications in a controlled manner

The similarities to other debuggers are not coincidental the commands implemented by the Wine debugger (Figure 8) are a subset of the GNU Project debugger (GDB) The developer website on Wine debugging [10] has a good overview of a sys-tematic approach to an unknown problem that occurs when trying to run a Windows application in a Wine environment

CodeWeavers ndash the Master vintnersIf all this debugging and testing has not helped you get an ap-plication on Linux and Wine running you still have a couple of other options With the motto ldquoLittle guys trying to change the computing world for other little guysrdquo CodeWeavers [14] drives the integration of Windows applications in Wine Al-though the products CrossOver and CrossOver Games are com-mercial and closed source they walk many users ndash and espe-cially gamers ndash through the process of talking Microsoft appli-cations into running on Linux See the article on CrossOver that appears elsewhere in this issue

Also useful with the added benefit of being free and open source is the PlayOnLinux project (POL) [15] which is in-cluded with most distributions and comes with its own graphi-cal front end for Wine The long list of supported software comprises games and programs such as AutoCAD CATIA Mi-crosoft Office iTunes Googlersquos SketchUp and Adobersquos Photo-shop and Dreamweaver If the application in which you are in-terested is not listed in the PlayOnLinux GUI searching for a POL file in the online repository could help Incidentally Play-OnLinux also uses Wine prefixes which can prevent unwanted interaction with other games and programs

Windows to new WorldsCombinations such as Wine Linux and VirtualBox allow for a complete and platform-independent open-source solution that lets you lock non-Linux applications into a container for per-manent keeping Templates containing everything necessary for operations can easily be launched moved or simply in-stalled by copying And if this isnrsquot enough you can reroute the output from the virtual instances using protocols such as VNC RDP or NX thus giving ancient Windows applications multiuser and networking capabilities nnn

Figure 8 Wine Debugger supported commands

[1] Wine headquarters http wiki winehq org

[2] Description of Wineboot http wiki winehq org wineboot

[3] Wine DIB engine http wiki winehq org DIBEngine

[4] Description of Regedit http wiki winehq org regedit

[5] Microsoftrsquos description of side-by-side assemblies (SxS) http msdn microsoft com en‑us library aa376307 aspx

[6] Winetricks http www winetricks org

[7] Details on Winetricks from the Wine wiki http wiki winehq org winetricks

[8] Command-line options in Wine http wiki winehq org FAQ head‑3b297df7a5411abe2b8d37fead01a2b8edc21619

[9] CodeWeavers Crossover Compatibility Center (CCCC) http www codeweavers com compatibility

[10] Wine debugger how-to http www winehq org docs winedev‑guide wine‑debugger

[11] TrackWinstall ftp ftp heise de pub ct ctsi trackwinstall_111 zip

[12] DLL Show http www gregorybraun com DLLShow html

[13] Process Info http www jobe‑software de en index_en htm

[14] CodeWeavers http www codeweavers com

[15] PlayOnLinux http www playonlinux com

[16] Jele H Robert Musil und das Matroschka‑Prinzip httpwwwuuni‑kluacathjelepublikationencontainer_ka_201320111114_matroschka_rmipdf (in German)

Info

19

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012

Page 4: Building a Wine environment for Windows applications ...€¦ · 02 02 Wine1.2‑gecko ‑ Microsoft Windows compatibility layer (web browser) 03 03 Wine1.2‑gecko ‑ Microsoft

mgr32dll directory ended up in the Wine prefix below ~name_of_prefixdrive_cwindowssystem32

Cozy CoexistenceThis change leaves the following entry in the userreg file and a corresponding entry in the Registry

[SoftwareWineDllOverrides] 1320056438 U

cfgmgr32=nativebuiltin

enabling Wine to emulate the behavior that Microsoft intro-duced in Windows XP known as side-by-side (SxS) [5] The cwindowsWinSxS directory contains several versions of the same system library side-by-side broken down by subdirecto-ries Windows applications can request clearly specified ver-sions from the system

Installation routines quite often make use of this ability If an application install fails and no special information is available on the reasons for the failure replacing this directory with the equivalent directory from a Windows installation can be use-ful at least for the duration of the install

However special caution is advised System libraries are quickly replaced entire directories and tools are expeditiously modified and tools such as Winetricks [6] dump a plethora of free Microsoft files into the Wine environment This behavior is not always comprehensible therefore the Wine developers often warn users If you expect help from the community you should refrain from ldquoenhancingrdquo your installation with too many DLLs [7] Installing a Windows application is something users should tackle without in-depth manipulation of the sys-tem

launching ApplicationsUse the following command to launch the typical Windows Setup program for a custom ap-plication or game from a DVD drive mapped to the drive letter D at the command line

env WINEPREFIX=~name_of_prefix U

wine DSetupexe

Wine also offers other mecha-nisms for starting programs The

official syntax according to the Wine wiki is

env WINEPREFIX=~name_of_prefix wine U

start DSetupexe

Or you can use the Unix convention for the pathname

env WINEPREFIX=~name_of_prefix start U

Unix mediaSetupexe

The second variant is recommended especially if the installation routine

or the program does not implement individual paths properly [8]

If the Setup program completes without canceling the chances are good that the installation has worked In this case Wine works just like Windows would If the installation calls for an entry on the desktop with a (linked) icon Wine provides it and an entry appears in the Linux desktop menu for Wine the installed programs are located below this menu

gather InformationIf the installation fails or the Windows application will not launch the following are useful troubleshooting techniques ndash preferably consulted before you start initial testingbull ChecktoseewhethertheapplicationisenteredintheCom-

patibility Database by the commercial Wine developers CodeWeavers [9]

bull LookforanansweronthewebManyattemptsndashsuccessesand failures ndash are documented online but not registered with CodeWeavers

bull InstalltheprogramonanativeWindowsinstanceforthesake of comparison

bull UsethespecialWineDebugger[10]Working with a parallel Windows instance requires some prep-aration because the aim is to capture the details of the installa-tion process and the way the application is called Your tool of choice should log the installation telling you which directories files and Registry entries the installation routine creates and what libraries it adds to the system Even if you can achieve this with a modicum of manual work software such as the free TrackWinstall (Figure 5) [11] offers the same service and some convenience on top

It is ideal to have a tool that after monitoring an installation process creates the directories and files the new Registry en-

Figure 4 Wine comes with its own Registry editor

Figure 5 the results list shows all the changes found on a Windows installation by trackWinstall

17

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012

Hell clearly demonstrates that continuously replacing libraries is an approach with limitations ndash not all versions of the system libraries will cooperate nicely When you reach this point any action you take requires skill research luck and ndash last but not least ndash patience

To access debug information easily pass in the WINEDEBUG en-vironment variable at launch time The value +relay in Wine debug mode outputs all function calls and descriptions of the associated libraries on the console This gives the admin some initial information as to which function call is causing Wine to fail and what DLL is responsible for it

If you redirect standard output into a logfile you can then analyze the startup process in your own good time

env WINEPREFIX=~name_of_prefix WINEDEBUG=+relay wine U

applicationexeampgtdebuglog

tries and the relevant system libraries and lets you easily ex-port them directly into a plain vanilla Wine environment If you then avoid reinstalling you can launch the application via the commands or icons described above

If this approach fails a more in-depth inspection of the appli-cationrsquos activity in the parallel Windows installation is then necessary The first step is to start the application and check the system libraries it loads when launched Simple tools are fine for this task many of these tools are available as freeware or as demo versions for limited free use DLL Show [12] is a veteran already but it still provides good service and reliably reveals applications and associated libraries loaded in the oper-ating systemrsquos memory space

A similar service is provided by Process Info [13] which is free for 30 days of use (Figure 6) The limitations of this tempo-rary version compared with the full version will be irrelevant to most Linux users especially because the tool can be in-stalled and executed in a Wine environment

On the basis of the list of libraries the monitored soft-ware loads admins can gain an initial impression of what they need to pay attention to The output in the launch console might already reveal whether a Wine library fails to offer an application all the relevant functions and thus has to be replaced with a na-tive version In any case loading the Wine Debugger when starting the application should help

CuveacuteeA scenario that Windows ad-ministrators refer to as DLL

Figure 6 Process Info lists the DLLs linked to a Windows executable

Figure 7 Launching a Wine application with the WINEDEBUG=+relay environment variable set generates a

huge volume of output

18

CoVeR StoRIeSPractical Wine

August 2012 Issue 141 lInux-mAgAzInecom | lInuxpromAgAzInecom

The +all parameter for the environment vari-able WINEDEBUG (Figure 7) makes the debugger far more talkative

env WINEPREFIX=~name_of_prefix U

WINEDEBUG=+relay wine applicationexeampgtU

start_applicationlog

Wine then routes all the information accessi-ble in debug mode to standard output This significantly delays the application start but once you gain a little practice this approach can give you a far more in-depth impression of the implemented mechanisms and the pitfalls which you can then try to circumvent

In addition to setting the WINEDEBUG environ-mental variable you can also directly launch an application with the built-in Wine debugger

env WINEPREFIX=~name_of_prefix U

winedbg applicationexe

The Wine debugger gives experienced testers the familiar de-bugging capabilities from within the Wine system library envi-ronment Admins thus have an extensive range of methods for launching applications in a controlled manner

The similarities to other debuggers are not coincidental the commands implemented by the Wine debugger (Figure 8) are a subset of the GNU Project debugger (GDB) The developer website on Wine debugging [10] has a good overview of a sys-tematic approach to an unknown problem that occurs when trying to run a Windows application in a Wine environment

CodeWeavers ndash the Master vintnersIf all this debugging and testing has not helped you get an ap-plication on Linux and Wine running you still have a couple of other options With the motto ldquoLittle guys trying to change the computing world for other little guysrdquo CodeWeavers [14] drives the integration of Windows applications in Wine Al-though the products CrossOver and CrossOver Games are com-mercial and closed source they walk many users ndash and espe-cially gamers ndash through the process of talking Microsoft appli-cations into running on Linux See the article on CrossOver that appears elsewhere in this issue

Also useful with the added benefit of being free and open source is the PlayOnLinux project (POL) [15] which is in-cluded with most distributions and comes with its own graphi-cal front end for Wine The long list of supported software comprises games and programs such as AutoCAD CATIA Mi-crosoft Office iTunes Googlersquos SketchUp and Adobersquos Photo-shop and Dreamweaver If the application in which you are in-terested is not listed in the PlayOnLinux GUI searching for a POL file in the online repository could help Incidentally Play-OnLinux also uses Wine prefixes which can prevent unwanted interaction with other games and programs

Windows to new WorldsCombinations such as Wine Linux and VirtualBox allow for a complete and platform-independent open-source solution that lets you lock non-Linux applications into a container for per-manent keeping Templates containing everything necessary for operations can easily be launched moved or simply in-stalled by copying And if this isnrsquot enough you can reroute the output from the virtual instances using protocols such as VNC RDP or NX thus giving ancient Windows applications multiuser and networking capabilities nnn

Figure 8 Wine Debugger supported commands

[1] Wine headquarters http wiki winehq org

[2] Description of Wineboot http wiki winehq org wineboot

[3] Wine DIB engine http wiki winehq org DIBEngine

[4] Description of Regedit http wiki winehq org regedit

[5] Microsoftrsquos description of side-by-side assemblies (SxS) http msdn microsoft com en‑us library aa376307 aspx

[6] Winetricks http www winetricks org

[7] Details on Winetricks from the Wine wiki http wiki winehq org winetricks

[8] Command-line options in Wine http wiki winehq org FAQ head‑3b297df7a5411abe2b8d37fead01a2b8edc21619

[9] CodeWeavers Crossover Compatibility Center (CCCC) http www codeweavers com compatibility

[10] Wine debugger how-to http www winehq org docs winedev‑guide wine‑debugger

[11] TrackWinstall ftp ftp heise de pub ct ctsi trackwinstall_111 zip

[12] DLL Show http www gregorybraun com DLLShow html

[13] Process Info http www jobe‑software de en index_en htm

[14] CodeWeavers http www codeweavers com

[15] PlayOnLinux http www playonlinux com

[16] Jele H Robert Musil und das Matroschka‑Prinzip httpwwwuuni‑kluacathjelepublikationencontainer_ka_201320111114_matroschka_rmipdf (in German)

Info

19

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012

Page 5: Building a Wine environment for Windows applications ...€¦ · 02 02 Wine1.2‑gecko ‑ Microsoft Windows compatibility layer (web browser) 03 03 Wine1.2‑gecko ‑ Microsoft

Hell clearly demonstrates that continuously replacing libraries is an approach with limitations ndash not all versions of the system libraries will cooperate nicely When you reach this point any action you take requires skill research luck and ndash last but not least ndash patience

To access debug information easily pass in the WINEDEBUG en-vironment variable at launch time The value +relay in Wine debug mode outputs all function calls and descriptions of the associated libraries on the console This gives the admin some initial information as to which function call is causing Wine to fail and what DLL is responsible for it

If you redirect standard output into a logfile you can then analyze the startup process in your own good time

env WINEPREFIX=~name_of_prefix WINEDEBUG=+relay wine U

applicationexeampgtdebuglog

tries and the relevant system libraries and lets you easily ex-port them directly into a plain vanilla Wine environment If you then avoid reinstalling you can launch the application via the commands or icons described above

If this approach fails a more in-depth inspection of the appli-cationrsquos activity in the parallel Windows installation is then necessary The first step is to start the application and check the system libraries it loads when launched Simple tools are fine for this task many of these tools are available as freeware or as demo versions for limited free use DLL Show [12] is a veteran already but it still provides good service and reliably reveals applications and associated libraries loaded in the oper-ating systemrsquos memory space

A similar service is provided by Process Info [13] which is free for 30 days of use (Figure 6) The limitations of this tempo-rary version compared with the full version will be irrelevant to most Linux users especially because the tool can be in-stalled and executed in a Wine environment

On the basis of the list of libraries the monitored soft-ware loads admins can gain an initial impression of what they need to pay attention to The output in the launch console might already reveal whether a Wine library fails to offer an application all the relevant functions and thus has to be replaced with a na-tive version In any case loading the Wine Debugger when starting the application should help

CuveacuteeA scenario that Windows ad-ministrators refer to as DLL

Figure 6 Process Info lists the DLLs linked to a Windows executable

Figure 7 Launching a Wine application with the WINEDEBUG=+relay environment variable set generates a

huge volume of output

18

CoVeR StoRIeSPractical Wine

August 2012 Issue 141 lInux-mAgAzInecom | lInuxpromAgAzInecom

The +all parameter for the environment vari-able WINEDEBUG (Figure 7) makes the debugger far more talkative

env WINEPREFIX=~name_of_prefix U

WINEDEBUG=+relay wine applicationexeampgtU

start_applicationlog

Wine then routes all the information accessi-ble in debug mode to standard output This significantly delays the application start but once you gain a little practice this approach can give you a far more in-depth impression of the implemented mechanisms and the pitfalls which you can then try to circumvent

In addition to setting the WINEDEBUG environ-mental variable you can also directly launch an application with the built-in Wine debugger

env WINEPREFIX=~name_of_prefix U

winedbg applicationexe

The Wine debugger gives experienced testers the familiar de-bugging capabilities from within the Wine system library envi-ronment Admins thus have an extensive range of methods for launching applications in a controlled manner

The similarities to other debuggers are not coincidental the commands implemented by the Wine debugger (Figure 8) are a subset of the GNU Project debugger (GDB) The developer website on Wine debugging [10] has a good overview of a sys-tematic approach to an unknown problem that occurs when trying to run a Windows application in a Wine environment

CodeWeavers ndash the Master vintnersIf all this debugging and testing has not helped you get an ap-plication on Linux and Wine running you still have a couple of other options With the motto ldquoLittle guys trying to change the computing world for other little guysrdquo CodeWeavers [14] drives the integration of Windows applications in Wine Al-though the products CrossOver and CrossOver Games are com-mercial and closed source they walk many users ndash and espe-cially gamers ndash through the process of talking Microsoft appli-cations into running on Linux See the article on CrossOver that appears elsewhere in this issue

Also useful with the added benefit of being free and open source is the PlayOnLinux project (POL) [15] which is in-cluded with most distributions and comes with its own graphi-cal front end for Wine The long list of supported software comprises games and programs such as AutoCAD CATIA Mi-crosoft Office iTunes Googlersquos SketchUp and Adobersquos Photo-shop and Dreamweaver If the application in which you are in-terested is not listed in the PlayOnLinux GUI searching for a POL file in the online repository could help Incidentally Play-OnLinux also uses Wine prefixes which can prevent unwanted interaction with other games and programs

Windows to new WorldsCombinations such as Wine Linux and VirtualBox allow for a complete and platform-independent open-source solution that lets you lock non-Linux applications into a container for per-manent keeping Templates containing everything necessary for operations can easily be launched moved or simply in-stalled by copying And if this isnrsquot enough you can reroute the output from the virtual instances using protocols such as VNC RDP or NX thus giving ancient Windows applications multiuser and networking capabilities nnn

Figure 8 Wine Debugger supported commands

[1] Wine headquarters http wiki winehq org

[2] Description of Wineboot http wiki winehq org wineboot

[3] Wine DIB engine http wiki winehq org DIBEngine

[4] Description of Regedit http wiki winehq org regedit

[5] Microsoftrsquos description of side-by-side assemblies (SxS) http msdn microsoft com en‑us library aa376307 aspx

[6] Winetricks http www winetricks org

[7] Details on Winetricks from the Wine wiki http wiki winehq org winetricks

[8] Command-line options in Wine http wiki winehq org FAQ head‑3b297df7a5411abe2b8d37fead01a2b8edc21619

[9] CodeWeavers Crossover Compatibility Center (CCCC) http www codeweavers com compatibility

[10] Wine debugger how-to http www winehq org docs winedev‑guide wine‑debugger

[11] TrackWinstall ftp ftp heise de pub ct ctsi trackwinstall_111 zip

[12] DLL Show http www gregorybraun com DLLShow html

[13] Process Info http www jobe‑software de en index_en htm

[14] CodeWeavers http www codeweavers com

[15] PlayOnLinux http www playonlinux com

[16] Jele H Robert Musil und das Matroschka‑Prinzip httpwwwuuni‑kluacathjelepublikationencontainer_ka_201320111114_matroschka_rmipdf (in German)

Info

19

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012

Page 6: Building a Wine environment for Windows applications ...€¦ · 02 02 Wine1.2‑gecko ‑ Microsoft Windows compatibility layer (web browser) 03 03 Wine1.2‑gecko ‑ Microsoft

The +all parameter for the environment vari-able WINEDEBUG (Figure 7) makes the debugger far more talkative

env WINEPREFIX=~name_of_prefix U

WINEDEBUG=+relay wine applicationexeampgtU

start_applicationlog

Wine then routes all the information accessi-ble in debug mode to standard output This significantly delays the application start but once you gain a little practice this approach can give you a far more in-depth impression of the implemented mechanisms and the pitfalls which you can then try to circumvent

In addition to setting the WINEDEBUG environ-mental variable you can also directly launch an application with the built-in Wine debugger

env WINEPREFIX=~name_of_prefix U

winedbg applicationexe

The Wine debugger gives experienced testers the familiar de-bugging capabilities from within the Wine system library envi-ronment Admins thus have an extensive range of methods for launching applications in a controlled manner

The similarities to other debuggers are not coincidental the commands implemented by the Wine debugger (Figure 8) are a subset of the GNU Project debugger (GDB) The developer website on Wine debugging [10] has a good overview of a sys-tematic approach to an unknown problem that occurs when trying to run a Windows application in a Wine environment

CodeWeavers ndash the Master vintnersIf all this debugging and testing has not helped you get an ap-plication on Linux and Wine running you still have a couple of other options With the motto ldquoLittle guys trying to change the computing world for other little guysrdquo CodeWeavers [14] drives the integration of Windows applications in Wine Al-though the products CrossOver and CrossOver Games are com-mercial and closed source they walk many users ndash and espe-cially gamers ndash through the process of talking Microsoft appli-cations into running on Linux See the article on CrossOver that appears elsewhere in this issue

Also useful with the added benefit of being free and open source is the PlayOnLinux project (POL) [15] which is in-cluded with most distributions and comes with its own graphi-cal front end for Wine The long list of supported software comprises games and programs such as AutoCAD CATIA Mi-crosoft Office iTunes Googlersquos SketchUp and Adobersquos Photo-shop and Dreamweaver If the application in which you are in-terested is not listed in the PlayOnLinux GUI searching for a POL file in the online repository could help Incidentally Play-OnLinux also uses Wine prefixes which can prevent unwanted interaction with other games and programs

Windows to new WorldsCombinations such as Wine Linux and VirtualBox allow for a complete and platform-independent open-source solution that lets you lock non-Linux applications into a container for per-manent keeping Templates containing everything necessary for operations can easily be launched moved or simply in-stalled by copying And if this isnrsquot enough you can reroute the output from the virtual instances using protocols such as VNC RDP or NX thus giving ancient Windows applications multiuser and networking capabilities nnn

Figure 8 Wine Debugger supported commands

[1] Wine headquarters http wiki winehq org

[2] Description of Wineboot http wiki winehq org wineboot

[3] Wine DIB engine http wiki winehq org DIBEngine

[4] Description of Regedit http wiki winehq org regedit

[5] Microsoftrsquos description of side-by-side assemblies (SxS) http msdn microsoft com en‑us library aa376307 aspx

[6] Winetricks http www winetricks org

[7] Details on Winetricks from the Wine wiki http wiki winehq org winetricks

[8] Command-line options in Wine http wiki winehq org FAQ head‑3b297df7a5411abe2b8d37fead01a2b8edc21619

[9] CodeWeavers Crossover Compatibility Center (CCCC) http www codeweavers com compatibility

[10] Wine debugger how-to http www winehq org docs winedev‑guide wine‑debugger

[11] TrackWinstall ftp ftp heise de pub ct ctsi trackwinstall_111 zip

[12] DLL Show http www gregorybraun com DLLShow html

[13] Process Info http www jobe‑software de en index_en htm

[14] CodeWeavers http www codeweavers com

[15] PlayOnLinux http www playonlinux com

[16] Jele H Robert Musil und das Matroschka‑Prinzip httpwwwuuni‑kluacathjelepublikationencontainer_ka_201320111114_matroschka_rmipdf (in German)

Info

19

CoVeR StoRIeSPractical Wine

lInux-mAgAzInecom | lInuxpromAgAzInecom Issue 141 August 2012