Skip to content

Make cc_host_compile_flags configurable#461

Merged
cloudhan merged 1 commit intobazel-contrib:mainfrom
hofbi:configure-host-compile-flags-to-skip
Feb 26, 2026
Merged

Make cc_host_compile_flags configurable#461
cloudhan merged 1 commit intobazel-contrib:mainfrom
hofbi:configure-host-compile-flags-to-skip

Conversation

@hofbi
Copy link
Contributor

@hofbi hofbi commented Feb 19, 2026

Extending #419. Depending on which compiler you are using, some flags should be skipped. This PR makes the flags_to_skip hardcoded in #419 configurable via the command line.

@hofbi
Copy link
Contributor Author

hofbi commented Feb 19, 2026

@finn-ball

Comment on lines 295 to 298
flags_to_skip = ctx.attr._cc_host_compile_flags_to_skip[BuildSettingInfo].value

if cuda_toolchain.toolchain_identifier == "clang":
flags_to_skip.append(
"-fno-canonical-system-headers",
)
flags_to_skip.append("-fno-canonical-system-headers")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hofbi builtin containers from attr are immutable, you need to convert them to list first before append.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

base = ctx.attr._cc_host_compile_flags_to_skip[BuildSettingInfo].value
extra = ["-fno-canonical-system-headers"] if cuda_toolchain.toolchain_identifier == "clang" else []
flags_to_skip = list(base) + extra

Perhaps something like this?

@hofbi hofbi force-pushed the configure-host-compile-flags-to-skip branch from 5f4b330 to a5893c5 Compare February 26, 2026 10:57
@hofbi
Copy link
Contributor Author

hofbi commented Feb 26, 2026

@cloudhan cloudhan merged commit 060e6e8 into bazel-contrib:main Feb 26, 2026
22 of 23 checks passed
@hofbi hofbi deleted the configure-host-compile-flags-to-skip branch February 26, 2026 15:23
@finn-ball
Copy link
Contributor

Not sure if https://github.com/bazel-contrib/rules_cuda/actions/runs/22439080161/job/64976494917 is related to the PR changes

Unrelated.

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.

3 participants