Compile Mozilla VPN client from source
What is Mozilla VPN
Mozilla VPN is a VPN client developed by Mozilla. It is open source and uses WireGuard. It is available for Linux, Windows, Mac, Android, and iOS. To use it, you need to buy a subscription from Mozilla.
Building from source
As usual, Linux binaries are only provided for Debian-based systems. If you want to run Mozilla’s VPN client on e.g., Gentoo, you might want to build from source.
So cloning the repository is the first step:
git clone https://github.com/mozilla-mobile/mozilla-vpn-client
It uses git submodules, so we have to do
git submodule init
git submodule update
The project uses cmake
, so it should be easy enough. In theory!
If you do not have rust
installed yet, that is the time!
Get the toolchain installer and run rustup default stable
to get everything set up.
Also, you need wireguard
and its wireguard-tools
installed.
Surprisingly, Gentoo’s Qt
is currently too old (Qt6
is required by the vpn client) and even with the qt overlay and after unmasking a bunch of hard-masked stuff I was not able to produce a successful build.
So I figured that I had to compile Qt6
from source first.
I was delighted when I found out that in the repository of the vpn client a script is provided for that exact purpose!
Building Qt6
How nice! So downloading and unpacking the qt6
sources and running
scripts/utils/qt6_compile.sh path/to/qt-everywhere-src-6.2.4 path/to/destination
should be all that is needed for that.
However, I learned that my cmake was not built with zstd support and I did not find a quick way to resolve that in Gentoo. So, I added the line
set(QT_AVOID_CMAKE_ARCHIVING_API ON)
in CMakeLists.txt
of the qt6
sources and then everything was fine.
Update 2023-11
It seems that in some cases, qt6.6 has issues building and you might need to add
-skip qtspeech \
to scripts/utils/qt6_compile.sh
Building Mozilla VPN Client
First, we need to install the python dependencies:
pip install -r requirements.txt --user
Now we can use the compiled qt6
to configure the project:
mkdir build && cmake -S . -B build -DCMAKE_PREFIX_PATH=path/to/qt6/lib/cmake
If everything went well, we compile the vpn client:
cmake --build build -j$(nproc)
Finally,
sudo cmake --install build
installs everything to /usr/local
including a .desktop
file in /usr/local/share/applications
, so you can start the tool conveniently.