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

use case: directly symlink zig binary to /usr/bin/cc #4787

Open
andrewrk opened this issue Mar 22, 2020 · 1 comment
Open

use case: directly symlink zig binary to /usr/bin/cc #4787

andrewrk opened this issue Mar 22, 2020 · 1 comment
Labels
proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. zig cc Zig as a drop-in C compiler feature
Milestone

Comments

@andrewrk
Copy link
Member

The idea here is that zig would pay attention to its argv[0] when invoked, and handle certain names specially. For example, if the basename of argv[0] is cc then this would invoke zig cc without an extra cc parameter, and zig could be the system C compiler.

Thanks to Lietu for the idea.

Some other things to consider:

  • also supporting zig c++ (see support compiling and linking c++ code #4786)
  • also supporting being symlinked to a compiler name that has a target in it. For example, /usr/bin/riscv64-linux-musl-cc would work, and it would set the target. This is because some systems expect this to be how to invoke a cross compiler, rather than passing a -target parameter.
@andrewrk andrewrk added proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. zig cc Zig as a drop-in C compiler feature labels Mar 22, 2020
@andrewrk andrewrk added this to the 0.7.0 milestone Mar 22, 2020
@shawnl
Copy link
Contributor

shawnl commented Jun 25, 2020

also supporting being symlinked to a compiler name that has a target in it. For example, /usr/bin/riscv64-linux-musl-cc would work, and it would set the target. This is because some systems expect this to be how to invoke a cross compiler, rather than passing a -target parameter.

clang has never been used this way. This is only because gcc cross-compilation is not as flexible as clang's and you have to recompile it for the target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. zig cc Zig as a drop-in C compiler feature
Projects
None yet
Development

No branches or pull requests

2 participants