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

Unable to use Zig cc compiler #319

Closed
dimaguy opened this issue Mar 26, 2023 · 8 comments · Fixed by #320
Closed

Unable to use Zig cc compiler #319

dimaguy opened this issue Mar 26, 2023 · 8 comments · Fixed by #320
Labels
enhancement New feature or request

Comments

@dimaguy
Copy link

dimaguy commented Mar 26, 2023

Describe the bug
I can't point the extension to use Zig's cc compiler because flags are placed after the file and output location are selected

To Reproduce
Steps to reproduce the behavior:

  1. Set C-compiler to zig
  2. Append cc to the beginning of C-flags
  3. (optionally) set Cpp-compiler to zig and append c++ to beginning of Cpp-flags
  4. Find that flags are placed after filenames, so it's all in vain

Expected behavior
Extension will invoke Zig's compilers as if they were gcc or clang

Screenshots
image

Environment

  • VSCode Version: 1.76.2
  • OS Version: Windows 11 22H2

Additional context
I also attempted to append cc at the end of C-compiler, but that tries to find a binary named "zig cc" instead

@danielpinto8zz6
Copy link
Owner

Have you tried with gcc?

@dimaguy
Copy link
Author

dimaguy commented Mar 27, 2023

Yes, gcc works fine, but zig cc provides a more smooth cross compiling experience as well as other QoL improvements

@danielpinto8zz6
Copy link
Owner

what's the command to compile with zig?

@dimaguy
Copy link
Author

dimaguy commented Mar 27, 2023

what's the command to compile with zig?

zig cc (regular gcc flags)
zig g++ (regular clang flags)

@danielpinto8zz6
Copy link
Owner

have you tried to put "zig cc" on your compiler?

@dimaguy
Copy link
Author

dimaguy commented Mar 28, 2023

have you tried to put "zig cc" on your compiler?

I have, as I mentioned in the additional context, since it uses an exec call instead of a shell command call, it tries to look for a binary named zig cc, even if I renamed it, would make it so argv[0] would be "zig cc", and therefore, not recognized as the cc subcommand

@danielpinto8zz6
Copy link
Owner

@dimaguy I'll leave the issue open as an improvement for future release

@danielpinto8zz6 danielpinto8zz6 added the enhancement New feature or request label Mar 29, 2023
@dimaguy
Copy link
Author

dimaguy commented Mar 29, 2023

@dimaguy I'll leave the issue open as an improvement for future release

Sure, sounds good to me :)
To be fair all that needs to be done is to reorder flags to be before the filename and output dir, but take your time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants