Since SiriusDB is an extension to DuckDB, the CMake project source is actually the duckdb directory (a submodule of
this project), which then pulls in SiriusDB as an extension. We use
- symlinked sirius-specific
CMakePresets.json(atcmake/CMakePresets.json) to version control the build config. - pixi to manage build dependencies.
Clone the repository with all submodules:
git clone --recurse-submodules https://github.com/sirius-db/sirius.git
cd siriusBuild with Pixi (uses all available cores). The default target is release (GCC Release):
pixi run make # GCC Release (default)
pixi run make clang-relwithdebinfo # Clang RelWithDebInfo
pixi run make clang-debug # Clang DebugIf the build exhausts memory, reduce parallelism:
CMAKE_BUILD_PARALLEL_LEVEL=8 pixi run makeRun the Sirius-linked DuckDB binary — the extension is statically built in and loads automatically:
./build/release/duckdbAlternatively, load the extension into an existing DuckDB shell:
LOAD 'build/release/extension/sirius/sirius.duckdb_extension';Sirius uses pre-commit hooks to enforce formatting and linting. Install the hooks after cloning so every commit is checked automatically:
pixi run pre-commit installTo run all hooks manually across the whole tree:
pixi run pre-commit run -aRun the full C++ unit test suite (what CI runs):
pixi run make testRun tests by Catch2 tag or name:
pixi run build/release/extension/sirius/test/cpp/sirius_unittest "[cpu_cache]"
pixi run build/release/extension/sirius/test/cpp/sirius_unittest "test_cpu_cache_basic_string_single_col"CLion does not natively support pixi environments. One way to circumvent that is to create a custom
toolchain for sirius and load the pixi environment via an environment file. This allows a consistent use of CLion, both
when using natively on a system, or via the remote development workflow. To support this, the clion-env task creates a
sirius_pixi_env_for_clion.sh file inside the build directory (ignored by default).
- Run
pixi run clion-env. This will generate/update thesirius_pixi_env_for_clion.sh. - Choose correct
CMakeLists.txt:- Open the sirius directory in CLion. CLion will ask how load the project, as a
Makefileproject or aCMakeproject, chooseCMake. - Choosing
CMakeproject will fail with configure errors, because as detailed earlier, the actual CMake source of the project is theduckdbsubmodule dir, but CLion assumes the rootCMakeLists.txtto be the source. - To fix, go to
Tools > CMake > Unload CMake Project, then open any cpp file in the sirius src dir, a banner will showup:This file does not belong to any project targetwith aFixbutton to the right. - Click
Fixand selectChoose CMakeLists.txt, and navigate to theduckdbsubdir and choose itsCMakeLists.txt.
- Open the sirius directory in CLion. CLion will ask how load the project, as a
- Add sirius-specific toolchain:
- Open settings, under
Build, Execution, Deployment > Toolchainsclick the+button to add a new toolchain. Name it something likeSiriusfor easy differentiation. - In the upper right corner there should be a link named
Add Environment. Click it and chooseFrom File. - Navigate to and select the
sirius_pixi_env_for_clion.shinside the build directory. - Verify the toolchain has properly inherited the pixi env. Open settings, under
Build, Execution, Deployment > Toolchains > Sirius, theC CompilerandC++ Compilershould have detected the pixi env compilers which can be verified by hovering over theDetected ...box. - Goto
Build, Execution, Deployment > CMake, this should have a set to presets already loaded. Duplicate and enable the ones you need and make them use theSiriustoolchain that has the pixi compilers. We need to duplicate the preset profiles to make the use our custom toolchain, as they use theDefaulttoolchain by default.
- Open settings, under
- Click
Applyto save the changes. CLion should now properly configure the project, allowing you to build and debug.
An alternate way to use CLion with the pixi-provided tools (compilers, CMake, ninja, etc.) is
to launch CLion from a shell where the pixi environment is already active, so
that the CLion process inherits the correct PATH and environment variables. This works best when one is only using
CLion natively on a machine directly, and not via remote connections.
Quit all existing CLion instances (more on that below), then inside the sirius root dir
pixi shell
/path/to/clion.sh .Where /path/to/clion.sh is the real CLion launcher, not the JetBrains
Toolbox wrapper (again, more info below). For a typical Toolbox install
on Linux this is along the lines of:
~/.local/share/JetBrains/Toolbox/apps/clion/ch-0/<version>/bin/clion.sh
You can add a shell function to your ~/.bashrc (or equivalent) for
convenience:
real_clion() {
/path/to/clion.sh "$@"
}Then the workflow simply becomes:
pixi shell
real_clion .In this case, the Default toolchain can be used as it -- verify it has properly inherited the pixi env: Open settings,
under Build, Execution, Deployment > Toolchains > Default, the C Compiler and C++ Compiler should have detected
the pixi env compilers which can be verified by hovering over the Detected ... box.
-
Toolbox wrapper does not pass your environment. If CLion was installed via JetBrains Toolbox, the
clioncommand on yourPATHis a small wrapper script that talks to the Toolbox App over IPC. The Toolbox App then spawns CLion as its own child, so the environment from your shell is not inherited. Always use the realclion.shlauncher instead. -
An already-running CLion instance will absorb new projects. When
clion.shdetects a running CLion instance, it hands the "open project" request to that existing process (via IPC) and exits. The project opens in a new window, but it runs under the environment of the original CLion process. If you need the pixi environment, quit CLion entirely before relaunching frompixi shell. -
The direnv plugin is unreliable. The third-party direnv plugins for JetBrains IDEs (
intellij-direnv,Better Direnv) have open compatibility issues with recent IDE versions (2024.2+) and appear to be infrequently maintained. Launching CLion from an activated pixi shell is more dependable than relying on a direnv plugin.