Skip to content

feat: support standalone translate-c#645

Open
cerisier wants to merge 5 commits intoaherrmann:mainfrom
cerisier:translate-c-standalone-upstreamable
Open

feat: support standalone translate-c#645
cerisier wants to merge 5 commits intoaherrmann:mainfrom
cerisier:translate-c-standalone-upstreamable

Conversation

@cerisier
Copy link
Copy Markdown
Contributor

@cerisier cerisier commented May 6, 2026

Fixes #643

Several things worth mentioning:

apple_support is unfortunate but their cc toolchain doesn't expose builtin headers so we have to add them manually using apple_support.path_placeholders for translate-c to work on macOS. I tried convincing apple_support to perform the same kind of detection as rules_cc does in the autoconfigure rule but they were happy not having to performe repo rule invocations.

If this is not acceptable, we can also drop support for people using apple_support when using external translate-c

translate-c needs command line extraction because it doesn't support -lc where zig does the job of adding include paths for the libc.

translate-c doesn't support --sysroot nor -internal-isystem so we have to extract them from the compiler command line and pass them -isystem for now. As soon as support is added, we'll remove extraction.

@cerisier cerisier changed the title Support standalone translate-c feat: support standalone translate-c May 6, 2026
mandatory = False,
values = THREADED_VALUES,
),
"translate_c": attr.int(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Probably better to name use_standalone_translate_c

Comment thread zig/settings/BUILD.bazel
Comment on lines +80 to +94
config_setting(
name = "translate_c_enabled",
flag_values = {
":translate_c": "1",
},
visibility = ["//visibility:public"],
)

config_setting(
name = "translate_c_disabled",
flag_values = {
":translate_c": "0",
},
visibility = ["//visibility:public"],
)
Copy link
Copy Markdown
Contributor Author

@cerisier cerisier May 7, 2026

Choose a reason for hiding this comment

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

Need to move this into zig/config.

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.

Support translate_c from source

1 participant