Wine is the next great tool for Running Windows applications on Linux. However, if we install directly with apt Install, we can only install very old versions. Here I would like to share my process of compiling and installing Wine.

In general, we use Wine32-bit, because most Windows programs are still 32-bit, 32-bit Wine can only run 32-bit applications, 64-bit Wine can only run 64-bit applications. It is also possible to compile Wine with WoW64 features, which can run both 32-bit and 64-bit applications, as described below. Personally, it is recommended to use Debian 10 64-bit system for compilation.

Here we go!

1, download the wine source code and decompress it

Go to the official wine website to download the source code and unzip it. All official versions of source download alternate address

2. Install and compile the dependencies required for wine

To compile the wine source code, you must install some dependent libraries to perform the compilation and some functional packages to improve the function of wine, otherwise it will not compile. Here is the official list of required libraries and the package names on each distribution:

As you can see, not all libraries are required, but we can install the ones that can, just in case we need them.

For convenience, you can run the following commands to install all required dependency packages: open the terminal and run the following commands to install all required dependency packages (Debian10 is used to install all required dependency packages in other systems) :

Debian 10 32-bit:

sudo apt install flex bison gcc make gcc-mingw-w64 libasound2-dev libpulse-dev libdbus-1-dev libfontconfig1-dev libfreetype6-dev libgnutls28-dev libjpeg62-turbo-dev libpng-dev libtiff-dev libunwind-dev libx11-dev libxml2-dev Libgstreamer-plugins-base1.0-dev libmpg123-dev libosmesa6-dev libsdl2-dev  libudev-dev libvkd3d-dev libvulkan-dev libcapi20-dev liblcms2-dev libcups2-dev libgphoto2-dev libsane-dev libgsm1-dev Libkrb5 -dev libldap2-dev ocl-icd-opencl-dev libpcap-dev libusb-1.0-0-dev libv4l-dev libopenal-dev libjxr-devCopy the code

Debian 10 64-Bit:

sudo dpkg --add-architecture i386 sudo apt update sudo apt install flex bison gcc make gcc-mingw-w64 libasound2-dev libpulse-dev libdbus-1-dev libfontconfig1-dev libfreetype6-dev libgnutls28-dev libjpeg62-turbo-dev libpng-dev Libtiff -dev libunwind-dev libx11-dev libxml2-dev libxslt1-dev libfaudio-dev libgstreamer1.0-dev libmpg123-dev libosmesa6-dev libudev-dev libvkd3d-dev libvulkan-dev libcapi20-dev liblcms2-dev libcups2-dev libgphoto2-dev libsane-dev Libgsm1 -dev libkrb5-dev libldap2-dev ocl-icd-opencl-dev libpcap-dev libusb-1.0-0-dev libv4l-dev libopenal-dev libjxr-dev libasound2-dev:i386 libpulse-dev:i386 libdbus-1-dev:i386 libfontconfig1-dev:i386 libfreetype6-dev:i386 libgnutls28-dev:i386 libjpeg62-turbo-dev:i386 libpng-dev:i386 libtiff-dev:i386 libunwind-dev:i386 libx11-dev:i386 Libxml2-dev :i386 libxslt1-dev:i386 libfaudio-dev:i386 libgstreamer1.0-dev:i386 libgstreamer-plugins-base1.0-dev:i386 libmpg123-dev:i386 libosmesa6-dev:i386 libsdl2-dev:i386 libudev-dev:i386 libvkd3d-dev:i386 libvulkan-dev:i386 libcapi20-dev:i386 liblcms2-dev:i386 libcups2-dev:i386 libgphoto2-dev:i386 libsane-dev:i386 libgsm1-dev:i386 Libkrb5-dev :i386 libldap2-dev:i386 ocl-icd-opencl-dev:i386 libpcap-dev:i386 libusb-1.0-0-dev:i386 libv4l-dev:i386 libopenal-dev:i386 libjxr-dev:i386Copy the code

Some systems may have version-dependent issues during installation, such as the following:

This is because the compiled library to be installed itself depends on the wrong version of the package, either the version of the dependency to be automatically installed is too new or the version of the corresponding dependency already installed on the local machine is too new. Libfontconfig1-dev depends on libfontconfig1 2.11.0-6.7+b1, and libfreetype6-dev depends on libfreetype6 2.6.3-3.2. Demote the incorrect software package above.

Demotion method:

Sudo apt install Package name = the version of the specified packageCopy the code

Libfontconfig1 (2.11.0-6.7+b1) and libfreetype6 (2.6.3-3.2), respectively:

Sudo apt install libfontconfig1=2.11.0-6.7+b1 sudo apt install libfreetype6=2.6.3-3.2Copy the code

This solves the dependency problem of compiling the library, and then execute the above command to install all the dependency libraries.

The oss (Open Sound System) version of Linux is older, and the oss version (at least V4) will be used to compile and run Wine. (OSS is also not required. The oss version does not affect the compilation and operation of Wine, but it is recommended to install it to enrich its functions.) We need to go to the OSS official website to download the Linux installation package, the system architecture (32-bit or 64-bit) : official download address Alternate download address

Then run the DPKG -i command to install it.

3. Start compiling the source code

First of all, Wine can be compiled as a separate 32-bit or 64-bit version, or as both (with WoW64 features). The separate 32-bit version can only run 32-bit programs, the separate 64-bit version can only run 64-bit programs, and the separate 32-bit and 64-bit versions of Wine can not be combined together. Compiling the 32-bit version without special requirements will satisfy most needs (after all, most programs are usually 32-bit).

Of course, compiling both 32-bit and 64-bit versions is even more powerful because the compiled program already includes both Wine and Wine64 and can run either 32-bit or 64-bit programs.

Below I will introduce the compilation method of these two cases respectively, you can choose one according to your needs.

(1) Compile separate 32-bit / 64-bit versions

After decompressing the wine source code. Use the CD command to enter the source folder after decompression, and then execute:

./configure
make
Copy the code

By default, 32-bit wine is compiled.

If you want to compile 64-bit Wine, do the following:

Sudo apt install libgstreamer-plugins-base1.0-dev libsdl2-dev sudo apt autoremove./configure --enable-win64 makeCopy the code

As you can see, there are two more packages to complete when compiling 64-bit Wine. The 32-bit and 64-bit versions of the two packages do not coexist, so the 64-bit versions of the two packages were not installed when the dependencies were installed. Therefore, install it here first, and the 32-bit version will be automatically uninstalled. If you want to compile the 32-bit version, you can install it back (i386 after the software package in apt install command), but the 64-bit version will be removed automatically.

Then we start compiling. It can take an hour or more to compile, so hang it up and come back for a cup of coffee.

Of course, if the machine is good enough and you want to build it quickly, you can use multithreaded compilation. Add -j to the make command, and the number after j represents the number of threads you specify. For example:

make -j4
Copy the code

That is, compiling for four threads. The following make commands can be multithreaded with the -j argument.

After compiling, execute the following command to install:

sudo make install
Copy the code

Alternatively, you can install Wine in the specified location by using the following command:

Make DESTDIR= directory to which you want to installCopy the code

(2) Build both 32-bit and 64-bit wine (including WoW64 features)

First, we created two folders and unpacked the source code into two folders. The two folders compile the 32-bit and 64-bit wine source code, respectively. We need to compile both architectures. I here in the same directory to create wine32, Wine64 two folders, and the source code are decompression into.

To compile 64-bit wine, I have the following command line:

CD wine64 sudo apt install libgstreamer-plugins-base1.0-dev libsdl2-dev sudo apt autoremove./configure --enable-win64 makeCopy the code

Wait until the 64-bit compilation is complete before compiling the 32-bit wine:

cd .. /wine32 sudo apt install libgstreamer-plugins-base1.0-dev:i386 libsdl2-dev:i386 sudo apt autoremove./configure --with-wine64=.. /wine64 makeCopy the code

The –with-wine64 parameter specifies the directory of the wine64-bit program that has been compiled. When compiling 32-bit wine, the program will inject the libraries that the 64-bit version needs to process the 32-bit program.

After the compilation is complete, go to the two directories and run the installation command. (If the DESTDIR parameter is specified, the two directories must be the same.)

Sudo make install CD.. /wine64 sudo make install # make DESTDIR= install directory install CD.. /wine64 make DESTDIR= install directoryCopy the code

Note that once both folders have been made, you cannot change the names of the two folders or their relative locations, otherwise the make install command will fail because the 64-bit wine folder will not be found when make installs 32-bit wine.

That completes the process! To use wine, enter the wine command.

