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

prelude: fix zig cxx toolchain (fixes #883) #884

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions prelude/toolchains/cxx/zig/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ load(
"CxxCompilerInfo",
"CxxInternalTools",
"LinkerInfo",
"LinkerType",
"ShlibInterfacesMode",
"StripFlagsInfo",
"cxx_toolchain_infos",
Expand Down Expand Up @@ -304,17 +305,17 @@ def download_zig_distribution(
os = os,
)

def _get_linker_type(os: str) -> str:
def _get_linker_type(os: str) -> LinkerType:
if os == "linux":
return "gnu"
return LinkerType("gnu")
elif os == "macos" or os == "freebsd":
# TODO[AH] return "darwin".
# The cc rules emit linker flags on MacOS that are not supported by Zig's linker.
# Declaring the linker as GNU style is not entirely correct, however it works better than
# declaring Darwin style at this point. See https://github.com/facebook/buck2/issues/470
return "gnu"
return LinkerType("gnu")
elif os == "windows":
return "windows"
return LinkerType("windows")
else:
fail("Cannot determine linker type: Unknown OS '{}'".format(os))

Expand Down
Loading