bevy/docs/linux_dependencies.md
Zhe Chen 836ffeda31 Add missing dependencies for Fedora with Wayland (#3708)
# Objective

- The Linux dependencies document lacks packages for Fedora with Wayland.

## Solution

- Add instructions to install packages for running Bevy apps in Fedora with Wayland.
2022-01-17 22:22:16 +00:00

105 lines
3 KiB
Markdown

# Installing Linux dependencies
This page lists the required dependencies to build a Bevy project on your Linux machine.
If you don't see your distro present in the list, feel free to add the instructions in this document.
## Ubuntu 20.04
```bash
sudo apt-get install g++ pkg-config libx11-dev libasound2-dev libudev-dev
```
if using Wayland, you will also need to install
```bash
sudo apt-get install libwayland-dev libxkbcommon-dev
```
Depending on your graphics card, you may have to install one of the following:
`vulkan-radeon`, `vulkan-intel`, or `mesa-vulkan-drivers`
Compiling with clang is also possible - replace the `g++` package with `clang`.
### Windows Subsystem for Linux (WSL 2)
Graphics and audio need to be configured for them to work with WSL 2 backend.
Please see the ubuntu [WSL documentation](https://wiki.ubuntu.com/WSL) on how to set up graphics and audio.
## Fedora
```bash
sudo dnf install gcc-c++ libX11-devel alsa-lib-devel systemd-devel
```
if using Wayland, you will also need to install
```bash
sudo dnf install wayland-devel libxkbcommon-devel
```
If there are errors with linking during the build process such as:
```bash
= note: /usr/bin/ld: skipping incompatible /usr/lib/libasound.so when searching for -lasound
/usr/bin/ld: skipping incompatible /usr/lib/libasound.so when searching for -lasound
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/10/../../../libasound.so when searching for -lasound
/usr/bin/ld: skipping incompatible /lib/libasound.so when searching for -lasound
/usr/bin/ld: skipping incompatible /usr/lib/libasound.so when searching for -lasound
/usr/bin/ld: cannot find -lasound
```
Add your arch to the end of the package to remove the linker error. For example:
```bash
sudo dnf install alsa-lib-devel.x86_64
```
## Arch / Manjaro
```bash
sudo pacman -S libx11 pkgconf alsa-lib
```
Install `pipewire-alsa` or `pulseaudio-alsa` depending on the sound server you are using.
## Void
```bash
sudo xbps-install -S pkgconf alsa-lib-devel libX11-devel eudev-libudev-devel
```
## NixOS
Add a `shell.nix` file to the root of the project containing:
```nix
# shell.nix
{ pkgs ? import <nixpkgs> {} }:
with pkgs; mkShell {
nativeBuildInputs = [
pkgconfig
clang lld # To use lld linker
];
buildInputs = [
udev alsaLib vulkan-loader
x11 xorg.libXcursor xorg.libXrandr xorg.libXi # To use x11 feature
libxkbcommon wayland # To use wayland feature
];
shellHook = ''export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath [
udev alsaLib vulkan-loader
libxkbcommon wayland # To use wayland feature
]}"'';
}
```
And enter it by just running `nix-shell`. You should be able compile bevy programms using `cargo` within this nix-shell.
Note that this template doesn't add Rust to the environment because there are many ways to do it, each with its pros and cons. For example, to use stable Rust from nixpkgs you can add `cargo` to `nativeBuildInputs`.
## Opensuse Tumbleweed
```bash
sudo zypper install libudev-devel gcc-c++
```