If there are Chinese garbled characters in the process of using Wine, please refer to this tutorial: link

Can also download the song typeface fonts (simsun. TTC) and placed in/usr/local/share/wine/fonts directory.

If you install the wine in the other path (make install to use when the DESTDIR parameter specifies the installation directory), you need to put the tahoma font files in the installation directory/usr/local/share/wine/fonts directory.

For example, I put the wine installation to the/home/swsk33 / app/wine directory, I want to put the font on the/home/swsk33 / app/wine/usr/local/share/wine/fonts directory.

Install the Wine Mono component

Wine Mono is a product that runs on Linux. NET plug-in, after the wine installation, run wine will prompt you to install. However, automatic wine installation is very slow, so it is recommended to download the wine Mono program file from the official website and install it manually.

Go to the official website to download the corresponding version of Wine Mono, download the corresponding version of the MSI file. Alternate wine Mono download address

To download the MSI file:

Note that the wine version and the Wine Mono version must correspond, otherwise it cannot be used. The corresponding list is as follows:

The mono version should ideally correspond to the wine version in the table above. But in my tests, it is possible to install a version of Mono into a wine version higher than its counterpart (wine is backward compatible with the lower mono version). For example, 5.1.1 mono corresponds to 5.19 wine, but 5.1.1 Mono installed in 6.0 wine can also be used. So you can choose the version according to the table.

According to the table above, we know that we must use 5.1.0 version of Wine Mono for wine5.11.

For example, if you download the 5.1.0 version of Wine Mono, you will find a file named wine-mono-5.1.0-x86.msi.

  • If you do not specify an installation path when you install Wine using make Install (the default installation), you will need to use the/usr/local/share/wineCreate a new directory calledmonoFolder, and then put down the downloadWine - mono - 5.1.0 - x86. MsiIn themonoFolder can be (/usr/local/share/wine/monoBelow).
  • If used during installationDESTDIRParameter specifies the installation path/usr/local/share/wineCreate a new directory calledmonoFolder, and then put down the downloadWine - mono - 5.1.0 - x86. MsiIn themonoFolder inside (installation path/usr/local/share/wine/monoBelow).

For example, I put the wine installation to the/home/swsk33 / app/wine32 directory, I need in/home/swsk33 / app/wine32 / usr/local/share/wine to create a new directory called mono folder, And then download the wine – mono – 5.1.0 – x86. Msi in/home/swsk33 / app/wine32 / usr/local/share/wine/mono.

With that, the Wine Mono component is installed!

5. Install the Wine Gecko component

Wine Gecko is a component used for HTML rendering and is required for some applications to run. This component is installed in a similar way to Wine Mono. We still download the package to install the form of offline installation.

Or go to the official website download address to download the MSI file, select the appropriate version. Alternate wine Gecko download address

Download the MSI file (if you are wine32-bit, you only need to download the x86 file, if you are Wine64-bit or WoW64 wine, you need to download the x86_64 and x86 files) :

Just like Wine Mono, you need to download the corresponding wine version:

For example, I downloaded wine-Gecko-2.47.1-x86. msi (if it’s 64-bit wine or WoW64 feature wine, You need to download the wine-Gecko-2.47.1-x86_64.msi and wine-Gecko-2.47.1-x86_64.msi files).

  • If you’re usingmake installIf the wine installation path is not specified (default installation), you need to install wine in the/usr/local/share/wineCreate a new directory calledgeckoFolder, and then put down the downloadWine - gecko - 2.47.1 - x86. Msi64-bit or Wow-specific wineWine - gecko - 2.47.1 - x86. MsiandWine - gecko - 2.47.1 - x86_x64. Msi) on thegeckoFolder can be (/usr/local/share/wine/geckoBelow).
  • If used during installationDESTDIRParameter specifies the installation path/usr/local/share/wineCreate a new directory calledgeckoFolder, and then put down the downloadWine - gecko - 2.47.1 - x86. Msi64-bit or Wow-specific wineWine - gecko - 2.47.1 - x86. MsiandWine - gecko - 2.47.1 - x86_x64. Msi) on thegeckoFolder inside (installation path/usr/local/share/wine/geckoBelow).

For example, I put the wine installation to the/home/swsk33 / app/wine32 directory, I need in/home/swsk33 / app/wine32 / usr/local/share/wine to create a new directory called gecko folder, And then download the wine – a gecko – 2.47.1 – x86. Msi in/home/swsk33 / app/wine32 / usr/local/share/wine/gecko.

