Build Wine-Staging 2.0 WoW64 on Linux Mint 18 Mate 64 Bits

Wine-Staging 2.0 Multi-Arch on Ubuntu 64 Bits

Info:My blog: http://www.davidgis.fr , Youtube: https://www.youtube.com/user/davidtecher
Author: David TECHER, a simple Wine contributor, <davidtecher@yahoo.fr>
Date: 2017-01-26
Revision: 026-013120

Note

WineLogo Here are all details I used to build Wine-Staging 2.0 Multi-Arch on Linux Mint 18 64 Bits. This document is based on details provided on the following URLs

I used the chroot method instead of the LXC method used in the 2nd link above.

As quoted from the 2nd link above the main approach is to

Total disk space consumption is about 8GB with details listed below

warn Everything showned here is quite experimental.

I took decision to maintain this page only for Wine-Staging 2.0 without HAL support and OSS support

Table of contents

1   The PC

Component Details
OS Linux Mint 18.1 Mate 64 Bits
GPU GTX 680
RAM 3GB
CPU Intel i5-2400 CPU @ 3.10GHz

2   Web Sites and Sources

Git Repo URL
Wine (Official)
Wine-Staging

3   Prerequisites

3.1   Set up Enviroment for 64-bit wine

  • Go to your home directory:

    cd
    

Note

green All commands in this section are performed using root user. I don't want to waste my time running sudo each time.

  • Become root:

    sudo su
    
  • Add the following repository and all dependancies for Wine-Staging:

    add-apt-repository ppa:wine/wine-builds
    apt-get update
    apt-get build-dep wine-staging wine-staging-i386
    

We install packages for the chroot now (schroot and debootstrap). This way it is ready for later. Package vim will be useful to edit file later. Package openssh-server will be useful from a remote connection from another PC (if you have one and if something goes wrong). But this package is optional

  • Install the following packages:

    apt-get install opencl-headers schroot debootstrap vim openssh-server
    

Note

  • WineLogo To avoid an issue with libGL "Can not find libGL" later add this symbolic link:

    ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/libGL.so
    

Note

  • WineLogo Package opencl-headers is required by Wine-Staging for OpenCL. That's why we installed it!
  • Now you can quit your current root session:

    exit
    

3.2   Download sources and prepare the sources

Note

green All commands in this section are performed using your usual Linux user. In my case this is david.

  • Go to your home directory:

    cd
    
  • Download sources for Wine, Wine-Staging and patches from wine-gaming-nine Arch repo

    mkdir Wine-Staging-2.0
    cd Wine-Staging-2.0
    wget "https://dl.winehq.org/wine/source/2.0/wine-2.0.tar.bz2" -O wine-2.0.tar.bz2
    wget https://github.com/wine-compholio/wine-staging/archive/v2.0.tar.gz
    git clone https://aur.archlinux.org/wine-gaming-nine.git/
    
  • Decompress Wine 2.0 sources:

    tar xvjf wine-2.0.tar.bz2
    cd wine-2.0/
    
  • Decompress Wine-Staging 2.0 sources and apply patches:

    tar xvzf ../v2.0.tar.gz -C . --strip-component 1
    ./patches/patchinstall.sh DESTDIR="$(pwd)" --all
    
  • Apply patches from wine-gaming-nine Arch repo:

    patch -p1 < ../wine-gaming-nine/heap_perf.patch
    patch -p1 < ../wine-gaming-nine/increase_max_frag_samplers.patch
    patch -p1 < ../wine-gaming-nine/steam.patch
    patch -p1 < ../wine-gaming-nine/wbemprox_query_v2.patch
    patch -p1 -R < ../wine-gaming-nine/keybindings.patch
    

4   Build Wine-Staging 64 Bits

Note

green All commands in this section are performed using your usual Linux user. In my case this is david.

5   Chroot for Ubuntu 32 Bit

Time to install the chroot for 32 Bits.

Note

green All commands in this section are performed using root user. I don't want to waste my time running sudo each time.

Note

  • WineLogo To avoid any issue with libOpenCL copy the following files:

    cp -avf /usr/lib/i386-linux-gnu/libOpenCL.so* /srv/chroot/ubuntu_i386/usr/lib/
    

6   Prerequisites for Wine-Staging 32 Bits

Note

red In this section we will go into the chroot system and we will install all prerequisites

7   Build Wine-Staging 32 Bits (x 2)

7.1   Build #1: wine32-tools

Note

