Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use libc without cc-toolchain #226

Merged
merged 3 commits into from
Feb 16, 2024
Merged

feat: use libc without cc-toolchain #226

merged 3 commits into from
Feb 16, 2024

Conversation

aherrmann
Copy link
Owner

The Zig compiler bundles its own libc(++). rules_zig exposes these using the targets @rules_zig//zig/lib:libc(++). However, so far these were implemented as cc_library targets, meaning that depending on them incurred a dependency on the cc-toolchain, even if the target was only used to forward a -lc(++) linker flag.

This change removes that dependency. These targets are now generated using a custom rule that is still compatible with the cc rules, but no longer requires a cc-toolchain. This greatly simplifies cross-compilation use-cases with libc(++) dependencies. For example

$ cd e2e/workspace
$ bazel run //include-dependencies/zig-std-include:binary --platforms=//configure-target:x86_64-windows --run_under=wine64

  • Rule to set C linkopts w/o cc toolchain
  • Remove dummy cc toolchain from integration test

This dummy cc toolchain was only required due to the dependency on the
`cc_library` target to introduce the `-lc` flag.
@aherrmann aherrmann enabled auto-merge February 16, 2024 21:53
@aherrmann aherrmann merged commit 9d07f28 into main Feb 16, 2024
21 checks passed
@aherrmann aherrmann deleted the libc branch February 16, 2024 22:07
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.

1 participant