Repository navigation
configure: treat CC as a command, and never substitute another one - #295
Merged
Merged
Conversation
configure tested CC with test -x, which only accepts a path to one
executable. A CC with a launcher or driver flags in front of the
compiler, the convention autoconf and make have always honoured, fails
that test. configure then path-searched the whole string, found
nothing, and went on to gcc from PATH without a word:
$ CC="ccache /opt/.../musl-clang" ./configure
Finding suitable compiler........success [/usr/bin/gcc]
In a cross build that is the wrong compiler, the wrong headers and the
wrong instruction set, and nothing downstream can tell. We shipped a
static musl binary whose ck objects came from the host's gcc at
x86-64-v3, and it died with SIGILL on a Nehalem-class VMware guest at
the first ck_hs probe.
Resolve the first word of CC, directly or on PATH, and keep the rest.
If CC is set and does not resolve, fail with the value in the message.
The cc-then-gcc search stays for a CC that was never set.
CC=<wrapper> success [<wrapper>]
CC="ccache <wrapper>" success, ck.build carries the launcher
CC="bogus <wrapper>" failed [bogus <wrapper>: not found]
CC= success [/usr/bin/cc]
Every later use of CC is unquoted in command position, so the
multi-word value needs no other change. Checked under bash and dash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
configure tested CC with test -x, which only accepts a path to one executable. A CC with a launcher or driver flags in front of the compiler, the convention autoconf and make have always honoured, fails that test. configure then path-searched the whole string, found nothing, and went on to gcc from PATH without a word:
In a cross build that is the wrong compiler, the wrong headers and the wrong instruction set, and nothing downstream can tell. We shipped a static musl binary whose ck objects came from the host's gcc at x86-64-v3, and it died with SIGILL on a Nehalem-class VMware guest at the first ck_hs probe.
Resolve the first word of CC, directly or on PATH, and keep the rest. If CC is set and does not resolve, fail with the value in the message. The cc-then-gcc search stays for a CC that was never set.
Every later use of CC is unquoted in command position, so the multi-word value needs no other change. Checked under bash and dash.