I installed 64 wine, for example, and install to/home/swsk33 / app/wine64 directory, then I need to/home/swsk33 / app/wine64 / usr/local/share/wine directory to create a new folder called gecko, And then download the wine – a gecko – 2.47.1 – x86. Msi and wine – gecko – 2.47.1 – x86_x64. Msi in/home/swsk33 / app/wine64 / usr/local/share/wine/gecko.

With that, the Wine Gecko component is installed!

After installing Wine Gecko and Wine Mono, using Wine will not prompt you to install these two components!

6, deep system installation QQ, wechat matters needing attention

Now the high version of Wine can run the latest version of QQ2020 perfectly. In recent days, however, studies have found that deep Linux desktop environments have compatibility issues with Wine3.x and above, that wine3.x runs applications whose tray ICONS do not respond when clicked on depth, and that slightly larger applications often feappear dead unless the virtual desktop is opened.

In conclusion, I personally think that the depth of users want to use QQ, wechat normally, I give two suggestions:

1. Use deepin-wine instead of official wine

Deepin-wine was modified by the deep team based on the 2.18 version of Wine, which is more suitable for domestic software. Deep systems are integrated with Deepin-Wine, and no additional installation is required. The use method is similar to wine.

Install QQ with Deepin-wine

First create and configure the wine container:

deepin-wine winecfg
Copy the code

If you need to customize the wine container location:

WINEPREFIX= Specifies the wine container location (absolute path) deepin-wine winecfgCopy the code

In the configuration page that appears, set the system to WindowsXP (otherwise qq will crash frequently) :

Click on the libraries TAB above, add the Riched32 and mSVCP60 libraries and apply:

Finally, run the deepin-wine command to execute the QQ installation package.

After opening QQ, it is recommended not to go to the point, such as its profile picture and other data to complete the operation, otherwise it may cause a crash!

Install wechat with Deepin-wine

Now Deepin20 can install Deepin-Wine5, using apt install. It is suggested that the new deepin deepin-Wine5 can be better adapted to wechat.

As with QQ installation, it is also to create and configure the container first, the command is the same as above.

Then Baidu search download Riched20.dll copy to your container inside the drive_c/ Windows/System32 folder to replace the original file. Riched20 Alternate download address

The default container folder is.wine in the user folder, so copy to the.wine/drive_c/ Windows/System32 folder.

If you used the WINEPREFIX parameter to define the container location, then go to the corresponding place in the container folder you defined, similar to above.

Then run the configuration again (use WINEPREFIX=… to customize the container location). Deepin-wine WinECFG), like the QQ container above, set the system to XP, add Riched32 and MSVCP60 libraries.

Install it again.

2. Use the official wine and change the desktop to KDE

After all, the latest official wine version can still run more things, if you want to use the official Wine, I suggest deep users to change to a desktop environment, I suggest KDE, KDE tests did not appear above the bug. See the tutorial on installing KDE in my Linux column.

Then, when installing QQ and wechat, the operation is basically the same as the above deepin-wine, which is also to change the container system to XP, and then add mSVCP60, Riched20 and Riched32 into the function library. If installing wechat, you must download Riched20.dll first and replace it. The operation is basically similar to the above. Only the order became wine.

Create a container and configure it:

wine winecfg
Copy the code

If you need to customize the wine container location:

WINEPREFIX= The absolute path of the custom wine container, wine WinecfgCopy the code

Can use qq normally so, micro letter!

7. Wine cannot run after compiling

Generally speaking, after you’ve installed those dependency libraries, you’re ready to run Wine perfectly. However, when you copy the compiled wine to another machine, it is possible that wine will not run due to dependency issues.

On 64-bit Linux, use the following commands to add the i386 architecture and install the dependencies.

