Wine On Linux - Useful notes when using Wine everyday

My own notes for Wine

Info:My Web Site: http://www.davidgis.fr ,
Author: David TECHER, <davidtecher@yahoo.fr>
Date: 2018-02-03
Revision: 034-081555

Note

This document deals with collecting some notes about Wine. Info taken from the Web. Notes/Commands provided here were tested on a Linux-32Bits PC !!!. Not sure if it works on a Linux-64Bits where WINEARCH<>win32

Table of contents

1   My personal recommendations

1.1   Always build Wine from sources

Note

info Don't let your default packaging tool uprgade your default Wine version can break your application. Even if it is the case then build Wine from sources!!!

Let's assume that

  • You've just installed Wine -- through your packaging tool (apt on Debian, yum on Fedora ...) -- . It works for your favorite application (softwares or games).
  • Later your packaging tool will installed a new Wine version. That you favorite softwares stopped to work or you meet an issue.

Based on my own experience, building Wine from sources

  • It's better to waste storage where your favorite software is installed with a working Wine version.

  • It's better to try to re-test a new Wine version later. It is failed then you can open a bug to Wine. Whatever issue is, you can rollback easily to the working Wine version

  • Some application may require to patch Wine. This way you know that you will use a working Wine version, even patched!!!

  • Building Wine from sources -- depending on your own PC (hardware:CPU+RAM) -- may require some times. But at least, you know what you are doing

    • depending on your Linux distribution sometimes main people responsible for Wine packages mainteance can add unattended patches that you don't want

The real issue while building Wine from Sources is your Linux architecture: 32 bits or 64 Bits:

  • 32 bits: the easiest on. You will have to build Wine only once.

    • install dependancies wine

      apt-get buil-dep wine
      <maybe some libraries have to be installed manually>
      
    • Download Wine sources and build

      ./configure --prefix=/some/path/... <some option>
      make -j $(nproc) && make install
      
  • 64 bits: You will have to build Wine twice, It is better to have a look at

1.2   Equation is => 1 Windows application = 1 Wine version + 1 dedicated WINEPREFIX

Note

info Never put all your softwares in the same WINEPREFIX. Due do dependancies (Wine Version + installed tools through PlayOnLinux or Winetricks), you can break this WINEPREFIX easily!!!

It's better to waste storage on disk and to setp up dedicated WINEPREFIX per application. To make it clear, just write a simple configuration file.

On my PC, per application I have 2 folders + 1 configuration file

  • /opt/wine/apps/<application_name>: in this folder Wine version for this application -- Wine binaries -- is installed
  • /opt/wine/data/<application_name>̀: this folder is my WINEPREFIX
  • ̀``/home/david/<application_name>.cfg``: configuration file for this application

For example, application='Age_Of_Barbarian_Extended_Cut' is a game working with Wine-Staging 2.21

  • Wine-Staging 2.21 will be installed into /opt/wine/apps/Age_Of_Barbarian_Extended_Cut. That was done specifying --prefix option while configuring Wine

    ./configure --prefix=/opt/wine/apps/Age_Of_Barbarian_Extended_Cut ...
    
  • WINEPREFIX will be /opt/wine/data/Age_Of_Barbarian_Extended_Cut

  • Content of /home/david/Age_Of_Barbarian_Extended_Cut.cfg will be

    export PATH=/opt/wine/apps/Age_Of_Barbarian_Extended_Cut/bin:${PATH}
    export WINEPREFIX=/opt/wine/data/Age_Of_Barbarian_Extended_Cut
    WINEDEBUG=-all
    ...<other options if required to add here >
    

From a terminal I just need to load this file

souce /home/david/Age_Of_Barbarian_Extended_Cut.cfg

2   Winetricks

2.1   Show available options

Run

winetricks settings list

Here is the output

alldlls=builtin          Override most common DLLs to builtin
alldlls=default          Remove all DLL overrides
ao=disabled              Disable AlwaysOffscreen (default)
ao=enabled               Enable AlwaysOffscreen
bad                      Fake verb that always returns false
cfc=disable              Disable CheckFloatConstants (default)
cfc=enabled              Enable CheckFloatConstants
csmt=off                 Disable Command Stream Multithreading (default)
csmt=on                  Enable Command Stream Multithreading
ddr=gdi                  Set DirectDrawRenderer to gdi
ddr=opengl               Set DirectDrawRenderer to opengl
fontfix                  Check for broken fonts
fontsmooth=bgr           Enable subpixel font smoothing for BGR LCDs
fontsmooth=disable       Disable font smoothing
fontsmooth=gray          Enable subpixel font smoothing
fontsmooth=rgb           Enable subpixel font smoothing for RGB LCDs
forcemono                Force using Mono instead of .NET (for debugging)
glsl=disabled            Disable GLSL shaders, use ARB shaders (faster, but sometimes breaks)
glsl=enabled             Enable GLSL shaders (default)
good                     Fake verb that always returns true
grabfullscreen=n         Disable cursor clipping for full-screen windows (default)
grabfullscreen=y         Force cursor clipping for full-screen windows (needed by some games)
gsm=0                    Set MaxShaderModelGS to 0
gsm=1                    Set MaxShaderModelGS to 1
gsm=2                    Set MaxShaderModelGS to 2
gsm=3                    Set MaxShaderModelGS to 3
heapcheck                Enable heap checking with GlobalFlag
hidewineexports=disable  Disable hiding Wine exports from applications (wine-staging)
hidewineexports=enable   Enable hiding Wine exports from applications (wine-staging)
hosts                    Add empty C:\windows\system32\drivers\etc\{hosts,services} files
macdriver=mac            Enable the Mac native Quartz driver (default)
macdriver=x11            Disable the Mac native Quartz driver, use X11 instead
multisampling=disabled   Disable Direct3D multisampling
multisampling=enabled    Enable Direct3D multisampling
mwo=disable              Set DirectInput MouseWarpOverride to disable
mwo=enabled              Set DirectInput MouseWarpOverride to enabled (default)
mwo=force                Set DirectInput MouseWarpOverride to force (needed by some games)
native_mdac              Override odbc32, odbccp32 and oledb32
native_oleaut32          Override oleaut32
nocrashdialog            Disable crash dialog
npm=repack               Set NonPower2Mode to repack
nt40                     Set windows version to Windows NT 4.0
orm=backbuffer           Set OffscreenRenderingMode=backbuffer
orm=fbo                  Set OffscreenRenderingMode=fbo (default)
psm=0                    Set MaxShaderModelPS to 0
psm=1                    Set MaxShaderModelPS to 1
psm=2                    Set MaxShaderModelPS to 2
psm=3                    Set MaxShaderModelPS to 3
remove_mono              Remove builtin wine-mono
rtlm=auto                Set RenderTargetLockMode to auto (default)
rtlm=disabled            Set RenderTargetLockMode to disabled
rtlm=readdraw            Set RenderTargetLockMode to readdraw
rtlm=readtex             Set RenderTargetLockMode to readtex
rtlm=texdraw             Set RenderTargetLockMode to texdraw
rtlm=textex              Set RenderTargetLockMode to textex
sandbox                  Sandbox the wineprefix - remove links to /home/david
sound=alsa               Set sound driver to ALSA
sound=coreaudio          Set sound driver to Mac CoreAudio
sound=disabled           Set sound driver to disabled
sound=oss                Set sound driver to OSS
sound=pulse              Set sound driver to PulseAudio
strictdrawordering=disabled Disable StrictDrawOrdering (default)
strictdrawordering=enabled Enable StrictDrawOrdering
vd=1024x768              Enable virtual desktop, set size to 1024x768
vd=1280x1024             Enable virtual desktop, set size to 1280x1024
vd=1440x900              Enable virtual desktop, set size to 1440x900
vd=640x480               Enable virtual desktop, set size to 640x480
vd=800x600               Enable virtual desktop, set size to 800x600
vd=off                   Disable virtual desktop
videomemorysize=1024     Tell Wine your video card has 1024MB RAM
videomemorysize=2048     Tell Wine your video card has 2048MB RAM
videomemorysize=512      Tell Wine your video card has 512MB RAM
videomemorysize=default  Let Wine detect amount of video card memory
vista                    Set Windows version to Windows Vista
vsm=0                    Set MaxShaderModelVS to 0
vsm=1                    Set MaxShaderModelVS to 1
vsm=2                    Set MaxShaderModelVS to 2
vsm=3                    Set MaxShaderModelVS to 3
win10                    Set Windows version to Windows 10
win2k                    Set Windows version to Windows 2000
win2k3                   Set Windows version to Windows 2003
win2k8                   Set Windows version to Windows 2008 R2
win31                    Set Windows version to Windows 3.1
win7                     Set Windows version to Windows 7
win8                     Set Windows version to Windows 8
win81                    Set Windows version to Windows 8.1
win95                    Set Windows version to Windows 95
win98                    Set Windows version to Windows 98
windowmanagerdecorated=n Prevent the window manager from decorating windows
windowmanagerdecorated=y Allow the window manager to decorate windows (default)
windowmanagermanaged=n   Prevent the window manager from controlling windows
windowmanagermanaged=y   Allow the window manager to control windows (default)
winver=                  Set Windows version to default (win7)
winxp                    Set Windows version to Windows XP

3   General

3.1   While building Wine from sources, try to get its options in alphabetical order for configure

Executing configure --help didn't return option in alphabetical order. But I like to get them in alphabetical order. It helps me when I have to switch off an option when I want to rebuild Wine with/without this option

Example for Wine 3.1

  • Download sources

    cd /tmp/
    wget https://dl.winehq.org/wine/source/3.x/wine-3.1.tar.xz
    tar xf wine-3.1.tar.xz && cd wine-3.1
    
  • Use this command (switchiff off both HAL and OSS)

    echo  $(echo -n $(./configure --help|grep -E '  \-\-with'|grep -vE '(PACKAGE|\-wine)'|sort|sed -e "s:without:with:g;s:with-hal:without-hal:g"|awk '{print $1}'|sort))
    
  • That should return

    --with-alsa --with-capi --with-cms --with-coreaudio --with-cups --with-curses --with-dbus --with-float-abi=abi --with-fontconfig
    --with-freetype --with-gettext --with-gettextpo --with-glu --with-gnutls --with-gphoto --with-gsm --with-gssapi --with-gstreamer --with-jpeg
    --with-krb5 --with-ldap --with-mpg123 --with-netapi --with-openal --with-opencl --with-opengl --with-osmesa --with-oss --without-hal --with-pcap
    --with-png --with-pthread --with-pulse --with-sane --with-tiff --with-udev --with-v4l --with-x --with-xcomposite --with-xcursor --with-xfixes --with-xinerama
    --with-xinput --with-xinput2 --with-xml --with-xrandr --with-xrender --with-xshape --with-xshm --with-xslt --with-xxf86vm --with-zlib
    

Conclusion using this line I have the reordered list for configure options. That should make life easier

