Skip to content

cmd/dist: support space and quotes in CC #52990

Description

@motiejus

As of 742dcba go build can accept $CC with spaces and quotes, which lets us easily use zig cc as the C compiler:

CC="zig cc" go build <...>

However, the same does not apply when compiling go itself:

$ CC="zig cc" ./all.bash
Building Go cmd/dist using /usr/local/go. (go1.18.2 linux/amd64)
go tool dist: cannot invoke C compiler "zig cc": exec: "zig cc": executable file not found in $PATH

Go needs a system C compiler for use with cgo.
To set a C compiler, set CC=the-compiler.
To disable cgo, set CGO_ENABLED=0.

This applies to also extra compiler flags, like -v:

CC="clang-13 -v" ./all.bash

Goal: make Go be able to build itself when $CC contains spaces and/or quotes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions