Skip to content

Darwin stdenvNoCC pulls in full compiler #371465

@mroi

Description

@mroi

The stdenvNoCC environment on Darwin depends on a full LLVM toolchain and clang compiler. Consequently, stdenvNoCC has a large closure size on Darwin: 1.09GiB vs. 71MiB on Linux (determined using nix-tree nixpkgs#stdenvNoCC on both platforms).

Steps To Reproduce

Run one of the following:
nix-tree nixpkgs#stdenvNoCC
nix why-depends nixpkgs#stdenvNoCC nixpkgs#llvmPackages.clang-unwrapped

Expected behavior

stdenvNoCC should not pull in a compiler, resulting in a smaller closure size than currently reported by nix-tree. Specifically, nix why-depends should show it not to depend on clang-unwrapped.

Additional context

The culprit appears to be that the setup script of stdenvNoCC contains the store path of the Apple SDK in the variable defaultBuildInputs. This pulls in the entire build toolchain. Unfortunately, I do not understand the creation process of stdenv well enough to see how to test getting rid of this. I’d think that if a compiler-less stdenv is requested, the SDK would not be needed?

Metadata

  • system: "x86_64-darwin"
  • host os: Darwin 24.2.0, macOS 15.2
  • multi-user?: yes
  • sandbox: no
  • version: nix-env (Nix) 2.24.10
  • nixpkgs: /nix/store/4c6wr0gvjr2azsng4vi8a9j1y1yzai4y-source

Note for maintainers: Please tag this issue in your PR.


Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    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