Skip to content

cc-wrappers should unconditionally provide target prefixed tools ${target}-gcc to shadow unwrapped bianries. #178802

@trofi

Description

@trofi

Noticed the unwrapped binary leak in when built enchant1 with config.configurePlatformsByDefault = true; (pass --host= for native builds). There linkage fails because CC=x86_64-unknown-linux-gnu-gcc points to unwrapped binary:

$ ls /nix/store/5k57n0irf29smr12ib721dzh2ffqwlp6-gcc-wrapper-13.0.0/bin
as  c++  cc  cpp  g++  gcc  ld  ld.bfd  ld.gold  strip
$ ls /nix/store/fzwli194jbp7dv9s874sd6pn318q6h3c-gcc-13.0.0/bin
c++  g++  gcc-ar  gcc-ranlib  gcov-dump  lto-dump                      x86_64-unknown-linux-gnu-g++  x86_64-unknown-linux-gnu-gcc-13.0.0  x86_64-unknown-linux-gnu-gcc-nm
cpp  gcc  gcc-nm  gcov        gcov-tool  x86_64-unknown-linux-gnu-c++  x86_64-unknown-linux-gnu-gcc  x86_64-unknown-linux-gnu-gcc-ar      x86_64-unknown-linux-gnu-gcc-ranlib

--host=${target} effectively flips CC from gcc-wrapper to gcc. I'm surprised there is that little breakage. I'd say gcc-wrapper should always provide both gcc (& co) and ${target}-gcc (& co).

Proposal: install ${target}-gcc for native wrappers along with gcc.

Optionally we can disable unprefixed tools as suggested by the TODO:

# TODO(@Ericson2314) Make unconditional, or optional but always true by
# default.
targetPrefix = lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");
. But that will surely be a big breaking change. Better guard it under a flag initially.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions