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

zig cc can't read input from stdin #6271

Closed
Sahnvour opened this issue Sep 7, 2020 · 3 comments · Fixed by #7833
Closed

zig cc can't read input from stdin #6271

Sahnvour opened this issue Sep 7, 2020 · 3 comments · Fixed by #7833
Labels
frontend Tokenization, parsing, AstGen, Sema, and Liveness. zig cc Zig as a drop-in C compiler feature
Milestone

Comments

@Sahnvour
Copy link
Contributor

Sahnvour commented Sep 7, 2020

Meson uses CXX -E -dM - to read all defines produced by a compiler.

This fails with zig cc and zig c++ because the - flag is not recognized:

$ zig cc -target x86_64-windows-gnu -E -dM -
Unknown Clang option: '-'

How can we handle it?

@Sahnvour Sahnvour added frontend Tokenization, parsing, AstGen, Sema, and Liveness. zig cc Zig as a drop-in C compiler feature labels Sep 7, 2020
@Vexu Vexu added this to the 0.8.0 milestone Sep 7, 2020
@Rocknest
Copy link
Contributor

Rocknest commented Sep 8, 2020

Maybe add this condition mem.eql(u8, arg, "-") or before the existing condition in

if (!mem.startsWith(u8, arg, "-")) {

Then this special filename should be forwarded to clang, i think

EDIT: it was moved to

zig/src/main.zig

Line 2813 in 939b486

if (!mem.startsWith(u8, arg, "-")) {

@Jan200101
Copy link
Contributor

Jan200101 commented Oct 5, 2020

without this zig cc cannot be used as a drop-in C compiler replacement on projects using meson

meson.build:1:0: ERROR: Unable to get clang pre-processor defines:
error: Unknown Clang option: '-'

@Ristovski
Copy link
Contributor

Maybe add this condition mem.eql(u8, arg, "-") or before the existing condition in

if (!mem.startsWith(u8, arg, "-")) {

Then this special filename should be forwarded to clang, i think
EDIT: it was moved to

zig/src/main.zig

Line 2813 in 939b486

if (!mem.startsWith(u8, arg, "-")) {

Can confirm this makes zig cc work with meson.

andrewrk pushed a commit that referenced this issue Jan 20, 2021
This fixes #6271, which allows using `zig cc` with meson.
dgbuckley pushed a commit to dgbuckley/zig that referenced this issue Mar 9, 2021
This fixes ziglang#6271, which allows using `zig cc` with meson.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Tokenization, parsing, AstGen, Sema, and Liveness. zig cc Zig as a drop-in C compiler feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants