HACKING.md
There are multiple ways to configure Seastar and its dependencies.
See the instructions in README.md.
First pull the git submodules using git submodule update --init --recursive
Use cmake-cooking to prepare a development environment with all dependencies. This allows for reproducible development environments, but means that approximately 3 GiB of dependencies get installed to build/_cooking_:
./cooking.sh
./cooking.sh -- -DSeastar_DPDK=ON
dpdk, which is provided by cmake-cooking (and not yet widely available via system package-managers):./cooking.sh -i dpdk
cmake-cooking for all dependencies except for Boost:./cooking.sh -e Boost
./cooking.sh -e Boost -t Release
If you use configure.py or cooking.sh to to configure Seastar, then the easiest way to use an IDE (such as Qt Creator, or CLion) for development is to instruct the IDE, when it invokes CMake, to include the following option:
-DCMAKE_PREFIX_PATH=${source_dir}/build/_cooking/installed
where ${source_dir} is the root of the Seastar source tree on your file-system.
This will allow the IDE to also index Seastar's dependencies.
cd $my_build_dir
ninja
If you used configure.py to configure Seastar, then the build directory will be build/$mode. For example, build/release.
If you use cooking.sh, then the build directory will just be build.
Make sure you are in the "build" directory.
ninja test_unit
ninja test
ninja test_unit_thread_run
Make sure you are in the "build" directory.
ninja docs
ninja doc_tutorial_html
ninja doc_tutorial_html_split
ninja doc_api
Choose the install path:
With configure.py:
./configure.py --mode=release --prefix=/my/install/path
With cooking.sh:
./cooking.sh -- -DCMAKE_INSTALL_PREFIX=/my/install/path
ninja -C build install
Once Seastar has been installed, it is sufficient to add a dependency on Seastar with
find_package (Seastar ${VERSION} REQUIRED)
add_executable (my_program
my_program.cc)
target_link_libraries (my_program
PRIVATE Seastar::seastar)
where VERSION is the desired version.
If you'd like to use cmake-cooking to set up a development environment which includes Seastar and its dependencies (a "recipe"), you can include Seastar as follows:
cooking_ingredient (Seastar
COOKING_RECIPE <DEFAULT>
COOKING_CMAKE_ARGS
-DSeastar_APPS=OFF
-DSeastar_DEMOS=OFF
-DSeastar_DOCS=OFF
-DSeastar_TESTING=OFF
EXTERNAL_PROJECT_ARGS
SOURCE_DIR ${MY_SEASTAR_SOURCE_DIR})
Seastar includes a seastar.pc file. It can be used from both the
install and build directories.
Compiling a single file:
g++ foo.cc -o foo $(pkg-config --libs --cflags --static /path/to/seastar.pc)
Compiling multiple files:
# Compiling sources into object files
g++ -c $(pkg-config --cflags /path/to/seastar.pc) foo.cc -o foo.o
g++ -c $(pkg-config --cflags /path/to/seastar.pc) bar.cc -o bar.o
# Linking object files into an executable
g++ -o foo_bar foo.o bar.o $(pkg-config --libs --static /path/to/seastar.pc)
The --static flag is needed to include transitive (private) dependencies of libseastar.a.
This project uses pre-commit to enforce some basic checks. These checks run in CI, but you can also run them locally as a pre-commit hook as follows.
Install pre-commit, following those instructions or
perhaps using uv to avoid polluting your global environment:
uv tool install pre-commit
Install the git hooks:
pre-commit install
This will run the configured hooks automatically on every commit.
Run hooks on all files:
pre-commit run --all-files
Run hooks on staged files only:
pre-commit run