Wine Installation WeChat Nanny Tutorial

When you read this article, I think you have been playing around with Wine WeChat for a while. Since I started working and living with Linux N years ago, Tencent's related products have always lacked friendly support for Linux. When everyone stopped using QQ, it started to support it. Previously, I used the official deb package WeChat that cooperated with UOS. Simple chat was still possible, but the functions were too simple and stretched. Several years later, there has been no update.

In the current situation, if you need to use the new version of WeChat under Linux, wine is almost the only way. The virtual machine method is too cumbersome.

This article introduces 2 ways to install WeChat with wine, one is simpler for novices to operate; the other is more complex and solves some problems in specific desktop environments. Frankly speaking, in order to test these two methods and solve some related problems, it is very time-consuming and labor-intensive. Some of the content should appear for the first time in the Chinese Internet world (anyway, I did not find anyone recording it). Considering the huge user base, only We can carry the burden forward with love, and hope that one day, people will not need to make such troubles (it is indeed a waste of time).

Without further ado, let's get started.

Method 1. Simple wine method to install WeChat

Let's look at the renderings first:

wine-wechat-bit-32

This method is officially recommended. Wine officially provides a variety of OS installation packages, which are very good.

wine-binary-packages

Refer to Documentation, taking Ubuntu as an example, other distributions are similar.

    1. 32-bit system support
1sudo dpkg --add-architecture i386
    1. Package source related settings
1sudo mkdir -pm755 /etc/apt/keyrings
2sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
    1. Download source files

When writing this article, I used Ubuntu 23.10

1sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/mantic/winehq-mantic.sources
    1. Install wine

There is currently no stable version, and it is okay to install the staging version.

1sudo apt install --install-recommends winehq-staging

The official document requires the installation of winehq-stable. In fact, when I wrote this article, the official package had not been packaged yet, and it would prompt that it could not be found (go directly to the warehouse web page to search, and it was indeed not found!). If you are worried about instability, it is easy to wait until the official version is stable and then operate it.

1โžœ images git:(main) โœ— sudo apt install --install-recommends winehq-stable
2[sudo] password for mephisto:
3Reading package lists... Done
4Building dependency tree... Done
5Reading state information... Done
6E: Unable to locate package winehq-stable

After the previous 4 steps, wine is installed. Then use wine to install the latest version of WeChat.

    1. Go to WeChat official website to download the WeChat installation package
    • Downloaded is the windows version

    download-wechat-step1

    • Choose 32-bit or 64-bit

    It is recommended to choose 32-bit. I encountered more problems when installing 64-bit.

    download-wechat-step2

    1. Installation

Many tutorials on the Internet are very fancy, but in fact the default one is just fine. WeChatSetup_x86.exe is the 32-bit version.

1wine WeChatSetup_x86.exe

In this way, the simple installation method is done!

After the installation is completed, a launcher file will be automatically created. Just use the launcher or other methods to find and start it (in short, you can do it how other software runs and starts)

1โžœ ~ cat ~/Desktop/WeChat.desktop
2[Desktop Entry]
3Name=WeChat
4Exec=env WINEPREFIX="/home/mephisto/.wine" wine C:\\\\users\\\\Public\\\\Desktop\\\\WeChat.lnk
5Type=Application
6StartupNotify=true
7Path=/home/mephisto/.wine/dosdevices/c:/Program Files/Tencent/WeChat
8Icon=E282_WeChat.0
9StartupWMClass=wechat.exe

If you are interested, you can take a look at this startup file. Name, Exec, and Icon are the more critical elements.

    1. Other questions

If you encounter the problem of font box, it is most likely that the font is missing. Copy simsun.ttc in Windows to ~/.wine/drive_c/windows/Fonts/ to solve the problem of Song font display.

1cp fake_simsun.ttc ~/.wine/drive_c/windows/Fonts

There are many links to download fonts online, but due to copyright issues, I do not provide links.

Arch wiki solution, soft link fonts to the target directory

1cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done

The cursor in the input box cannot be positioned normally (it appears that the cursor cannot be moved to the target position, which is very annoying when correcting input errors). The solution is as follows:

  • First, install winetricks
1sudo apt install winetricks
  • Next, use winetricks to install riched20 (many also install gdiplus riched20 riched30. I tested riched20 and it solved the problem)
1winetricks gdiplus riched20 riched30

When installing riched20, it will prompt that the download of InstMsiW.exe times out or 404, which is really miserable.

instmsiw download err

Readers need to search for the download address online by themselves (or follow my personal public account "Two acres and six points of land", leave a message and I will open a temporary download address for you. The small website has limited bandwidth and does not use a network disk. Please forgive me. Various websites on the Internet The disk address is also often invalid)

download file to the wright place, then try reinstall.

 1  ~ cd .cache/winetricks/
 2โžœ  winetricks pwd
 3/home/mephisto/.cache/winetricks
 4โžœ  winetricks tree
 5.
 6โ”œโ”€โ”€ cmd
 7โ”œโ”€โ”€ corefonts
 8โ”œโ”€โ”€ msls31
 9โ”‚ย ย  โ””โ”€โ”€ InstMsiW.exe
10โ”œโ”€โ”€ riched30
11โ”‚ย ย  โ””โ”€โ”€ InstMsiA.exe
12โ”œโ”€โ”€ sourcehansans
13โ”‚ย ย  โ””โ”€โ”€ SourceHanSans.ttc.zip
14โ”œโ”€โ”€ track_usage
15โ”œโ”€โ”€ win2ksp4
16โ”‚ย ย  โ””โ”€โ”€ W2KSP4_EN.EXE
17โ””โ”€โ”€ win7sp1
18    โ””โ”€โ”€ windows6.1-KB976932-X86.exe
19
208 directories, 6 files

The test cursor positioning is normal, as shown in the animation.

input ok

Method 2, complex wine method to install WeChat

Interested students are advised to read the Official Document first. I read it on the subway with the horizontal screen on my phone.

To be honest, for most users, I recommend using the simple and painless method above to install WeChat using wine.

However, not all users use mainstream desktop environments such as Gnome and KDE, and not everyone has a smooth installation.

Since the author uses the environment built by labwc, the wechat installed in the first method shows a big black screen when it starts, and the sway environment also encounters the same problem. It's like a big black cloth covers the WeChat interface, and nothing can be seen. At this time, the cursor still responds when moving to different blocks. It's like a blind man feeling an elephant.

The black frame looks like this, with a black circle outside and a black frame inside.

wechat-blocked

In order to solve this problem, I wasted a long time until I found this article.

The solution is to directly modify the source code of wine and recompile. Recompiling is really time-consuming (i5 4-core computer is too bad, it feels like almost 40 minutes, because I donโ€™t know which modules are not needed, default parameters). It takes almost an hour to compile once. In order to test different versions (32bit and 64bit) and the impact of different dependent libraries, it was compiled about 4 times!

Of course, there are benefits to this kind of tossing. It solves the problem of black screen, and you can learn some knowledge that is of little use, which can help readers, yes, it is you ๐Ÿ˜….

    1. Download wine source code

You should be able to find the source code. Find the version you think is suitable. I usually use the latest one.

1wget https://dl.winehq.org/wine/source/8.x/wine-8.19.tar.xz
    1. Unzip and enter the directory
1โžœ wine-8.19 ls
2aclocal.m4 AUTHORS config.status configure.ac dlls fonts libs LICENSE.OLD MAINTAINERS nls programs server VERSION
3ANNOUNCE config.log configure COPYING.LIB documentation include LICENSE loader Makefile po README tools wine
4โžœ wine-8.19 pwd
5/home/mephisto/Downloads/wine-8.19
    1. Modify wine source code

Picture explanation:

wine-source-code-diff.webp

code segment:

1     if (exStyle == 0x080800a0 && style != 0x80000000 ) // WeChat/WxWork shadow hwnd ; fix can not open chat info
2     {
3         FIXME("hack %x\n", cs.dwExStyle);
4         return NULL;
5     }

vscode screenshot:

wine-patch

    1. Install basic dependencies

I'm really too lazy to sort it out. Take a look at the operation record below.

 1โžœ ~ history |grep install |grep :i386
 2  9809 sudo apt install libx11-dev:i386
 3  9810 sudo apt install libfreetype6-dev:i386 libfreetype6-dev
 4  9812 sudo apt install libxrender-dev:i386 libgnults-dev:i386
 5  9814 sudo apt install libxrender-dev:i386
 6  9816 sudo apt install libgl-dev:i386
 7  9818 sudo apt install libasound2-dev:i386
 8  9860 sudo apt install libxcursor-dev:i386
 9  9861 sudo apt install libfreetype-dev:i386
10  9862 sudo apt install libfontconfig-dev:i386
11  9863 sudo apt install libgnutls28-dev:i386

After the basic dependencies are installed, run ./configure. If you donโ€™t see warnings, it means that the dependency libraries are almost installed.

If the prompt is missing, just fill it in according to Official Document.

Exclusive content: It is strongly recommended that libfreetype-dev and libfontconfig-dev must be installed, otherwise the Chinese characters on the WeChat installation interface will be all squares (no warning will be prompted, I just missed these 2, and recompiling will cause the problem) 1 hour!).

Of course, if you are an expert and know what is useful and what is not, just ignore it.

 1โžœ wine-8.19 ./configure
 2checking build system type... x86_64-pc-linux-gnu
 3checking host system type... x86_64-pc-linux-gnu
 4checking whether make sets $(MAKE)... yes
 5#####Omit 10,000 lines here#####
 6config.status: executing include/stamp-h commands
 7config.status: executing tools/makedep commands
 8config.status: executing Makefile commands
 9
10configure: libxi 32-bit development files not found, the Xinput extension won't be supported.
11configure: XShm 32-bit development files not found, X Shared Memory won't be supported.
12configure: XShape 32-bit development files not found, XShape won't be supported.
13configure: libXxf86vm 32-bit development files not found, XFree86 Vidmode won't be supported.
14configure: libxrandr 32-bit development files not found, XRandr won't be supported.
15configure: libxinerama 32-bit development files not found, multi-monitor setups won't be supported.
16configure: libxcomposite 32-bit development files not found, Xcomposite won't be supported.
17configure: libOSMesa 32-bit development files not found (or too old), OpenGL rendering in bitmaps won't be supported.
18configure: Wayland 32-bit development files not found, the Wayland driver won't be supported.
19configure: OpenCL 32-bit development files not found, OpenCL won't be supported.
20configure: pcap 32-bit development files not found, wpcap won't be supported.
21configure: libpcsclite not found, smart cards won't be supported.
22configure: libdbus 32-bit development files not found, no dynamic device support.
23configure: libsane 32-bit development files not found, scanners won't be supported.
24configure: libusb-1.0 32-bit development files not found (or too old), USB devices won't be supported.
25configure: libv4l2 32-bit development files not found.
26configure: libgphoto2 32-bit development files not found, digital cameras won't be supported.
27configure: libgphoto2_port 32-bit development files not found, digital cameras won't be auto-detected.
28configure: libpulse 32-bit development files not found or too old, Pulse won't be supported.
29configure: gstreamer-1.0 base plugins 32-bit development files not found, GStreamer won't be supported.
30configure: OSS sound system found but too old (OSSv4 needed), OSS won't be supported.
31configure: libudev 32-bit development files not found, plug and play won't be supported.
32configure: libSDL2 32-bit development files not found, SDL2 won't be supported.
33configure: libcapi20 32-bit development files not found, ISDN won't be supported.
34configure: libcups 32-bit development files not found, CUPS won't be supported.
35configure: libkrb5 32-bit development files not found (or too old), Kerberos won't be supported.
36configure: libnetapi not found, Samba NetAPI won't be supported.
37configure: libvulkan and libMoltenVK 32-bit development files not found, Vulkan won't be supported.
38
39configure: Finished.  Do 'make' to compile Wine.
    1. Compile and install wine
1make -j `nproc`
2make install

Installed by default under /usr/local/bin/

 1โžœ ~ ls -al /usr/local/bin/wine*
 2-rwxr-xr-x 1 root root 22668 Nov 7 13:45 /usr/local/bin/wine
 3-rwxr-xr-x 1 root root 25528 Nov 6 17:37 /usr/local/bin/wine64
 4-rwxr-xr-x 1 root root 49760 Nov 6 17:37 /usr/local/bin/wine64-preloader
 5-rwxr-xr-x 1 root root 1973 Nov 7 13:45 /usr/local/bin/wineboot
 6-rwxr-xr-x 1 root root 761180 Nov 7 13:46 /usr/local/bin/winebuild
 7-rwxr-xr-x 1 root root 1973 Nov 7 13:45 /usr/local/bin/winecfg
 8-rwxr-xr-x 1 root root 1973 Nov 7 13:45 /usr/local/bin/wineconsole
 9lrwxrwxrwx 1 root root 7 Nov 7 13:46 /usr/local/bin/winecpp -> winegcc
10-rwxr-xr-x 1 root root 1973 Nov 7 13:45 /usr/local/bin/winedbg
11-rwxr-xr-x 1 root root 1070420 Nov 7 13:46 /usr/local/bin/winedump
12-rwxr-xr-x 1 root root 1973 Nov 7 13:45 /usr/local/bin/winefile
13lrwxrwxrwx 1 root root 7 Nov 7 13:46 /usr/local/bin/wineg++ -> winegcc
14-rwxr-xr-x 1 root root 242128 Nov 7 13:46 /usr/local/bin/winegcc
15-rwxr-xr-x 1 root root 95127 Nov 7 13:46 /usr/local/bin/winemaker
16-rwxr-xr-x 1 root root 1973 Nov 7 13:45 /usr/local/bin/winemine
17-rwxr-xr-x 1 root root 1973 Nov 7 13:45 /usr/local/bin/winepath
18-rwxr-xr-x 1 root root 45452 Nov 7 13:45 /usr/local/bin/wine-preloader
19-rwxr-xr-x 1 root root 3560536 Nov 7 13:45 /usr/local/bin/wineserver

There is nothing to say about these 2 steps, everyone understands them.

    1. Use hand-coded wine to install WeChat

The difference between this and method 1 is that the wine used is different (/usr/bin/wine and /usr/local/bin/wine).

Before operation, it is recommended to back up the ~/.wine directory. I set .wine to be currently used, .wine_32 and .wine_64 to be 32-bit and 64-bit respectively, so be prepared!

1โžœ~ls.wine*
2.wine:
3dosdevices drive_c system.reg userdef.reg user.reg winetricks.log wrapper.cfg
4
5.wine_32:
6dosdevices drive_c system.reg userdef.reg user.reg wrapper.cfg
7
8.wine_64:
9dosdevices drive_c system.reg userdef.reg user.reg

Installation, this step is the same as before.

1/usr/local/bin/wine WeChatSetup_x86.exe
    1. Other questions
    • For other missing fonts, the processing method is the same and will not be described again.

    • When closing, the process exits uncleanly and kills them all directly. Generally, it is not closed very much.

      1pkill WeChat
      
    • There is currently no solution under wine system tray and waybar. It seems that we have to wait for wine to merge the code, which will have little impact.

    • Some functions are unavailable

Write at the end

Using your own compilation method is cumbersome and has to be done in some cases. I am also impressed by the power of the wine project. Now I use the wine compiled by myself, which feels good! If the computer configuration is high, the compilation time is expected to be reduced a lot.

At this point, DingTalk, Feishu, and WeChat can all be used smoothly under Linux. If readers have questions, they can search for relevant tutorials on this site.

Lastmod๏ผš Thursday, December 28, 2023

See Also:

Translations: