Skip to content

Build From Source

Software Dependencies

  • git
  • GCC
  • pkg-config
  • cmake
  • protoc (protobuf compiler) >= v29.1
  • openssl
  • openssl-dev
  • rustup
  • Java 11
  • ziglang and zigbuild (for GNU Linux only)
  • valkey (for testing)

See the Valkey installation guide to install the Valkey server and CLI.

  1. Terminal window
    sudo apt update -y
    sudo apt install -y git gcc pkg-config openssl libssl-dev unzip cmake python3
    # Install rust
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    source "$HOME/.cargo/env"
    # Check that the Rust compiler is installed
    rustc --version
    Terminal window
    pip3 install ziglang
    cargo install --locked cargo-zigbuild
    Terminal window
    PB_REL="https://github.com/protocolbuffers/protobuf/releases"
    curl -LO $PB_REL/download/v29.1/protoc-29.1-linux-x86_64.zip
    unzip protoc-29.1-linux-x86_64.zip -d $HOME/.local
    export PATH="$PATH:$HOME/.local/bin"
    protoc --version

    Other platform-specific binaries can be found here.

  2. Terminal window
    sudo apt update
    sudo apt install -y openjdk-11-jdk
  3. Terminal window
    mkdir -p $HOME/src
    cd $HOME/src
    git clone https://github.com/valkey-io/valkey-glide.git
    cd valkey-glide
  4. Terminal window
    cd java
    ./gradlew :client:buildAll

If the build fails after following the installation instructions, the gradle daemon may need to be restarted (./gradlew --stop) so that it recognizes changes to environment variables (e.g. $PATH). If that doesn’t work, you may need to restart your machine. In particular, this may solve the following problems:

  • Failed to find cargo after rustup.
  • No Protobuf compiler (protoc) found.
> Task :client:compileJava FAILED
/Users/Alex.Le/bq/valkey-glide/java/client/src/main/java/glide/models/protobuf/response/ResponseOuterClass.java:9: error: cannot find symbol
public final class ResponseOuterClass extends com.google.protobuf.GeneratedFile {
^
symbol: class GeneratedFile
location: package com.google.protobuf

This error indicate that the Protobuf version is incorrect. For Java client, only Protobuf version 29.1.x is supported.

Terminal window
%protoc --version
libprotoc 29.1