- Note
- In case you struggle with setting up userver dependencies there are other options:
Platform-specific build dependencies
Paths to dependencies start from the directory of your service.
Ubuntu 24.04 (Noble Numbat)
Dependencies: third_party/userver/scripts/docs/en/deps/ubuntu-24.04.md
Dependencies could be installed via:
sudo apt install --allow-downgrades -y $(cat third_party/userver/scripts/docs/en/deps/ubuntu-24.04.md | tr '\n' ' ')
Ubuntu 22.04 (Jammy Jellyfish)
Dependencies: third_party/userver/scripts/docs/en/deps/ubuntu-22.04.md
Dependencies could be installed via:
sudo apt install --allow-downgrades -y $(cat third_party/userver/scripts/docs/en/deps/ubuntu-22.04.md | tr '\n' ' ')
Ubuntu 21.10 (Impish Indri)
Dependencies: third_party/userver/scripts/docs/en/deps/ubuntu-21.10.md
Dependencies could be installed via:
sudo apt install --allow-downgrades -y $(cat third_party/userver/scripts/docs/en/deps/ubuntu-21.10.md | tr '\n' ' ')
Ubuntu 20.04 (Focal Fossa)
Dependencies: third_party/userver/scripts/docs/en/deps/ubuntu-20.04.md
Dependencies could be installed via:
sudo apt install --allow-downgrades -y $(cat third_party/userver/scripts/docs/en/deps/ubuntu-20.04.md | tr '\n' ' ')
Recommended Makefile.local:
CMAKE_COMMON_FLAGS += \
-DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0 \
-DUSERVER_FEATURE_REDIS_HI_MALLOC=1
Ubuntu 18.04 (Bionic Beaver)
Dependencies: third_party/userver/scripts/docs/en/deps/ubuntu-18.04.md
Dependencies could be installed via:
bash
sudo apt install --allow-downgrades -y $(cat third_party/userver/scripts/docs/en/deps/ubuntu-18.04.md | tr '\n' ' ')
Recommended Makefile.local:
CMAKE_COMMON_FLAGS += \
-DCMAKE_CXX_COMPILER=g++-8 \
-DCMAKE_C_COMPILER=gcc-8 \
-DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0 \
-DUSERVER_FEATURE_CRYPTOPP_BASE64_URL=0 \
-DUSERVER_USE_LD=gold
Debian 11
Dependencies: third_party/userver/scripts/docs/en/deps/debian-11.md
Debian 11 32-bit
Dependencies: third_party/userver/scripts/docs/en/deps/debian-11.md (same as above)
Recommended Makefile.local:
CMAKE_COMMON_FLAGS += \
-DCMAKE_C_FLAGS='-D_FILE_OFFSET_BITS=64' \
-DCMAKE_CXX_FLAGS='-D_FILE_OFFSET_BITS=64'
Fedora 35
Dependencies: third_party/userver/scripts/docs/en/deps/fedora-35.md
Fedora dependencies could be installed via:
sudo dnf install -y $(cat third_party/userver/scripts/docs/en/deps/fedora-35.md | tr '\n' ' ')
Recommended Makefile.local:
CMAKE_COMMON_FLAGS += \
-DUSERVER_FEATURE_STACKTRACE=0 \
-DUSERVER_FEATURE_PATCH_LIBPQ=0
Fedora 36
Dependencies: third_party/userver/scripts/docs/en/deps/fedora-36.md
Fedora dependencies could be installed via:
sudo dnf install -y $(cat third_party/userver/scripts/docs/en/deps/fedora-36.md | tr '\n' ' ')
Recommended Makefile.local:
CMAKE_COMMON_FLAGS += \
-DUSERVER_FEATURE_STACKTRACE=0 \
-DUSERVER_FEATURE_PATCH_LIBPQ=0
Gentoo
Dependencies: third_party/userver/scripts/docs/en/deps/gentoo.md
Dependencies could be installed via:
sudo emerge --ask --update --oneshot $(cat scripts/docs/en/deps/gentoo.md | tr '\n' ' ')
Recommended Makefile.local:
CMAKE_COMMON_FLAGS += \
-DUSERVER_CHECK_PACKAGE_VERSIONS=0
Alpine
Dependencies: third_party/userver/scripts/docs/en/deps/alpine.md
Dependencies could be installed via:
sudo apk add $(cat scripts/docs/en/deps/alpine.md)
Recommended Makefile.local:
CMAKE_COMMON_FLAGS += \
-DUSERVER_FEATURE_JEMALLOC=OFF \
-DUSERVER_FEATURE_STACKTRACE=OFF \
-DUSERVER_FEATURE_KAFKA=OFF \
-DUSERVER_DOWNLOAD_PACKAGE_PROTOBUF=ON \
-DUSERVER_DISABLE_RSEQ_ACCELERATION=YES
Arch, Manjaro
Dependencies: third_party/userver/scripts/docs/en/deps/arch.md
Using an AUR helper (pikaur in this example) the dependencies could be installed as:
pikaur -S $(cat third_party/userver/scripts/docs/en/deps/arch.md | sed 's/^makepkg|//g' | tr '\n' ' ')
Without AUR:
sudo pacman -S $(cat third_party/userver/scripts/docs/en/deps/arch.md | grep -v -- 'makepkg|' | tr '\n' ' ')
cat third_party/userver/scripts/docs/en/deps/arch.md | grep -oP '^makepkg\|\K.*' | while read ;\
do \
DIR=$(mktemp -d) ;\
git clone https://aur.archlinux.org/$REPLY.git $DIR ;\
pushd $DIR ;\
yes|makepkg -si ;\
popd ;\
rm -rf $DIR ;\
done
Recommended Makefile.local:
CMAKE_COMMON_FLAGS += \
-DUSERVER_FEATURE_PATCH_LIBPQ=0
MacOS
Dependencies: third_party/userver/scripts/docs/en/deps/macos.md. At least MacOS 10.15 required with Xcode and Homebrew.
Dependencies could be installed via:
brew install $(cat third_party/userver/scripts/docs/en/deps/macos.md | tr '\n' ' ')
Recommended Makefile.local:
CMAKE_COMMON_FLAGS += \
-DUSERVER_CHECK_PACKAGE_VERSIONS=0 \
-DUSERVER_FEATURE_REDIS_HI_MALLOC=1 \
-DUSERVER_FEATURE_CRYPTOPP_BLAKE2=0
After that the make test
would build and run the service tests.
- Warning
- MacOS is recommended only for development as it may have performance issues in some cases.
Windows (WSL2)
Windows native development is not supported, there is no plan to support Windows native development in the near future. You need to use WSL2.
First, install WSL2 with Ubuntu 24.04. Next, follow Ubunty 24.04 instructions.
Other POSIX based platforms
🐙 userver works well on modern POSIX platforms. Follow the cmake hints for the installation of required packets and experiment with the CMake options.
Feel free to provide a PR with instructions for your favorite platform at https://github.com/userver-framework/userver.
If there's a strong need to build only the userver and run its tests, then see Build instructions for userver's own samples, tests and benchmarks
PostgreSQL versions
If CMake option USERVER_FEATURE_PATCH_LIBPQ is on, then the same developer version of libpq, libpgport and libpgcommon libraries should be available on the system. If there are multiple versions of those libraries use USERVER_PG_*
CMake options to aid the build system in finding the right version.
You could also install any version of the above libraries by explicitly pinning the version. For example in Debian/Ubuntu pinning to version 14 could be done via the following commands:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7FCC7D46ACCC4CF8
echo "deb https://apt-archive.postgresql.org/pub/repos/apt jammy-pgdg-archive main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo mkdir -p /etc/apt/preferences.d
printf "Package: postgresql-14\nPin: version 14.5*\nPin-Priority: 1001\n" | sudo tee -a /etc/apt/preferences.d/postgresql-14
printf "Package: postgresql-client-14\nPin: version 14.5*\nPin-Priority: 1001\n" | sudo tee -a /etc/apt/preferences.d/postgresql-client-14
sudo apt install --allow-downgrades -y postgresql-14 postgresql-client-14
printf "Package: libpq5\nPin: version 14.5*\nPin-Priority: 1001\n" | sudo tee -a /etc/apt/preferences.d/libpq5
printf "Package: libpq-dev\nPin: version 14.5*\nPin-Priority: 1001\n"| sudo tee -a /etc/apt/preferences.d/libpq-dev
sudo apt install --allow-downgrades -y libpq5 libpq-dev