You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to find libc installation: system C compiler exited with failure code #4521
The output of cc -E -Wp,-v -xc /dev/null the the formula would see during building from source is different and can be found by first executing: brew install --HEAD --fetch-HEAD --interactive zig. This will drop you into a shell with the zig sources present with the same environment that Homebrew uses to build zig.
Due to the dependency on llvm (and then it's transitive dependencies) the chief difference is in the search path.
@zbeekman thanks for the tip. Although I'm able to reproduce the issue with brew install zig --HEAD, when I build zig manually inside the interactive shell with brew install --HEAD --fetch-HEAD --interactive zig, I am not able to reproduce the issue.
Zig attempted to find the path to native system libc headers by executing this command:
clang -E -Wp,-v -xc /dev/null
Output:
==========
clang: The build tool has reset ENV; --env=std required.
==========
Unable to link against libc: Unable to find libc installation: system C compiler exited with failure code
I'm not sure why this was working before. Perhaps something did change in homebrew after all.
Somewhere along the way environment variables are lost? Zig is calling /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang, so that means at least the PATH variable is not lost
Activity
andrewrk commentedon Feb 22, 2020
What does this command do on your system?
cc -E -Wp,-v -xc /dev/nullSeekingMeaning commentedon Feb 22, 2020
andrewrk commentedon Feb 22, 2020
That looks correct. That's the command zig runs that is failing. More investigation is needed to diagnose this
SeekingMeaning commentedon Feb 22, 2020
Not sure if this helps, but here's the output for
/usr/local/opt/llvm/bin/clang -E -Wp,-v -xc /dev/null:andrewrk commentedon Feb 22, 2020
Thanks. I'll update the native libc detection to output more helpful diagnostics if the system C compiler exits with a failure code.
andrewrk commentedon Feb 22, 2020
I am able to reproduce this with
brew install zig --HEADon my machine.zbeekman commentedon Feb 22, 2020
The output of
cc -E -Wp,-v -xc /dev/nullthe the formula would see during building from source is different and can be found by first executing:brew install --HEAD --fetch-HEAD --interactive zig. This will drop you into a shell with thezigsources present with the same environment that Homebrew uses to build zig.Due to the dependency on llvm (and then it's transitive dependencies) the chief difference is in the search path.
Note that, due to the llvm dependency in the formula (is this needed?)
/usr/local/opt/llvm/includeis the first system search path.In addition these CMake variables get set in the build environment and may play a role in determining where CMake finds stuff:
andrewrk commentedon Feb 22, 2020
@zbeekman thanks for the tip. Although I'm able to reproduce the issue with
brew install zig --HEAD, when I build zig manually inside the interactive shell withbrew install --HEAD --fetch-HEAD --interactive zig, I am not able to reproduce the issue.std.os.execvpeZ_expandArg0: fix not restoring argv[0]
andrewrk commentedon Feb 22, 2020
Here's a new clue after 0cd89e9:
I'm not sure why this was working before. Perhaps something did change in homebrew after all.
SeekingMeaning commentedon Feb 22, 2020
swi-prologhad a similar issue: Homebrew/homebrew-core#38571Fixed in Homebrew/homebrew-core@55ca84b
Something to do with "shims"
This is line that prints the error: https://github.com/Homebrew/brew/blob/master/Library/Homebrew/shims/super/cc#L5
Somewhere along the way environment variables are lost? Zig is calling
/usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang, so that means at least thePATHvariable is not lostandrewrk commentedon Feb 22, 2020
I think this is correct, and I'm working on a fix.