Open trofi opened 2 years ago
This seems to boil down to an issue in the llvmPackages
bootstrapping logic, namely llvmPackages.clang
picking the wrong wrapper for clang in this line:
The choice is made based on stdenv.cc
, so for pkgsLLVM.llvmPackages.cc
, we are looking at pkgsLLVM.buildPackages.stdenv.cc
which is the C compiler used to build the package set used to build pkgsLLVM
which turns out to be gcc
.
The fix probably involves looking at targetPackages.stdenv.cc
or similar to get a sense of what the default compiler of the current package set is supposed to be.
Another quite bizarre issue I can't yet explain is that pkgsLLVM.llvmPackages.stdenv.cc.bintools
turns out to be GNU binutils when it clearly shouldn't.
might be related: https://github.com/NixOS/nixpkgs/issues/147342
Unrelated in a sense — the fix for this doesn't resolve #147342 unfortunately.
The same for pkgsCross, reproducible with
{ nixpkgs ? builtins.getFlake "github:NixOS/nixpkgs/master" }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; };
in
# pkgs.stdenv.mkDerivation {
pkgs.pkgsCross.aarch64-multiplatform.llvmPackages.stdenv.mkDerivation {
name = "test";
src = builtins.toFile "test.cc" ''
#include <cstdio>
int main() {
return 0;
}
'';
dontUnpack = true;
dontInstall = true;
buildPhase = ''
$CXX $src -o $out
'';
}
This is a different, but possibly related issue. aarch64-multiplatform
should use gcc
and libstdc++
by default and consequently the LLVM stdenv should also rely on libstdc++
. Seems like something is going wrong there.
ok, I thought I was going crazy
pkgsLLVM
should providelibc++
headers, but it does not. I initially observed it onpkgsLLVM.mold
which usesllvmPackages_latest.stdenv
.Here is the one-liner reproducer:
good:
bad:
Note:
<cstdio>
is not in the visible path.