duckdb / duckdb/extension-template

Unknown CMake command "build_static_extension"

Open
#144 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
290
Forks
116
PR merge metrics
No merged PRs in 30d

Description

Dear everybody,
similar to https://github.com/duckdb/extension-template/issues/96, I get the same error message when trying to work with a specific extension ( https://github.com/dais-polymtl/flock ) in VSCode.

Since VSCode relies on LSP as well (I think (n)vim does), I would think that maybe my problem is similar.
I tried to create a `compile_commands.json` using `set(CMAKE_EXPORT_COMPILE_COMMANDS ON)` in `CMakeLists.txt`.

I also get a LARGE `compile_commands.json` out of it and handed that to VSCode inside `c_cpp_properties.json`.

Still the same error. Has anyone ( maybe @rob2244) solved this?

If there is anything I can do to help, please lmk!

### Behavior:

VSCode tells me: `Configure failed. Would you like to attempt to configure with the CMake Debugger? Source: CMake Tools`

### Expected Behavior:

No error message ~~and I can use the debugger~~(Edit: I _can_ use GDB).

### Steps to reproduce:

Set up flock (remember to put DuckDB INSIDE flock repo) and try to open repository inside VSCode.

### Environment (Dockerfile):

```
# based on this guide: https://docs.docker.com/get-started/docker-concepts/building-images/writing-a-dockerfile/
# and rewritten after reading through https://docs.docker.com/get-started/workshop/
# install -y taken from https://github.com/llvm/llvm-project/issues/81470
# (trixie) used debian trixie because of need for curl > 8.9 as taken from here: https://discourse.cmake.org/t/why-cant-i-find-curl-when-cross-compiling/11041/4
FROM debian:trixie-slim
WORKDIR /duckdb-build-env

# this is the required JSON package for compiling flockMTL. how to use build arguments taken from https://docs.docker.com/build/building/variables/
ENV NLOHMANN_JSON=https://github.com/nlohmann/json.git

# this is googletest, required for compiling flockmtl
ENV GTEST=https://github.com/google/googletest.git

# needed for compiling DuckDB.
# git is needed to get a proper version of DuckDB instead of v0.0.1
# parallel is useful for testing DuckDB (do we need to cite the github comment for parallel ( https://github.com/catchorg/Catch2/issues/399#issuecomment-672391192 )here?)
# automagically bumped up to clang 19, which is default on trixie. does not need libclang-rt-14-dev anymore. see (trixie)
RUN apt-get update && apt-get install -y clang libasan8-amd64-cross cmake ninja-build gdb git parallel vim less

# install ccache to speed up (extension) builds. Taken from: https://github.com/duckdb/extension-template?tab=readme-ov-file#tips-for-speedy-builds, 18-09-2025-10-16-am
# also set environment variable to tempfs. Taken from https://wiki.debian.org/ccache#Choose_a_good_ccache_directory
RUN apt-get install -y ccache
ENV CCACHE_DIR=/tmp/ccache

# prepare compiling flockmtl
# installed libcurl-openssl-devel to fix MISSING CURL_LIBRARY CMake Error. Source: https://stackoverflow.com/questions/34914944/could-not-find-curl-missing-curl-library-curl-include-dir-on-cmake
RUN ["apt-get", "install", "-y", "curl", "libcurl4-openssl-dev", "python3", "pipx"]

# packages to be installed taken from makefile after reading https://discourse.cmake.org/t/findcurl-doesnt-set-curl-libraries-and-curl-include-dirs/7619/3
# separated into two distinct RUNs because of reading https://linuxcommandlibrary.com/man/pipx
RUN ["pipx", "install", "clang-format"]
RUN ["pipx", "install", "cmakelang"]

# install nlohmann_json. needed for flockmtl
# how to use build arguments taken from https://docs.docker.com/build/building/variables/
ARG NLOHMANN_JSON
RUN git clone ${NLOHMANN_JSON} ./nlohmann_json # used shell form of run because of conversation with Docker docs AI, see 10-09-2025-10-45-am-docker-git-clone.txt
RUN cd ./nlohmann_json && cmake -S . -B ./build -G Ninja # the fact that we needed to INSTALL first before we could make flockmtl taken from https://github.com/nlohmann/json/issues/1755#issuecomment-1837675544, 15-09-2025-11-26-am

# install googletest. needed for flockmtl
ARG GTEST
RUN git clone ${GTEST} ./googletest
RUN cd ./googletest && mkdir ./build && cd ./build && cmake .. && make && make install # how to make and make install googletest taken from https://github.com/google/googletest/tree/main/googletest#build-with-cmake, 15-09-2025-01-22-pm, fixed the whitespace error (mkdir./build) after reading https://stackoverflow.com/questions/63585819/dockerfile-mkdir-not-working-nodealpine, 15-09-2025-02-05-pm

# install vcpkg. source https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-bash
RUN apt-get install -y zip unzip tar
RUN git clone https://github.com/microsoft/vcpkg.git
RUN cd ./vcpkg && ./bootstrap-vcpkg.sh

RUN ["mkdir", "./DuckDB", "./flockmtl"]
```

