Building from Source
Prerequisites
- C++ compiler with C++17 support
- CMake 3.15 or higher
- Ninja build system (recommended)
- Git
- vcpkg package manager
On Ubuntu/Debian, you can install the basic requirements with:
sudo apt-get update
sudo apt-get install -y build-essential cmake ninja-build
Build Steps
- Clone the repository with submodules:
git clone --recurse-submodules https://github.com/datazoode/flapi.git
cd flapi
- Initialize DuckDB submodule (we use version 1.1.2):
git submodule update --init --recursive
cd duckdb
git checkout v1.1.2
cd ..
- Set up vcpkg:
# Bootstrap vcpkg if you haven't already
./vcpkg/bootstrap-vcpkg.sh
# Integrate vcpkg with your system
./vcpkg/vcpkg integrate install
- Build the project:
# Create build directory
mkdir -p build/release
cd build/release
# Configure with CMake
cmake ../.. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake
# Build
ninja
# The binary will be available as 'flapi' in the current directory
Verifying the Build
After building, you can verify the installation:
# Check if the binary runs
./flapi --version
# Optional: Move to system path for global access
sudo cp flapi /usr/local/bin/
Common Build Issues
-
Missing Dependencies: If you encounter missing dependency errors, make sure vcpkg is properly initialized and integrated.
-
CMake Configuration Fails: Ensure you have the correct version of CMake and all required development tools installed.
-
Build Memory Issues: If the build process fails due to memory constraints, you can limit parallel jobs:
ninja -j2 # Limit to 2 parallel jobs
- vcpkg Cache: To speed up future builds, vcpkg caches packages. The cache is typically located in
~/.cache/vcpkg
.
Development Setup
For development, you might want to build with debug symbols:
mkdir -p build/debug
cd build/debug
cmake ../.. -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake
ninja
The debug build will include additional information useful for development and debugging.