Skip to content

detect an endless loop when trying to detect native libc installation #4936

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

Merged
merged 1 commit into from
Apr 4, 2020

Conversation

andrewrk
Copy link
Member

@andrewrk andrewrk commented Apr 4, 2020

closes #4810

@andrewrk
Copy link
Member Author

andrewrk commented Apr 4, 2020

Tested by applying this diff:

--- a/src/target.cpp
+++ b/src/target.cpp
@@ -1158,7 +1158,7 @@ static const AvailableLibC libcs_available[] = {
     {ZigLLVM_sparc, OsLinux, ZigLLVM_GNU},
     {ZigLLVM_sparcv9, OsLinux, ZigLLVM_GNU},
     {ZigLLVM_wasm32, OsFreestanding, ZigLLVM_Musl},
-    {ZigLLVM_x86_64, OsLinux, ZigLLVM_GNU},
     {ZigLLVM_x86_64, OsLinux, ZigLLVM_GNUX32},
     {ZigLLVM_x86_64, OsLinux, ZigLLVM_Musl},
     {ZigLLVM_x86_64, OsWindows, ZigLLVM_GNU},

And then doing the following:

andy@ark:~/tmp$ cat zigcc
#!/bin/sh
/home/andy/dev/zig/build/zig cc $@
andy@ark:~/tmp$ export CC="$HOME/tmp/zigcc"
andy@ark:~/tmp$ $CC -o hello hello.c
Zig attempted to find the path to native system libc headers by executing this command:
/home/andy/tmp/zigcc -E -Wp,-v -xc /dev/null
Output:
==========
Unable to link against libc: Unable to find libc installation: Zig was not provided with libc installation information, and so it does not know where the libc paths are on the system. Zig attempted to use the system C compiler to find out where the libc paths are, but discovered that Zig is being used as the system C compiler.
See `zig libc --help` for more details.

==========
Unable to link against libc: Unable to find libc installation: libc runtime not found
See `zig libc --help` for more details.

@andrewrk andrewrk merged commit e5d479b into master Apr 4, 2020
@andrewrk andrewrk deleted the detect-zig-cc-loop branch April 4, 2020 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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