-
Notifications
You must be signed in to change notification settings - Fork 463
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
[Feature Request] Add support for zig #897
Comments
Does zig-cc not work with sccache? |
the problem is sccache does not support zig, zig has it's own cache system.
…________________________________
From: Jiahao XU ***@***.***>
Sent: Friday, November 10, 2023 6:50:23 PM
To: rust-lang/cc-rs ***@***.***>
Cc: DragonBillow ***@***.***>; Author ***@***.***>
Subject: Re: [rust-lang/cc-rs] [Feature Request] Add support for zig (Issue #897)
disable sccache when using zig cc
Does zig-cc not work with sccache?
Is this something that can be fixed in zig itself?
―
Reply to this email directly, view it on GitHub<#897 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKBJ6APIUGD33OR2OAMOZJLYDYBG7AVCNFSM6AAAAAA7FQWZECVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBVGQ4TQNZQGA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
That's unfortunate... I think we need to doc this behavior when implementing support for zig cc.
Can you provide me a link to the doc please? I've been using cargo-zigbuild for a while but I never look deep into it, didn't know it has a caching system. |
Thanks, but https://gist.github.com/matu3ba/92e5df1166c51b3725dbd04f7ff1cb4e is outdated (its content says it's outdated). For https://ziglang.org/documentation/master/#C-Translation-Caching , it just says it uses zig caching system but there's no doc for the zig caching system. |
Yeah, but I guess we don't need to look into zig's caching system? We just need to know that it does. |
Yeah I'm just interested in how it works, I do think it's a good idea to support zig-cc, I would work on it after #893 is done |
I can't find the author's specific description of the zig cache system. Here it may be useful to you:
Of course, the best thing is probably to read the source code: |
Thanks! I also found the cache dir using |
The problem with supporting zig is that they don't use a standard names for the different target triples, and have indicated they'll likely change how this works in a future version. We'd need mappings for this and it would be a big pain, as they're likely to change. In the mean time Edit: More broadly, this is more work than just supporting When zig hits 1.0, I think I'd be more open to it. |
emm, let me explain why I don't want rust-zigbuild. This question originally arose because I wanted to compile some c source code into a static library in rust, the cargo-zigbuild was descripted "Compile Cargo project with zig as linker", but I don't need using it as a linker. so I use cc-rs, and pass zig's triple to $CC, it works fine. I open this issue in the hope that cc can solve some common problems (for example, a compiler like zig cc can only be passed through $CC, but not through the compiler function). Of course, I now know why my cross-compiling with clang failed (because the nix-shell I used replaced the default clang, and the clang they provided added some OS-specific parameters, and just needed to change the compiler to the system The default will do) |
P.S. |
ok, so let's close this issue |
cc @cathaysia I now think rustup should ship zig-cc for cc-rs to use and use it for linking https://internals.rust-lang.org/t/bundle-zig-cc-in-rustup-by-default/22096 |
zig supports an easy-to-use cross-compilation experience, and also supports c and cpp. However, cc-rs' support for zig needs to be improved (mainly to perform some special processing when zig is recognized).
If cc-rs can accept these changes, I can make these work.
Tasks
The text was updated successfully, but these errors were encountered: