Skip to content

Fix C++20 modules compilation failing during analysis#775

Closed
fmeum wants to merge 1 commit into
bazelbuild:mainfrom
fmeum:fmeum/cpp20-modules-fix
Closed

Fix C++20 modules compilation failing during analysis#775
fmeum wants to merge 1 commit into
bazelbuild:mainfrom
fmeum:fmeum/cpp20-modules-fix

Conversation

@fmeum

@fmeum fmeum commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Building any target with the cpp_modules feature failed at analysis time with:

parameter 'needs_include_validation' got value of type 'NoneType', want 'bool'

_create_scan_deps_action called _create_compile_action without passing needs_include_validation, so it defaulted to None and was rejected by create_cc_compile_action. Pass it through.

The module-compile path then failed analysis as well, because _create_compile_action did not accept the C++20 module output/modmap arguments (additional_outputs, module_files, modmap_file, modmap_input_file) that its caller already passes:

_create_compile_action() got unexpected keyword arguments: ...

Accept and forward them.

Fixes #773

Building any target with the cpp_modules feature failed at analysis time
with:

    parameter 'needs_include_validation' got value of type 'NoneType', want 'bool'

_create_scan_deps_action called _create_compile_action without passing
needs_include_validation, so it defaulted to None and was rejected by
create_cc_compile_action. Pass it through.

The module-compile path then failed analysis as well, because
_create_compile_action did not accept the C++20 module output/modmap
arguments (additional_outputs, module_files, modmap_file,
modmap_input_file) that its caller already passes:

    _create_compile_action() got unexpected keyword arguments: ...

Accept and forward them.

Fixes bazelbuild#773
@fmeum fmeum requested review from c-mita, pzembrod and trybka as code owners June 26, 2026 20:29
@fmeum

fmeum commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator Author

@PikachuHyA Could you give this a try?

@PikachuHyA

Copy link
Copy Markdown
Contributor

@PikachuHyA Could you give this a try?

@fmeum it works . thanks.

@PikachuHyA

Copy link
Copy Markdown
Contributor

@fmeum

Can we add a CI job with Ubuntu 24.04 (Ubuntu 26.04 would be better) and Bazel 9 to watch over the C++20 Modules-related features, so that they don’t break by accident during refactoring?

Also, I’m continuing to improve Bazel’s support for C++20 Modules, such as

. If we have a related CI job to keep an eye on it, it would make things easier for reviewers.

@lilygorsheneva

Copy link
Copy Markdown
Collaborator

Fixed by 840d532 and 1a20833

Sorry for not seeing this earlier; I was out of office and didn't notice an issue until the bazel team complained.
https://github.com/bazelbuild/bazel/blob/master/src/test/shell/bazel/cc_integration_test.sh has tests that should have caught this, working on getting them into rules_cc

@fmeum fmeum deleted the fmeum/cpp20-modules-fix branch July 8, 2026 14:30
@fmeum

fmeum commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

@lilygorsheneva

Copy link
Copy Markdown
Collaborator

If you mean _starlark_cc_semantics.needs_include_validation(language), I don't know; currently preserving the existing behavior (matching default set in Java)

@fmeum

fmeum commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

Ah, no, I'm referring to these extra parameters:

version_dependent_kwargs["module_files"] = module_files
        version_dependent_kwargs["modmap_file"] = modmap_file
        version_dependent_kwargs["modmap_input_file"] = modmap_input_file

that weren't passed on correctly. Perhaps that part of my PR is still needed?

@lilygorsheneva

lilygorsheneva commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Oh; bad copy-paste in my previous comment, I should have said " 0662ed2 and 1a20833 ", not " 840d532 and 1a20833 "

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.

C++20 Modules build is broken

3 participants