### Docker compose file:

```
# This is a Docker compose file
# that starts the development environment
# for DuckDB using CLang with Address Sanitizer enabled.
# This bind-mounts the project directory in PATH.
# Skeleton for the file taken from: https://docs.docker.com/engine/storage/bind-mounts/#use-a-bind-mount-with-docker-compose
# Also used info from here: https://docs.docker.com/reference/compose-file/services/#volumes
# How to use env variables taken from: https://docs.docker.com/reference/compose-file/version-and-name/#name-top-level-element,
# https://docs.docker.com/compose/how-tos/environment-variables/envvars/
# How to use env file taken from: https://serversforhackers.com/c/div-variables-in-docker-compose
# and https://docs.docker.com/compose/how-tos/environment-variables/set-environment-variables/#use-the-env_file-attribute
# Used https://www.yamllint.com/ to check syntax.
# Indentation for bind and create_host_path taken from: https://forums.docker.com/t/creating-directory-instead-of-file/143483/3
# Correct usage of env file taken from conversation with Docker Docs AI: 29-08-2025-1-26-pm-docker-bind-mounts-not-showing.txt
# Read up on networking here:(user-defined-networks) https://docs.docker.com/engine/network/#user-defined-networks
# Took the networks part from here: https://docs.docker.com/compose/intro/compose-application-model/#illustrative-example and ad verbatim from here: https://docs.docker.com/reference/compose-file/networks/#advanced-example
# Took the info that we need the host driver from here: https://docs.docker.com/engine/network/drivers/ and user-defined-networks

services:
duckdb-build-env:
image: ourregistry/duckdb-build-env
volumes:
- type: bind
source: ${SOURCE}
# the target is an ABSOLUTE path. You have to include the workdir from the Dockerfile if you want that to be the root!
target: /duckdb-build-env/DuckDB # removed dot because of conversation with docker docs AI: see 28-08-2025-3-14-pm.txt
read_only: false
bind:
create_host_path: false
- type: bind
source: ${FLOCKMTL}
target: /duckdb-build-env/flockmtl
read_only: false
bind:
create_host_path: false
- type: bind
source: ${DATASETS}
target: /duckdb-build-env/datasets
read_only: false
bind:
create_host_path: false
network_mode: host # taken from conversation with docker docks AI: see 09-09-2025-11-47-docker-compose-host-network.txt
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the VSCode CMake Tools configure failure with the flock repository and the provided Dockerfile and Docker Compose setup. Inspect the extension's CMakeLists.txt and the definition or inclusion of build_static_extension, then compare it with the extension-template issue linked in the report. Done means configuration completes without the unknown-command error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, docker, docker-compose, vscode
Domain
build-system, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.