Compiling
Build uhub from source with CMake.
Prerequisites
- CMake 3.21 or newer
- A C compiler — GCC, Clang or MinGW
- OpenSSL 3.0+ or LibreSSL 3.4+ (TLS is mandatory)
- SQLite3
Getting the source
Building from git needs submodules — the test framework is one, and QuickJS is another if you enable JavaScript plug-ins:
git clone --recurse-submodules https://github.com/janvidar/uhub.git
# or, in an existing clone:
git submodule update --init
Linux, macOS, BSD, Solaris
An out-of-tree build is recommended:
mkdir -p build && cd build
cmake ..
make -j
make install
Build options
| Option | Default | Description |
|---|---|---|
-DRELEASE | ON | Turn off for a debug build. |
-DJAVASCRIPT_SUPPORT | OFF | Build mod_javascript, embedding QuickJS. Needs the third_party/quickjs submodule. |
-DSYSTEMD_SUPPORT | OFF | systemd socket activation and notification. |
-DADC_STRESS | OFF | Build the stress-tester client. |
Run the test suite from the build directory with ctest, or by running ./autotest-bin directly.
Default install directories:
| Binaries | /usr/local/bin/ |
|---|---|
| Configuration files | /etc/uhub/ |
| Plug-ins | /usr/lib/uhub/ |
| Manual pages | /usr/share/man/man1/ |
Debian & Ubuntu
Install the dependencies:
sudo apt-get install cmake make gcc git libsqlite3-dev libssl-dev
Check out the source code:
git clone https://github.com/janvidar/uhub.git
Then build as described above.
Building against LibreSSL
If both OpenSSL and LibreSSL are installed, point CMake at the LibreSSL prefix:
cmake -DOPENSSL_ROOT_DIR=/path/to/libressl ..
The configure output prints the detected TLS provider, e.g. TLS provider: LibreSSL 3.5.3.
For a sanitizer build that catches bounds bugs, configure with
-DCMAKE_C_FLAGS="-fsanitize=address -g -O1" and
-DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address".