sudo dpkg --add-architecture i386 sudo apt update sudo apt install lib32z1 libc6 libasound2 libpulse0 libdbus-1-3 Libfontconfig1 libfreetype6 libgnutls30 libjpeg62-turbo libpng16-16 libtiff5 libunwind8 libx11-6 libxml2 libxslt1.1 Libfaudio0 libgstreamer1.0-0 libgstreamer-plugins-base1.0-0 libmpg123-0 libosmesa6 libsdl2-2.0-0 libudev1 libvkd3d1 Libvulkan1 libcapi20-3 liblcms2-2 libcups2 libgphoto2-6 libsane libgsm1 libkrb5-3 liblDAP 2.4-2 ocl-icd-libopencl1 Libpcap0.8 libusb-1.0-0 libv4l-0 libopenal1 libjxr0 libc6:i386 libasound2:i386 libpulse0:i386 libdbus-1-3:i386 libfontconfig1:i386 libfreetype6:i386 libgnutls30:i386 libjpeg62-turbo:i386 libpng16-16:i386 libtiff5:i386 Libunwind8 :i386 libx11-6:i386 libxml2:i386 libxslt1.1:i386 libfAudio0 :i386 libgstreamer1.0-0:i386 Libgstreamer-plugins-base1.0-0 :i386 libmpg123-0:i386 libosmesa6:i386 libsdl2-2.0-0:i386 libudev1:i386 libvkd3d1:i386 libvulkan1:i386 libcapi20-3:i386 liblcms2-2:i386 libcups2:i386 libgphoto2-6:i386 libsane:i386 libgsm1:i386 Libkrb5-3 :i386 liblDAP -2.4-2:i386 ocl-icd-libopencl1:i386 libpcap0.8:i386 libusb-1.0-0:i386 libv4L-0 :i386 libopenal1:i386 libjxr0:i386Copy the code

On 32-bit Linux, use the following command to install the corresponding runtime.

sudo apt install libc6 libasound2 libpulse0 libdbus-1-3 libfontconfig1 libfreetype6 libgnutls30 libjpeg62-turbo libpng16-16 libtiff5 libunwind8 libx11-6 libxml2 libxslt1.1 libfaudio0 libgstreamer1.0-0 libgstreamer-plugins-base1.0-0 libmpg123-0 libosmesa6 libsdl2-2.0-0 libudev1 libvkd3d1 libvulkan1 libcapi20-3 liblcms2-2 libcups2 libgphoto2-6 libsane libgsm1 libkrb5-3 libldap-2.4-2 ocl-icd-libopencl1 libpcap0.8 libusb-1.0-0 libv4l-0 libopenal1 libjxr0
Copy the code

Then you can use wine normally!

8. [Added] Common variable parameters for the wine command

Just after installing Wine, enter:

winecfg
Copy the code

You can initialize a wine container, which can be understood as a minimal Windows environment. The default container is created in the.wine folder of the user folder.

Use WinecFG to open the Settings panel of the default location container.

All commands for wine can be preceded by variables. For example, to specify the location of the wine container, use the WINEPREFIX variable:

WINEPREFIX=/home/swsk33/wineapp winecfg
Copy the code

Note that the WINEPREFIX variable must be an absolute path. When you specify this variable, the wine, winecfg, and other commands will be executed with the container you specified. The Windows application will also be installed in the container. The container folder will not exist and will be automatically created, so we often specify a location to initialize a wine container and set it.

Containers are also divided into 32-bit and 64-bit. Wine6.10 creates 64-bit containers by default, while earlier versions create 32-bit containers by default. If your application is 32-bit it is advisable to create a 32-bit container. Use the WINEARCH variable to specify the container’s architecture:

# Create 32-bit container WINEARCH=win32 winECfgCopy the code

If the container already exists and the WINEARCH you specify does not match its own schema, then an error will occur, so it is recommended to simply specify the schema using the WINEARCH variable the first time you create the initialization container.

At the same time, when we run the program with Wine on the terminal, we will find that it is constantly output debugging information, but we don’t need it. To reduce the waste of resources, we can use the WINEDEBUG variable to set the debug level to the minimum:

WINEDEBUG=-all wine app.exe
Copy the code

You can specify -all.

These are several common variables that can actually be used in combination, such as:

/swsk33/wineapp; /swsk33/wineapp; /swsk33/wineapp; WINEPREFIX=/home/swsk33/wineapp WINEARCH=win32 WINEDEBUG=-all WinecfgCopy the code

9. [Supplement] Official documents

In fact, I think the official document of Wine is very well written, very detailed and easy to understand. Here is a list of all the official documents that I refer to, and you can refer to as well:

  • Building Wine: link
  • Mono (use of Wine Mono) : link
  • Gecko (use of Wine Gecko) : link
  • Winetricks (used by the Winetricks script) : links