3.2   Add a wallpaper to your Virtual Desktop

  • Define a default virtual desktop

    • Option #1: GUI Solution: through winecfg

    • Option #2: command line winetricks vd=??x??. Here is an axample for a Virtual Desktop (1920x1080)

      winetricks vd=1920x1080
      
  • Download a image from the Web and convert it to BMP format

  • Now copy it -- this new converted file converted in BMP format -- somewhere in your WINEPREFIX.

  • Assuming that

    • the new file is called wallpaper.bmp
    • the new file is located/copied into $WINEPREFIX/drive_c/windows folder
  • Now write a file named wallpaper.reg

    • Its content will be

      REGEDIT4
      
      HKEY_CURRENT_USER\Control Panel\Desktop]
      Wallpaper"="C:\\Windows\\wallapper.bmp"
      

      Note

      info If your BMP image is not copied into WINEPREFIX then you need to convert its Unix patch first. Assuming that its path si /some/path/to/wallpaper.reg

      1. Get the convert path

        wine -w /some/path/to/wallpaper.reg
        
      2. Change this new location into the wallpaper.reg file ( Wallpaper"="..."). Don't forget double escape for slash

    • Open a terminal and launch

      regedit /path/to/wallpaper.reg
      

3.3   winepath How to convert Unix/Windows paths using Wine?

david@amdgaming:~$ winepath --help
Usage: winepath [OPTION] [PATH]...
Convert PATH(s) to Unix or Windows long or short paths.
  -u, --unix    converts a Windows path to a Unix path
  -w, --windows converts a Unix path to a long Windows path
  -l, --long    converts the short Windows path of an existing file or
                directory to the long format
  -s, --short   converts the long Windows path of an existing file or
                directory to the short format
  -0            separate output with \0 character, instead of a newline
  -h, --help    output this help message and exit
  -v, --version output version information and exit

If more than one option is given then the input paths are output in
all formats specified, in the order long, short, Unix, Windows.
If no option is given the default is Unix format.

Examples

  • Unix to Windows for folders /opt/mingw32/bin/, /opt/mingw32/i686-w64-mingw32/lib/

    david@amdgaming:~$ winepath -w /opt/mingw32/bin/ /opt/mingw32/i686-w64-mingw32/lib/
    Z:\opt\mingw32\bin\
    Z:\opt\mingw32\i686-w64-mingw32\lib\
    
  • Windows to Unix for folder C:data -- WINEPREFIX="/opt/Builds/wine/data/MinGW32_Environment" --
    david@amdgaming:~$ winepath -u C:\data
    /opt/Builds/wine/data/MinGW32_Environment/dosdevices/c:/data
    

Source: https://wiki.winehq.org/Winepath

4   MinGW-w32 - Environment

4.1   Add DLLs from MinGW32

Note

info Let assume that the prebuilt toolchain is installed at /opt/mingw32. Else modify folders used in commands below for your own needs

  • Run the following command

    david@amdgaming:~$ echo -n $(winepath -w /opt/mingw32/bin/ /opt/mingw32/i686-w64-mingw32/lib/|sed -e "s:\\\:\\\\\\\:g;s:$:;:g")| sed -e "s: ::g";echo
    Z:\\opt\\mingw32\\bin\\;Z:\\opt\\mingw32\\i686-w64-mingw32\\lib\\;
    
  • Copy/Paste line returned from command above

  • Edit the file ${WINEPREFIX}/system.reg

  • Search for PATH. You should get something like shown below
    "PATH"=str(2):"C:\\windows\\system32;C:\\windows;C:\\windows\\system32\\wbem;"
    
  • Append new paths to this line. Then you should get
    "PATH"=str(2):"C:\\windows\\system32;C:\\windows;C:\\windows\\system32\\wbem;Z:\\opt\\mingw32\\bin;Z:\\opt\\mingw32\\bin\\;Z:\\opt\\mingw32\\i686-w64-mingw32\\lib\\;"
    
  • Save and exit.

Source: https://fedoraproject.org/wiki/MinGW/Configure_wine

4.2   Wrapper Make any exe automatically executable through wine

Note

info Let's assume that wine is installed at ̀``/opt/wine/apps/MinGW32_Environment/bin/``

echo ':DOSWin:M::MZ::/opt/wine/apps/MinGW32_Environment/bin//wine:' > /proc/sys/fs/binfmt_misc/register