Skip to content

configure: treat CC as a command, and never substitute another one - #295

Merged
sbahra merged 1 commit into
concurrencykit:masterfrom
haesbaert:configure-fix
Oct 15, 2026
Merged

sbahra merged 1 commit into
concurrencykit:masterfrom
haesbaert:configure-fix

Conversation

@haesbaert

Copy link
Copy Markdown
Contributor

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.

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.
@sbahra
sbahra merged commit 119d717 into concurrencykit:master Oct 15, 2026
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.

2 participants