Hello guys,
I am trying to use older glibc in cross-compilation script and getting an error:
error:
… while calling the 'derivationStrict' builtin
at /builtin/derivation.nix:9:12: (source not available)
… while evaluating derivation 'prj-aarch64-unknown-linux-gnu-dev-bin'
whose name attribute is located at /nix/store/vhq11h949l5zycaw07acphv53ifq4p2c-source/pkgs/stdenv/generic/make-derivation.nix:303:7
… while evaluating attribute 'stdenv' of derivation 'prj-aarch64-unknown-linux-gnu-dev-bin'
at /nix/store/vhq11h949l5zycaw07acphv53ifq4p2c-source/pkgs/stdenv/generic/make-derivation.nix:332:14:
331| args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
332| inherit stdenv;
| ^
333|
(stack trace truncated; use '--show-trace' to show the full trace)
error: assertion '(nativeTools -> ((! propagateDoc) && (nativePrefix != "")))' failed
at /nix/store/j2d8sp3grrwjhf45n1rj4phiqmgj4l8r-gcc_8_3_0/pkgs/build-support/cc-wrapper/default.nix:21:1:
20|
21| assert nativeTools -> !propagateDoc && nativePrefix != "";
| ^
22| assert !nativeTools ->
What does this error mean? Maybe older glibc 2.27 is not available for aarch64 platform? Below is the script that uses older glibc with cross-compile nix script.
let
nixpkgs = fetchTarball "https://github.com/nixOS/nixpkgs/archive/23.05.tar.gz";
pkgs = (import nixpkgs {}).pkgsCross.aarch64-multiplatform;
system = "aarch64-unknown-linux-gnu";
glibc_2_27 = (import (builtins.fetchGit {
name = "glibc_2_18";
url = "https://github.com/NixOS/nixpkgs/";
ref = "refs/heads/nixos-19.09";
rev = "b79f64b5eb5fa8ca2f844ddb4d7c186b6c69a293";
}) { inherit system; }).glibc;
gcc_8_3_0 = (import (builtins.fetchGit {
name = "gcc_8_3_0";
url = "https://github.com/NixOS/nixpkgs/";
ref = "refs/heads/nixpkgs-unstable";
rev = "a9eb3eed170fa916e0a8364e5227ee661af76fde";
}) { inherit system; }).gcc-unwrapped;
getCustomGccStdenv = customGcc: customGlibc: origStdenv: { pkgs, ... }:
with pkgs; let
compilerWrapped = wrapCCWith {
cc = customGcc;
bintools = wrapBintoolsWith {
bintools = binutils-unwrapped;
libc = customGlibc;
};
};
in
overrideCC origStdenv compilerWrapped;
gcc_8_3_0_glibc_2_27 = getCustomGccStdenv gcc_8_3_0 glibc_2_27 pkgs.stdenv pkgs;
in
pkgs.callPackage ( { mkShell, cmake, ninja, git, pkg-config }:
gcc_8_3_0_glibc_2_27.mkDerivation {
pname = "prj";
version = "dev-bin";
src = ./.;
nativeBuildInputs = with pkgs;
[
cmake ninja git pkg-config
];
buildInputs = with pkgs;
[
pkgsStatic.openssl pkgsStatic.zlib pkgsStatic.libmicrohttpd.dev pkgsStatic.libsodium.dev
];
dontAddStaticConfigureFlags = false;
CFLAGS = [
# "-mno-outline-atomics"
];
LDFLAGS = [
"-static-libgcc"
"-static-libstdc++"
"-fPIC"
];
}) {}
Could you please explain the reason behind the error? Thank you.