red In this section we are still in the chroot system.

  • Get back to main folder. Replace david by your Linux user (refer to the name you used for /etc/schroot/chroot.d/ubuntu_i386.conf):

    cd /home/david/Wine-Staging-2.0/
    
  • Build a wine32-tools folder.Get into this folder and copy content of wine-2.0 folder into this folder:

    mkdir wine32-tools
    cd wine32-tools
    cp -avf ../wine-2.0/* .
    
  • Run configure with usual options. There is no specific option here:

    ./configure --prefix=/opt/wine/apps/Hounds_The_Last_Hope --with-alsa --with-capi --with-cms --with-coreaudio \
    --with-cups --with-curses --with-dbus --with-fontconfig --with-freetype --with-gettext --with-glu --with-gnutls --with-gphoto \
    --with-gsm --with-gstreamer --with-gtk3 --without-hal --with-jpeg --with-ldap --with-mpg123 --with-netapi --with-openal \
    --with-opencl --with-opengl --with-osmesa --without-oss --with-pcap --with-png --with-pthread --with-pulse --with-sane --with-tiff \
    --with-udev --with-v4l --with-va --with-xattr --with-xcb --with-xcomposite --with-xcursor --with-xinerama --with-xinput \
    --with-xinput2 --with-xml --with-xrandr --with-xrender --with-xshape --with-xshm --with-xslt --with-xxf86vm --with-zlib
    
  • Run make:

    make -j4
    

7.2   Build #2: wine32-build

Note

red In this section we are still in the chroot system.

  • Get back to main folder. Replace david by your Linux user (refer to the name you used for /etc/schroot/chroot.d/ubuntu_i386.conf):

    cd /home/david/Wine-Staging-2.0/
    
  • Create a wine32-build folder and get into this folder. It is not worth copying data from wine 2.0 foler here:

    mkdir wine32-build
    cd wine32-build
    
  • Run configure adding options --with-wine64 and --with-wine-tools. We are pointing to the configure provided in the wine 2.0 folder:

    ../wine-2.0/configure --prefix=/opt/wine/apps/Hounds_The_Last_Hope \
    --with-wine64=/home/david/Wine-Staging-2.0/wine64-build/ --with-wine-tools=/home/david/Wine-Staging-2.0/wine32-tools/ \
    --with-alsa --with-capi --with-cms --with-coreaudio --with-cups --with-curses --with-dbus --with-fontconfig --with-freetype \
    --with-gettext --with-glu --with-gnutls --with-gphoto --with-gsm --with-gstreamer --with-gtk3 --without-hal --with-jpeg --with-ldap \
    --with-mpg123 --with-netapi --with-openal --with-opencl --with-opengl --with-osmesa --without-oss --with-pcap --with-png \
    --with-pthread --with-pulse --with-sane --with-tiff --with-udev --with-v4l --with-va --with-xattr --with-xcb --with-xcomposite \
    --with-xcursor --with-xinerama --with-xinput --with-xinput2 --with-xml --with-xrandr --with-xrender --with-xshape --with-xshm \
    --with-xslt --with-xxf86vm --with-zlib
    
  • Run make:

    make -j4
    
  • Log out from chroot system:

    exit
    

8   Install 32-bit wine and 64-bit wine

Note

green In this section we get back to the normal Linux system. Be sure that you run the exit command to leave the previous chroot session

Note

red It is important to install 32-bit wine first and then 64-bit wine

9   Tips to know

9.1   winetricks

Winetricks package provided by Linux Mint is outdated. It is better to use a fresh version of winetricks

  • Clone the repository:

    git clone https://github.com/Winetricks/winetricks.git
    
  • Create a symbolic link:

    sudo ln -s $PWD/winetricks/src/winetricks /usr/bin/
    
  • OR add path to winetricks/src folder to your PATH environment variable:

    export PATH=/some/path/to/winetricks/src:${PATH}
    

9.2   Enable GTK-3 Theming through winecfg (optional)

This is an option available through winecfg (Staging Tab).

If you set WINEARCH as WINEARCH=win32 then you need to keep your chroot system at least the folder /srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/. Because libgtk3 depends on a lot of librairies located in this folder. Then it is a wise decision to not copy all these dependancies in your own Linux system.

Before running any application with wine just update your LD_LIBRARY_PATH environment variable:

export LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/:/srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/

9.3   Set up a configuration file

I play the game "Hounds The Last Hope (Steam)". I wrote a config file Hounds_The_Last_Hope.cfg.

  • Its content is:

    export LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/:/srv/chroot/ubuntu_i386/lib/i386-linux-gnu/:/srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/
    export PATH=/opt/wine/apps/Hounds_The_Last_Hope/bin:$PATH
    
    export WINEARCH=win32
    export WINEPREFIX=/opt/wine/data/Hounds_The_Last_Hope/
    export WINEDEBUG=-all
    
    # Tips taken from https://wiki.archlinux.org/index.php/wine
    # Mono and Gecko
    # when initializing a new wineprefix wine will ask to install mono and gecko. or if the packages wine-mono
    # and wine_gecko are installed wine will silently copy about 450 mb of mono and gecko files in the wineprefix.
    # to prevent wine from asking to install mono and gecko start wine like this:
    
    export WINEDLLOVERRIDES="mscoree=d;mshtml=d"
    
    ######################################
    # Wine-Staging Environment Variables #
    ######################################
    #
    # Note: To get information refer to https://github.com/wine-compholio/wine-staging/wiki/Environment-Variables
    #
    export STAGING_SHARED_MEMORY=1
    
    export STAGING_WRITECOPY=1
    
  • Just use source to load it:

    source Hounds_The_Last_Hope.cfg
    

9.4   Check wine librairies

  • If you run wine with --check-libs then you will get the following output:

    david@mercury-xen-LinuxMint ~ $ /opt/wine/apps/Hounds_The_Last_Hope/bin/wine --check-libs
    libcairo.so.2: /usr/lib/i386-linux-gnu/libcairo.so.2
    libcapi20.so.3: /usr/lib/i386-linux-gnu/libcapi20.so.3
    libcups.so.2: /usr/lib/i386-linux-gnu/libcups.so.2
    libdbus-1.so.3: /lib/i386-linux-gnu/libdbus-1.so.3
    libfontconfig.so.1: /usr/lib/i386-linux-gnu/libfontconfig.so.1
    libfreetype.so.6: /usr/lib/i386-linux-gnu/libfreetype.so.6
    libGL.so.1: /usr/lib/i386-linux-gnu/libGL.so.1
    libgnutls.so.30: /usr/lib/i386-linux-gnu/libgnutls.so.30
    libgobject-2.0.so.0: /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
    libgsm.so.1: missing
    libgtk-3.so.0: missing
    libjpeg.so.8: /usr/lib/i386-linux-gnu/libjpeg.so.8
    libncurses.so.5: /lib/i386-linux-gnu/libncurses.so.5
    libnetapi.so: missing
    libodbc.so.2: /usr/lib/i386-linux-gnu/libodbc.so.2
    libOSMesa.so.8: missing
    libpcap.so.0.8: missing
    libpng12.so.0: /lib/i386-linux-gnu/libpng12.so.0
    libsane.so.1: /usr/lib/i386-linux-gnu/libsane.so.1
    libtiff.so.5: /usr/lib/i386-linux-gnu/libtiff.so.5
    libtxc_dxtn_s2tc.so.0: /usr/lib/i386-linux-gnu/libtxc_dxtn_s2tc.so.0
    libv4l1.so.0: /usr/lib/i386-linux-gnu/libv4l1.so.0
    libva.so.1: missing
    libva-drm.so.1: missing
    libva-x11.so.1: missing
    libX11.so.6: /usr/lib/i386-linux-gnu/libX11.so.6
    libX11-xcb.so.1: /usr/lib/i386-linux-gnu/libX11-xcb.so.1
    libXcomposite.so.1: /usr/lib/i386-linux-gnu/libXcomposite.so.1
    libXcursor.so.1: /usr/lib/i386-linux-gnu/libXcursor.so.1
    libXext.so.6: /usr/lib/i386-linux-gnu/libXext.so.6
    libXi.so.6: /usr/lib/i386-linux-gnu/libXi.so.6
    libXinerama.so.1: /usr/lib/i386-linux-gnu/libXinerama.so.1
    libXrandr.so.2: /usr/lib/i386-linux-gnu/libXrandr.so.2
    libXrender.so.1: /usr/lib/i386-linux-gnu/libXrender.so.1
    libxslt.so.1: /usr/lib/i386-linux-gnu/libxslt.so.1
    libXxf86vm.so.1: /usr/lib/i386-linux-gnu/libXxf86vm.so.1
    
  • Missing librairies are located in /srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/. You have to update LD_LIBRARY_PATH to point to this folder:

    david@mercury-xen-LinuxMint ~ $ export LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/:/srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/
    david@mercury-xen-LinuxMint ~ $ /opt/wine/apps/Hounds_The_Last_Hope/bin/wine --check-libs
    libcairo.so.2: /usr/lib/i386-linux-gnu/libcairo.so.2
    libcapi20.so.3: /usr/lib/i386-linux-gnu/libcapi20.so.3
    libcups.so.2: /usr/lib/i386-linux-gnu/libcups.so.2
    libdbus-1.so.3: /lib/i386-linux-gnu/libdbus-1.so.3
    libfontconfig.so.1: /usr/lib/i386-linux-gnu/libfontconfig.so.1
    libfreetype.so.6: /usr/lib/i386-linux-gnu/libfreetype.so.6
    libGL.so.1: /usr/lib/i386-linux-gnu/libGL.so.1
    libgnutls.so.30: /usr/lib/i386-linux-gnu/libgnutls.so.30
    libgobject-2.0.so.0: /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
    libgsm.so.1: /srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/libgsm.so.1
    libgtk-3.so.0: /srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/libgtk-3.so.0
    libjpeg.so.8: /usr/lib/i386-linux-gnu/libjpeg.so.8
    libncurses.so.5: /lib/i386-linux-gnu/libncurses.so.5
    libnetapi.so: missing
    libodbc.so.2: /usr/lib/i386-linux-gnu/libodbc.so.2
    libOSMesa.so.8: /srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/libOSMesa.so.8
    libpcap.so.0.8: /srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/libpcap.so.0.8
    libpng12.so.0: /usr/lib/i386-linux-gnu/libpng12.so.0
    libsane.so.1: /usr/lib/i386-linux-gnu/libsane.so.1
    libtiff.so.5: /usr/lib/i386-linux-gnu/libtiff.so.5
    libtxc_dxtn_s2tc.so.0: /usr/lib/i386-linux-gnu/libtxc_dxtn_s2tc.so.0
    libv4l1.so.0: /usr/lib/i386-linux-gnu/libv4l1.so.0
    libva.so.1: /srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/libva.so.1
    libva-drm.so.1: /srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/libva-drm.so.1
    libva-x11.so.1: /srv/chroot/ubuntu_i386/usr/lib/i386-linux-gnu/libva-x11.so.1
    libX11.so.6: /usr/lib/i386-linux-gnu/libX11.so.6
    libX11-xcb.so.1: /usr/lib/i386-linux-gnu/libX11-xcb.so.1
    libXcomposite.so.1: /usr/lib/i386-linux-gnu/libXcomposite.so.1
    libXcursor.so.1: /usr/lib/i386-linux-gnu/libXcursor.so.1
    libXext.so.6: /usr/lib/i386-linux-gnu/libXext.so.6
    libXi.so.6: /usr/lib/i386-linux-gnu/libXi.so.6
    libXinerama.so.1: /usr/lib/i386-linux-gnu/libXinerama.so.1
    libXrandr.so.2: /usr/lib/i386-linux-gnu/libXrandr.so.2
    libXrender.so.1: /usr/lib/i386-linux-gnu/libXrender.so.1
    libxslt.so.1: /usr/lib/i386-linux-gnu/libxslt.so.1
    libXxf86vm.so.1: /usr/lib/i386-linux-gnu/libXxf86vm.so.1
    

9.5   Disable Nouveau, Install the NVIDIA driver

  • Download the driver from NVIDIA Web Site

  • Become root:

    sudo su
    
  • Disable nouveau driver:

    echo "blacklist nouveau" >> /etc/modprobe.d/blacklist-nouveau.conf
    echo "options nouveau modeset=0" >> /etc/modprobe.d/blacklist-nouveau.conf
    
  • Update components of kernel to disable/blacklist Nouveau driver:

    update-initramfs -u -k $(uname -r)
    
  • Reboot the PC

  • Shutdown services running on X server i.e (mate display manager):

    service mdm stop
    
  • Install the NVIDIA driver:

    sudo su
    chmod +x NVIDIA-Linux-x86_64-367.57.run
    ./NVIDIA-Linux-x86_64-367.57.run
    
  • Reboot the PC.

9.6   Avoid tearing with NVIDIA

  • Edit the file /etc/X11/xorg.conf using vim. Try to find this section:

    Section "Screen"
        Identifier     "Screen0"
        Device         "Device0"
        Monitor        "Monitor0"
        DefaultDepth    24
        SubSection     "Display"
            Depth       24
        EndSubSection
    EndSection
    
  • Add the following line:

    Section "Screen"
        Identifier     "Screen0"
        Device         "Device0"
        Monitor        "Monitor0"
        DefaultDepth    24
        SubSection     "Display"
            Depth       24
        EndSubSection
        Option  "metamodes" "nvidia-auto-select +0+0 { ForceCompositionPipeline = On }"
    EndSection
    
  • Save the file and reboot your PC.