Skip to content

LLVM stdenvs with LLD outside of pkgsLLVM #142901

@sternenseemann

Description

@sternenseemann

Ever since #122778 llvmPackages_*.stdenv and llvmPackages_*.libcxxStdenv respects stdenv.hostPlatform.linker. This means that it'll be using ld.bfd on Linux and cctools on macOS.

This has a big downside, namely it being virtually impossible to produce C++ binaries using these stdenvs. This seems to be caused by the fact that ld.bfd doesn't really understand the object files clang produces (cctools probably works fine? Haven't tested it on darwin so far). This is quite a shame especially with libcxxStdenv.

Current workarounds for this are either using pkgsLLVM.stdenv (which cross-compiles, however) or using the following incantation: overrideCC llvmPackages.stdenv (llvmPackages.stdenv.cc.override { inherit (llvmPackages) bintools; }).

I've been struggling to find a clear way forward and not opened a PR for this so far, but would really like to fix this in a satisfying way. The question is mostly if we a) want to preserve llvmPackages_*.stdenv using the default linker for the platforms and create a new clang+lld LLVM stdenv with a different name (which one?) or b) revert the meaning of llvmPackages_*.stdenv to the pre 21.05 days and have it use LLD unconditionally.

cc @Ericson2314

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: cross-compilationBuilding packages on a different platform than they will be used on6.topic: exoticExotic hardware or software platform6.topic: llvm/clangIssues related to llvmPackages, clangStdenv and related6.topic: stdenvStandard environment

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions