Chapter 2: Download, Build, Run
This chapter provides the complete commands for dependency installation, cloning, CMake build, launch, and curl verification.
1. Dependencies
sudo apt-get update
sudo apt-get install -y build-essential cmake pkg-config libjsoncpp-dev libssl-dev2. Clone the repository
git clone https://github.com/StephenTaam/STTNet.git
cd STTNet3. Build Configuration
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
-DSTTNET_BUILD_EXAMPLE=ON \
-DSTTNET_BUILD_TESTS=OFF \
-DSTTNET_BUILD_BENCHMARK=OFF
cmake --build build --parallel4. Execution and Expected Result
./build/examples/sttnet_http_hello
# In another terminal:
curl -i http://127.0.0.1:8080/pingExpected: HTTP 200 with body
pong. Ctrl-C follows the synchronous signal-wait path and produces a clean shutdown.5. Common failures
| Symptom | Likely Cause and Resolution |
|---|---|
| json/json.h not found | The libjsoncpp-dev package is required; reconfiguration uses a clean build directory. |
| OpenSSL not found | The libssl-dev package and selected library architecture match the build environment. |
| Bind failed | Port binding requires an unused port; unprivileged users normally use ports 1024 or higher. |
| Built but cannot start | Relevant diagnostics are available in stderr/logs, certificate paths, permissions, port settings, and fd limits. |
6. Link STTNet into your CMake project
add_subdirectory(third_party/STTNet)
add_executable(my_server main.cpp)
target_link_libraries(my_server PRIVATE STTNet::sttnet)