Skip to content

Point .clangd CompilationDatabase at the editable build directory#451

Closed
aaron-ang wants to merge 2 commits into
duckdb:mainfrom
aaron-ang:fix-editable-debug-build
Closed

Point .clangd CompilationDatabase at the editable build directory#451
aaron-ang wants to merge 2 commits into
duckdb:mainfrom
aaron-ang:fix-editable-debug-build

Conversation

@aaron-ang
Copy link
Copy Markdown

@aaron-ang aaron-ang commented May 11, 2026

Summary

.clangd points at build/clangd/, but the editable build writes compile_commands.json to build/debug/ (per the build-dir override in pyproject.toml). Result: clangd has no compile DB to read and reports 'file not found' on every project header in any IDE that uses clangd (VS Code, CLion, etc.).

Repointing .clangd at build/debug aligns it with the actual editable build-dir so the IDE picks up the existing compile_commands.json without a manual symlink.

Notes

Earlier revisions of this PR also patched StructVector::GetEntries deref sites in numpy_scan.cpp / python_conversion.cpp and added duckdb/common/vector/*.hpp includes across three files. Those have since landed via #453 (the variegata merge), so this PR is now a single-line .clangd change.

The remaining upstream-side breakage of the editable / Debug build — missing create_*_info.hpp includes that cause dynamic_cast to forward-declared types in D_ASSERT — is tracked separately in duckdb/duckdb#22551. Once that lands and the submodule pin is bumped, the editable build per CLAUDE.md will be green end-to-end.

Test plan

  • After this change, opening any project .cpp file in VS Code with the clangd extension resolves all duckdb/... and duckdb_python/... includes against the existing build/debug/compile_commands.json — no symlink needed.

…der split

The submodule pin pulls in two DuckDB changes that break the editable/debug
build configured with DISABLE_UNITY=1 (see pyproject.toml editable overrides):

1. StructVector::GetEntries now returns vector<Vector>& instead of
   vector<unique_ptr<Vector>>& (duckdb commit 4e5d5da6a6 "Make StructVector
   have the same layout as DataChunk"). Drop the dereference at the two
   call sites that iterated the entries with *children[i].

2. ListVector / ArrayVector / StructVector / MapVector were moved into
   their own headers under duckdb/common/vector/. Without unity these
   are no longer pulled in transitively, so add explicit includes.

cibuildwheel builds (the CI release path) use unity and don't hit either
issue, which is why this regression went unnoticed.
The editable build (configured in pyproject.toml) writes
compile_commands.json to build/debug/, but .clangd has been pointing at
build/clangd/, which is never populated. Result: clangd cannot find the
compile DB and reports 'file not found' on every project header.

Align .clangd with the actual editable build-dir so the IDE picks up the
existing compile_commands.json without an extra symlink.
@evertlammerts
Copy link
Copy Markdown
Collaborator

Closing in favor of #453

@aaron-ang aaron-ang changed the title Fix editable/debug build after StructVector API change and vector header split Point .clangd CompilationDatabase at the editable build directory May 14, 2026
@aaron-ang
Copy link
Copy Markdown
Author

Hi @evertlammerts, heads-up that on a fresh checkout of main (f1ee06f) the CLAUDE.md two-step editable build still doesn't produce a working debug install. With DISABLE_UNITY=1 (this repo's editable override), the engine fails to compile because many .cpp files call info.Cast<CreateXxxInfo>() without including the matching duckdb/parser/parsed_data/create_xxx_info.hpp, so the D_ASSERT(reinterpret_cast<...> == dynamic_cast<...>) inside ParseInfo::Cast<T>() can't dynamic_cast to a forward-declared type. Submodule pin 01eda16d6e and duckdb/duckdb main both still have this, tracked upstream in duckdb/duckdb#22551. Separately, .clangd still points at build/clangd/, but no documented target populates that directory (editable writes to build/debug/), so clangd can't find a compile DB and reports 'file not found' on every project header in any IDE that uses it.

Happy to reopen or re-scope if a different approach is preferred (e.g. documenting the symlink in CLAUDE.md, or shipping a .vscode/settings.json snippet). Wheel and cibuildwheel builds are unaffected since unity hides both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants