Skip to content

C++20 Modules build is broken #773

Description

@PikachuHyA

test with latest rules_cc on ubuntu 24.04

ERROR: /tmp/repro/BUILD.bazel:3:10: in cc_binary rule //:demo: 
Traceback (most recent call last):
        File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/a69eb320e08072940ef74d356e8bfd8b/external/rules_cc+/cc/private/rules_impl/function_providing_rule.bzl", line 30, column 54, in proxy
                return ctx.attr._impl_delegate[FunctionInfo].func(ctx)
        File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/a69eb320e08072940ef74d356e8bfd8b/external/rules_cc+/cc/private/rules_impl/cc_binary_impl.bzl", line 845, column 44, in _impl
                binary_info, providers = cc_binary_impl(ctx, [])
        File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/a69eb320e08072940ef74d356e8bfd8b/external/rules_cc+/cc/private/rules_impl/cc_binary_impl.bzl", line 523, column 67, in cc_binary_impl
                (compilation_context, compilation_outputs) = cc_common.compile(
        File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/a69eb320e08072940ef74d356e8bfd8b/external/rules_cc+/cc/private/cc_common.bzl", line 523, column 19, in _compile
                return compile(
        File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/a69eb320e08072940ef74d356e8bfd8b/external/rules_cc+/cc/private/compile/compile.bzl", line 358, column 31, in compile
                _create_cc_compile_actions(
        File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/a69eb320e08072940ef74d356e8bfd8b/external/rules_cc+/cc/private/compile/compile.bzl", line 1121, column 53, in _create_cc_compile_actions
                _create_cc_compile_actions_with_cpp20_module(
        File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/a69eb320e08072940ef74d356e8bfd8b/external/rules_cc+/cc/private/compile/compile.bzl", line 1044, column 60, in _create_cc_compile_actions_with_cpp20_module
                _create_cc_compile_actions_with_cpp20_module_helper(
        File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/a69eb320e08072940ef74d356e8bfd8b/external/rules_cc+/cc/private/compile/compile.bzl", line 731, column 33, in _create_cc_compile_actions_with_cpp20_module_helper
                _create_scan_deps_action(
        File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/a69eb320e08072940ef74d356e8bfd8b/external/rules_cc+/cc/private/compile/compile.bzl", line 569, column 27, in _create_scan_deps_action
                _create_compile_action(
        File "/home/ubuntu/.cache/bazel/_bazel_ubuntu/a69eb320e08072940ef74d356e8bfd8b/external/rules_cc+/cc/private/compile/compile.bzl", line 2327, column 49, in _create_compile_action
                return _cc_internal.create_cc_compile_action(
Error in create_cc_compile_action: in call to create_cc_compile_action(), parameter 'needs_include_validation' got value of type 'NoneType', want 'bool'
ERROR: /tmp/repro/BUILD.bazel:3:10: Analysis of target '//:demo' (config: dae9722) failed
ERROR: Analysis of target '//:demo' failed; build aborted
INFO: Elapsed time: 1.307s, Critical Path: 0.03s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully

reproducer

BUILD.bazel


load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
    name = "demo",
    srcs = ["main.cc"],
    features = ["cpp_modules"],
    module_interfaces = ["foo.cppm"],
)

foo.cppm

export module foo;
export int foo() { return 1; }

main.cc

import foo;

int main() { return foo(); }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions