About Blog Contact

Installing WeChat with Wine

I installed WeChat’s PC client on my Ubuntu machine today. Here I documents this process.

Installation Steps

  1. Install wine. Use Ubuntu’s respository:
    sudo apt install wine
    
  2. Init a WINEPREFIX. Wine stores configurations and files for a setup under a directory specified by the WINEPREFIX environment variable. By default its $HOME/.wine. To not mess up the configuration of other files, we make a separate WINEPREFIX for WeChat. Also, WeChat uses Win32 API, so we set the architecture to win32. Run:
    export WINEARCH=win32
    export WINEPREFIX=~/.wine32
    winecfg
    

    When running the following commands and when running WeChat, remember to set WINEARCH and WINEPREFIX.

  3. Screen resolution. If you are using an HiDPI screen, screen resolutions could be a problem: the software may have it’s fonts and other components’ sizes fixed, so it may look really small. Changing the Screen resolution may solve this problem. So when the winecfg’s configuraton window comes up, Change “Graphics” -> “Screen Resolution” to a bigger value.

  4. Install winetricks. It’s a helper script to download and install various redistributable runtime libraries and fonts. Due to copyright reasons, wine cannot distribute those proprietary software, but users can download them, and this script does exactly this. Install it using apt-get:
    sudo apt install winetricks
    

    We use it to install Chinese fonts and other packages:

    winetricks corefonts gdiplus riched20 riched30 wenquanyi
    

    This downloads a few hundreds of megabytes of data, so be patient. Also, most of these servers are located outside of mainland China, so many will be very slow. You can use a VPN, but also you can download it yourself. Start the script, and when its downloading a software or font, it will show the URL and the destination, like this:

    Downloading https://download.microsoft.com/download/0/A/F/0AFB5316-3062-494A-AB78-7FB0D4461357/windows6.1-KB976932-X64.exe to /home/mengyibai/.cache/winetricks/win7sp1
    

    If things gets slow, you can download the file yourself and put it in it’s destination. In the above case, its /home/mengyibai/.cache/winetricks/win7sp1. Then stop the script and restart, it’ll continue off where it stopped, and won’t redownload anything. Here are the files that are needed for these packages. Note that these files may change, and I may not be able to keep them up to date.

  5. Set up fonts. Download this registry configuration file, originially from here. Run:
    regedit /path/to/configuration/file
    

    This sets up the Chinese fonts, and other thing (of which I don’t understand much).

  6. Install WeChat. Download WeChat’s installer, and run wine to install it:
    wine WeChat_C1018.exe 
    

    You may launch it through the commandline:

    WINEARCH=win32 WINEPREFIX=~/.wine32/ wine ~/.wine32/drive_c/Program\ Files/Tencent/WeChat/WeChat.exe 
    

    Or you may click on the launch icon in your desktop.

Unsolved Problems

I still have some unsolved problems:

  1. Chinese input method not working. Arch has a post that claims to offer a solution, but I haven’t had a chance to study it yet.
  2. Floating icons. There are three floating icons after starting the main program: a system tray (that can be safely closed), a small black windows that’s supposed to be for notifications and an unknown window which goes away after emoji autocomplete is triggered. No error messages are shown regarding these windows.
  3. Camera not working for video chat. Of course, that could be my laptop’s problem, not wine’s.
  4. Ctrl-Alt-W shortcut. That’s probably impossible to “fix”, so I probably need to write a script that hooks to gnome’s shortcut controller.

Reference

This post is mostly a clarification of a post on ferrolho.github.io. Other references are linked inline.