Installation
Supported Platforms
TQUIC is written in the Rust language. Currently, it runs on Linux, MacOS, FreeBSD, Windows, iOS, Android and Harmony.
Prerequisites
Building
- Linux
- MacOS
- FreeBSD
- Windows
- Android
- iOS
- Harmony
To build TQUIC for Linux, run the following commands:
git clone https://github.com/tencent/tquic --recursive
cd tquic
cargo build --release --all
The --release
option enables cargo to build optimized artifacts and put them in the directory ./target/release/
, instead of the default location ./target/debug/
.
The --all
option enables cargo to build both the tquic library and example tools.
If you want to enable the C API, just add -F ffi
option to the cargo build
command:
cargo build --release -F ffi
To build TQUIC for MacOS, run the following commands:
git clone https://github.com/tencent/tquic --recursive
cd tquic
cargo build --release --all
The --release
option enables cargo to build optimized artifacts and put them in the directory ./target/release/
, instead of the default location ./target/debug/
.
The --all
option enables cargo to build both the tquic library and example tools.
If you want to enable the C API, just add -F ffi
option to the cargo build
command:
cargo build --release -F ffi
To build TQUIC for FreeBSD, you need the following:
sudo pkg install -y gmake
To build TQUIC for FreeBSD, run the following commands:
git clone https://github.com/tencent/tquic --recursive
cd tquic
cargo build --release --all
The --release
option enables cargo to build optimized artifacts and put them in the directory ./target/release/
, instead of the default location ./target/debug/
.
The --all
option enables cargo to build both the tquic library and example tools.
If you want to enable the C API, just add -F ffi
option to the cargo build
command:
cargo build --release -F ffi
To build TQUIC for Windows, you need the following:
To build TQUIC for Windows, run the following commands:
git clone https://github.com/tencent/tquic --recursive
cd tquic
cargo build --release --all
The --release
option enables cargo to build optimized artifacts and put them in the directory .\target\release\
, instead of the default location .\target\debug\
.
The --all
option enables cargo to build both the tquic library and example tools.
If you want to enable the C API, just add -F ffi
option to the cargo build
command:
cargo build --release -F ffi
To build TQUIC for Android, you need the following:
- Install Android NDK and set the
ANDROID_NDK_HOME
environment variable
# Set the ANDROID_NDK_HOME environment variable to the NDK installation path
export ANDROID_NDK_HOME=/path/to/android-ndk
- Install Rust toolchain for Android and cargo-ndk
# Install Rust toolchain for Android
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
# Install cargo-ndk for building libraries for Android without hassle
cargo install cargo-ndk
To build the TQUIC library, run the following commands:
git clone https://github.com/tencent/tquic --recursive
cd tquic
# The -t <architecture> and -p <NDK version> options are mandatory.
cargo ndk -t arm64-v8a -p 21 -- build --features ffi --release
The --release
option enables cargo to build optimized artifacts and put them in the directory ./target/release/
, instead of the default location ./target/debug/
.
The --features ffi
option enables cargo to build the C API.
To build TQUIC for iOS, you need the following:
- Install Xcode and Xcode command-line tools
# Install Xcode command-line tools.
xcode-select --install
- Install Rust toolchain for iOS and cargo-lipo
# Install the Rust toolchain for iOS
rustup target add aarch64-apple-ios x86_64-apple-ios
# Install cargo-lipo for automatically creating universal libraries for iOS
cargo install cargo-lipo
To build the TQUIC library, run the following commands:
git clone https://github.com/tencent/tquic --recursive
cd tquic
cargo lipo --features ffi --release
The --release
option enables cargo to build optimized artifacts and put them in the directory ./target/release/
, instead of the default location ./target/debug/
.
The --features ffi
option enables cargo to build the C API.
To build TQUIC for Harmony, you need the following:
- Install OHOS NDK and set the
OHOS_NDK_HOME
environment variable
wget https://repo.huaweicloud.com/openharmony/os/4.0-Release/ohos-sdk-windows_linux-public.tar.gz
tar -xvzf ohos-sdk-windows_linux-public.tar.gz
cd ohos-sdk/linux/
unzip native-linux-x64-4.0.10.13-Release.zip
# Set the OHOS_NDK_HOME environment variable to the NDK installation path for Linux
# eg. export OHOS_NDK_HOME=/path/to/ohos-sdk/linux/
export OHOS_NDK_HOME=`pwd`
- Install Rust toolchain for Harmony and ohrs
# Install the Rust toolchain for Harmony
rustup target add aarch64-unknown-linux-ohos armv7-unknown-linux-ohos x86_64-unknown-linux-ohos
# ohrs is a scaffolding tool designed to streamline the Rust build process for OpenHarmony.
cargo install ohrs
To build the TQUIC library, run the following commands:
git clone https://github.com/tencent/tquic --recursive
cd tquic
ohrs build -- --features ffi --release
The --release
option enables cargo to build optimized artifacts and put them in the directory ./target/release/
, instead of the default location ./target/debug/
.
The --features ffi
option enables cargo to build the C API.
Running the tests
The command below runs unit tests:
cargo test
Further readings
Problems?
- Please refer to the documentation for common installation issues first.
- Ask for help on our GitHub issues.