Skip to content

Fix compile_commands.json having incorrect include paths for clean builds when a variant dir is used, duplicate=0, and a relative CPPPATH is used in a child SConscript#4852

Open
mon wants to merge 1 commit intoSCons:masterfrom
mon:master

Conversation

@mon
Copy link
Copy Markdown

@mon mon commented May 7, 2026

I have a somewhat complicated build that uses variants, duplicate=0, and a relative include path in a child Sconscript.

On a clean build (and only on a clean build), built() is called on the target which wipes its cwd in the name of reduced memory use; but when the compiledb is generated, it needs this information to emit accurate include paths, so they end up pointing nowhere useful.

The cwd that gets set to None hangs around in memory anyway as part of the entire Dir tree, so by just not clearing it, the compiledb is accurate to the actual executed command.

AI disclaimer

This was a nasty thing to triage, Claude helped whittle down my big repo to a minimal repro case and wrote the testcase. I stopped it from doing large architectural changes to fix the issue. Changelog/this PR is all human written.

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt and RELEASE.txt (and read the README.rst).
  • I have updated the appropriate documentation

@bdbaddog
Copy link
Copy Markdown
Contributor

bdbaddog commented May 7, 2026

Can you change the description to be more informative than "some scenarios"? it's not useful and won't help anyone trying to figure out if the release will fix their problem.

…ilds when a variant dir is used, duplicate=0, and a relative CPPPATH is used in a child SConscript

Assisted-by: Claude Opus 4.7
@mon
Copy link
Copy Markdown
Author

mon commented May 7, 2026

Yeah good point, I was worried about making the commit message too long but it's a bit useless. This better?

@mon mon changed the title Fix compile_commands.json having incorrect include paths for clean builds in some scenarios Fix compile_commands.json having incorrect include paths for clean builds when a variant dir is used, duplicate=0, and a relative CPPPATH is used in a child SConscript May 7, 2026
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