Skip to content

zig endlessly loops when compiling natively on a target which cannot be cross-compiled for and CC="zig cc" #4810

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

Closed
andrewrk opened this issue Mar 25, 2020 · 0 comments · Fixed by #4936
Labels
bug Observed behavior contradicts documented or intended behavior zig cc Zig as a drop-in C compiler feature
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Mar 25, 2020

For example on FreeBSD, because #2876 is not done yet, zig tries to call the system C compiler to find out where certain libraries and paths are. Normally this works fine, but if the environment variable CC is set to zig cc, which is now an advertised use case of zig cc, then zig will end up calling itself as a child process.

#2876 will solve this issue for FreeBSD, but we also should solve this issue for all systems that require learning the location of libc.

I think it should simply output an error message, telling the user that they should use the native C compiler to compile natively, because on this particular system Zig depends on the native C compiler anyway to learn about where libc paths are. Note that on systems like this, using zig to cross compile still works fine.

Another way to resolve this problem (on the user's end) is to explicitly specify a --libc parameter (well this would be for zig command line, zig cc would need a way to specify the information that --libc provides).

@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior zig cc Zig as a drop-in C compiler feature labels Mar 25, 2020
@andrewrk andrewrk added this to the 0.6.0 milestone Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior zig cc Zig as a drop-in C compiler feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant