These are instructions on how to build the app on desktop platforms. See the readme for help building on other platforms.
These instructions are probably not complete. If you find something more that needs installing on your platform please submit an issue or a pull request.
-
Get the latest stable Rust toolchain via rustup.rs.
- Install default targets and components needed for your platform:
./scripts/setup-rust android|ios|windows|linux|macos
- (Optional) Run the following to install a git
post-checkouthook that will automatically run thesetup-rustscript when the Rust version specified in therust-toolchain.tomlfile changes:.scripts/setup-rust install-hook
- Install default targets and components needed for your platform:
-
You need Node.js and npm. You can find the exact versions in the
voltasection ofdesktop/package.json. The toolchain is managed by volta. This is optional if using--daemon-only.-
Linux
Follow instructions on volta.sh
-
macOS
brew install volta && volta setup -
Windows
Install the
msihosted here: https://github.com/volta-cli/volta
-
-
Install Go (ideally version
1.21) by following the official instructions. Newer versions may work too. This is optional if using--gotatun. -
Install a protobuf compiler (version 3.15 and up), it can be installed on most major Linux distros via the package name
protobuf-compiler,protobufon macOS via Homebrew, and on Windows binaries are available on their GitHub page and they have to be put in%PATH. An additional package might also be required depending on Linux distro:protobuf-develon Fedora.libprotobuf-devandprotobuf-compileron Debian/Ubuntu.
-
bashmust be installed and available in PATH on all platforms. This is required for building the desktop app: -
Bash version 4.0 or later is required for all platforms and must be added to your PATH environment variable.
- Linux: Bash is typically installed by default, otherwise refer to your distribution for instructions on how to install it.
- macOS: The default installed version (3.2.5) is not supported. Install a newer version via Homebrew:
brew install bash - Windows: Install Git for Windows which includes Git Bash and other required unix utilities.
-
Install
podman: https://podman.io/- Used to generate gRPC bindings for the Electron app.
# For building the daemon
sudo apt install gcc libdbus-1-dev
# For building the installer
sudo apt install rpm# For building the daemon
sudo dnf install gcc dbus-devel
# For building the installer
sudo dnf install rpm-buildThis is supported on Linux (x86_64) as well as macOS (x86_64 and aarch64). Install nix if you haven't already.
nix developProvided in the repository root is a direnv for automatically sourcing the devshell.
Allow it by executing direnv allow . (in <repository>) once.
By default, the app will build for the host platform. It is also possible to cross-compile the app for ARM64 on x64.
# As root
dpkg --add-architecture arm64 && \
apt update && \
apt install libdbus-1-dev:arm64 gcc-aarch64-linux-gnurustup target add aarch64-unknown-linux-gnuTo make sure the right linker and libraries are used, add the following to ~/.cargo/config.toml:
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
[target.aarch64-unknown-linux-gnu.dbus]
rustc-link-search = ["/usr/aarch64-linux-gnu/lib"]
rustc-link-lib = ["dbus-1"]
The host has to have the following installed:
-
Microsoft's Build Tools for Visual Studio 2022 (a regular installation of Visual Studio 2022 Community or Pro edition works as well).
-
Windows 10 (or Windows 11) SDK.
-
bashand base Unix utilities must be installed and available in PATH (see the requirement in the All platforms section above). -
ziginstalled and available in%PATH%. 0.14 or later is recommended: https://ziglang.org/download/. -
msbuild.exeavailable in%PATH%. If you installed Visual Studio Community edition, the binary can be found under:C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\<arch>Where
<arch>refers to the host architecture, eitheramd64orarm64.The environment can also be set up in bash by sourcing
vcvars.sh:. ./scripts/vcvars.sh. Note that that script assumes that you're running VS 2022 Community. -
The
x86target is required for building some NSIS plugins:rustup target add i686-pc-windows-msvc
By default, the app will build for the host platform. It is also possible to cross-compile the app for ARM64 on x64. This requires:
-
The ARM64 MSVC tools added to Visual Studio.
-
clang(either directly from llvm.org or as part of Visual Studio) on thePATH. -
The
AArch64target added to Rust:
rustup target add aarch64-pc-windows-msvcIn addition to the above requirements:
-
clangis required (can be found in the Visual Studio installer) inPATH.INCLUDEalso needs to include the correct headers for clang. This can be found by runningvcvarsall.bat arm64and typingset INCLUDE.The environment can also be set up in bash by sourcing
vcvars.sh:. ./scripts/vcvars.sh. Note that that script assumes that you're running VS 2022 Community.
The host has to have the following installed:
-
A recent version of
bash. The default version in macOS (3.2.57) isn't supported. -
clangis required for CGo.
The simplest way to build the entire app and generate an installer is to just run the build script.
--optimize can be added to enable compiler optimizations. This will take longer to build but will
produce a smaller installer and installed binaries:
./build.sh [--optimize]This should produce an installer exe, pkg or rpm+deb file in the dist/ directory.
Building this requires at least 1GB of memory.
--daemon-only- This will build daemon only Linux packages (e.g.mullvad-vpn-daemon). You will need to install additional build tools:cargo install cargo-deb cargo-generate-rpm.--gotatun- This will build with thegotatunRust library instead thewireguard-go-rsGo library.
By default, build.sh produces a pkg for your current architecture only. To build a universal
app that works on both Intel and Apple Silicon macs, build with --universal.
To cross-compile for ARM64 rather than the current architecture, set the TARGETS environment
variable to aarch64-unknown-linux-gnu:
TARGETS="aarch64-unknown-linux-gnu" ./build.shTo cross-compile for ARM64 from another host architecture, set the TARGETS environment
variable to aarch64-pc-windows-msvc:
TARGETS="aarch64-pc-windows-msvc" ./build.shYou may have to specify USE_SYSTEM_FPM=true to generate the deb/rpm packages.
These instructions are for building, packaging and installing the Mullvad VPN daemon and CLI interface for use with RISC-V systems. It includes support for RVA22 and RVA23 profiles; for example, on Framework Laptop 13 with DeepComputing RISC-V Mainboards running Ubuntu.
Build and package:
./build.sh --daemon-only --optimizeInstall on Debian/Ubuntu:
sudo dpkg -i dist/mullvad-vpn-daemon_<version>_riscv64.debInstall on Fedora:
sudo dnf install dist/mullvad-vpn-daemon_<version>_riscv64.rpmInstall dependencies:
# As root
dpkg --add-architecture riscv64 && \
apt update && \
apt install libdbus-1-dev:riscv64 gcc-riscv64-linux-gnuAdd target to Rust toolchain:
rustup target add riscv64gc-unknown-linux-gnuUpdate your local Cargo configuration to use the correct linker and libraries, add the
following ~/.cargo/config.toml:
[target.riscv64gc-unknown-linux-gnu]
linker = "riscv64-linux-gnu-gcc"
[target.riscv64gc-unknown-linux-gnu.dbus]
rustc-link-search = ["/usr/riscv64-linux-gnu/lib"]
rustc-link-lib = ["dbus-1"]
Build and package:
TARGETS="riscv64gc-unknown-linux-gnu" ./build.sh --daemon-only --optimizeThis section is for building the system service individually.
-
On Windows, build the C++ libraries:
./build-windows-modules.sh
And copy the
wintun.dllnext to the daemon binary:cp dist-assets/binaries/x86_64-pc-windows-msvc/wintun.dll target/debug/
-
Build the system daemon plus the other Rust tools and programs:
cargo build
-
On Windows, the daemon must be run as the SYSTEM user. You can use PsExec to launch an elevated bash instance before starting the daemon in it:
psexec64 -i -s bash.exe -
Run the daemon with verbose logging (from the root directory of the project):
sudo MULLVAD_RESOURCE_DIR="./dist-assets" ./target/debug/mullvad-daemon -vvLeave out
sudoon Windows. The daemon must run as root since it modifies the firewall and sets up virtual network interfaces etc.
This section is for building the desktop app individually.
-
Go to the
desktopdirectorycd desktop -
Install all the JavaScript dependencies by running:
npm install -w mullvad-vpn
-
Start the Electron app in development mode by running:
npm run -w mullvad-vpn develop
If you change any javascript file while the development mode is running it will automatically transpile and reload the file so that the changes are visible almost immediately.
Please note that the Electron app needs a running daemon to connect to in order to work. See Building and running mullvad-daemon for instructions on how to do that before starting the Electron app.