DEVELOPMENT.md
February 3, 2024 · View on GitHub
Build on windows
Creating a DuckDB extension on Windows using MinGW on MSYS2 requires several steps, including setting up your environment, obtaining the necessary source code and dependencies, and compiling the extension. Here’s a detailed guide:
Sources
- https://duckdb.org/dev/building.html
- https://github.com/duckdb/duckdb/blob/v0.8.1/.github/workflows/Windows.yml#L158
Set environmet variable
-
Install MSYS2 and MinGW:
- Download MSYS2 installer from the official website.
- Run the installer and follow the instructions to install MSYS2 on your machine.
- Open MSYS2 terminal and update the package database and core system packages with:
pacman -Syu. - Install MinGW-w64 by running:
pacman -S git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja.
-
Setup Environment:
- Close and reopen MSYS2 terminal.
- Add MinGW to your system PATH:
export PATH="/mingw64/bin:$PATH".
-
Download Extension Source Code:
- Clone the ERPL repository:
git clone https://github.com/duckdb/duckdb.git. - Fetch the
duckdbsubmodule after clone:git submodule update --init --recursive. (To make this work under windows I had to firstgit config --global core.sshCommand 'C:/Windows/System32/OpenSSH/ssh.exe') - Navigate to the duckdb directory:
cd duckdband checkout thev0.9.0tag:git checkout v0.9.0.
- Clone the ERPL repository:
-
Download sapnwrfc Library:
- Download the sapnwrfc library from the official website (or the Zip from our Google Drive).
- Extract the downloaded archive and copy the
sapnwrfcdirectory to thesapnwrfcdirectory in the erpl repository.
-
Configure and Build:
- Run the following command in the root directory of the extension:
mingw32-make release.
- Run the following command in the root directory of the extension:
-
Testing Your Extension:
- Create a directory (e.g.
test). - Copy the following artifacts to that directory.
- The built duckdb executable (e.g.
.\build\release\duckdb.exe). - The built erpl extension (e.g.
.\build\release\extension\erpl\erpl.duckdb_extension). - All
*.dllfiles from.\sapnwrfc\lib. - Run duckdb with the following command:
.\duckdb.exe -unsigned. - In the DuckDB shell_
- First install the erpl-extension with:
INSTALL 'erpl.duckdb_extension';. - And then load the extension with:
LOAD 'erpl';.
- First install the erpl-extension with:
- Create a directory (e.g.
📦 Deploying the extension (TODO)
To deploy the extension, simply run:
sh ./scripts/extension_upload.sh