diff --git a/docs/dev/building/build_instructions.md b/docs/dev/building/build_instructions.md index 0c031378d63..5b902291312 100644 --- a/docs/dev/building/build_instructions.md +++ b/docs/dev/building/build_instructions.md @@ -8,14 +8,16 @@ title: Building Instructions DuckDB needs CMake and a C++11-compliant compiler (e.g., GCC, Apple-Clang, MSVC). Additionally, we recommend using the [Ninja build system](https://ninja-build.org/), which automatically parallelizes the build process. -Clone the DuckDB repository. +## UNIX-like Systems + +### macOS Packages + +Install Xcode and [Homebrew](https://brew.sh/). Then, install the required packages with: ```bash -git clone https://github.com/duckdb/duckdb +brew install git cmake ninja ``` -We recommend creating a full clone of the repository. Note that the directory uses approximately 1.2 GB of disk space. - ### Linux Packages Install the required packages with the package manager of your distribution. @@ -38,21 +40,17 @@ Alpine Linux: apk add g++ git make cmake ninja ``` -### macOS +### Cloning the Repository -Install Xcode and [Homebrew](https://brew.sh/). Then, install the required packages with: +Clone the DuckDB repository: ```bash -brew install cmake ninja +git clone https://github.com/duckdb/duckdb ``` -### Windows +We recommend creating a full clone of the repository. Note that the directory uses approximately 1.3 GB of disk space. -Consult the [Windows CI workflow](https://github.com/duckdb/duckdb/blob/v0.10.2/.github/workflows/Windows.yml#L234) for a list of packages used to build DuckDB on Windows. - -On Windows, the DuckDB Python package requires the [Microsoft Visual C++ Redistributable package](https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist) to be built and [to run]({% link docs/api/python/known_issues.md %}#error-when-importing-the-duckdb-python-package-on-windows). - -## Building DuckDB +### Building DuckdB To build DuckDB we use a Makefile which in turn calls into CMake. We also advise using [Ninja](https://ninja-build.org/manual.html) as the generator for CMake. @@ -62,6 +60,14 @@ GEN=ninja make > Bestpractice It is not advised to directly call CMake, as the Makefile sets certain variables that are crucial to properly building the package. +Once the build finishes successfully, you can find the `duckdb` binary in the `build` directory: + +```bash +build/release/duckdb +``` + +### Linking Extensions + For testing, it can be useful to build DuckDB with statically linked core extensions. To do so, run: ```bash @@ -76,6 +82,28 @@ CORE_EXTENSIONS='autocomplete;icu;parquet;json;delta' GEN=ninja make For more details, see the [“Building Extensions” page]({% link docs/dev/building/building_extensions.md %}). +## Windows + +On Windows, DuckDB requires the [Microsoft Visual C++ Redistributable package](https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist) both as a build-time and runtime dependency. + +To build DuckDB, install [MSYS2](https://www.msys2.org/) and open a MINGW64 session. +Install the required dependencies using Pacman. When prompted with `Enter a selection (default=all)`, select the default option by pressing `Enter`. +Note that unlike the build process on UNIX-like systems, the Windows build directly calls CMake. + +```bash +pacman -Syu git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja +git clone https://github.com/duckdb/duckdb +cd duckdb +cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DBUILD_EXTENSIONS="icu;parquet;json" +cmake --build . --config Release +``` + +Once the build finishes successfully, you can find the `duckdb.exe` binary in the repository's directory: + +```bash +./duckdb.exe +``` + ## Troubleshooting ### The Build Runs Out of Memory