NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.32k stars 14.3k forks source link

Build failure: avrlibc #357993

Closed Ben-Miller0 closed 1 day ago

Ben-Miller0 commented 5 days ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. build the flake

    {
    description = "Avr Dev Env";
    
    inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    };
    
    outputs = { self, nixpkgs, ... }:
    {
      devShell."x86_64-linux" =
        let
          pkgs = import nixpkgs {
            system = "x86_64-linux";
          };
          avr = with pkgs.pkgsCross.avr.buildPackages; [
            binutils
            gcc
            avrdude
            avrlibc
          ];
        in
        pkgs.mkShell {
          name = "Wearables-shell";
          buildInputs = avr;
        };
    };
    }

Build log

Build Log ``` error: … while calling the 'derivationStrict' builtin at :34:12: 33| 34| strict = derivationStrict drvAttrs; | ^ 35| … while evaluating derivation 'Wearables-shell' whose name attribute is located at /nix/store/c9wv7i0af6mysmy65x6nvyfw5izzxv4g-source/pkgs/stdenv/generic/make-derivation.nix:336:7 … while evaluating attribute 'buildInputs' of derivation 'Wearables-shell' at /nix/store/c9wv7i0af6mysmy65x6nvyfw5izzxv4g-source/pkgs/stdenv/generic/make-derivation.nix:383:7: 382| depsHostHost = elemAt (elemAt dependencies 1) 0; 383| buildInputs = elemAt (elemAt dependencies 1) 1; | ^ 384| depsTargetTarget = elemAt (elemAt dependencies 2) 0; (stack trace truncated; use '--show-trace' to show the full, detailed trace) error: Package ‘avr-libc-2.2.1’ in /nix/store/c9wv7i0af6mysmy65x6nvyfw5izzxv4g-source/pkgs/development/misc/avr/libc/default.nix:26 is not available on the requested hostPlatform: hostPlatform.config = "x86_64-unknown-linux-gnu" package.meta.platforms = [ "avr-none" ] package.meta.badPlatforms = [ ] , refusing to evaluate. a) To temporarily allow packages that are unsupported for this system, you can use an environment variable for a single invocation of the nix tools. $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake, then pass `--impure` in order to allow use of environment variables. b) For `nixos-rebuild` you can set { nixpkgs.config.allowUnsupportedSystem = true; } in configuration.nix to override this. c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add { allowUnsupportedSystem = true; } to ~/.config/nixpkgs/config.nix. ```

Additional context

none

Metadata

Notify maintainers


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


Add a :+1: reaction to issues you find important.

FliegendeWurst commented 5 days ago

Have you tried setting NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 or one of the other quick fixes?

Ben-Miller0 commented 5 days ago

Can you do that inside a flake?

FliegendeWurst commented 5 days ago

Yes, using --impure:

Note: When using nix shell, nix build, nix develop, etc with a flake, then pass --impure in order to allow use of environment variables.

Ben-Miller0 commented 5 days ago

i mean something in the flake.nix that reproduceably does that.

Ben-Miller0 commented 4 days ago

this is what i get if i try doing what you say

Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/r8kvbay6x1d13zl93fgj18pgzyg5q0a4-avr-libc-2.2.1.tar.bz2
source root is avr-libc-2.2.1
setting SOURCE_DATE_EPOCH to timestamp 1721363985 of file avr-libc-2.2.1/avr-libc.spec
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Updating Autotools / GNU config script to a newer upstream version: ./config.sub
Updating Autotools / GNU config script to a newer upstream version: ./config.guess
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
patching script interpreter paths in ./configure
./configure: interpreter directive changed from "#! /bin/sh" to "/nix/store/0irlcqx2n3qm6b1pc9rsd2i8qpvcccaj-bash-5.2p37/bin/sh"
configure flags: --disable-dependency-tracking --prefix=/nix/store/wawhvkwgzf4ylf9dnqrvrdg5blr3zdxw-avr-libc-2.2.1
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking if configuring for cross compile... no
configure: WARNING: 
configure: WARNING: AVR-LibC must be built using an avr cross-compiler.
configure: WARNING: Try configuring with:
configure: WARNING: "./configure --build=`./config.guess` --host=avr"
configure: WARNING: 
configure: error: aborting configure
FliegendeWurst commented 4 days ago

Why do you use avr.buildPackages and not just avr?

FliegendeWurst commented 4 days ago

I'm asking because the error message actually suggests you are trying to build avrlibc for your build platform.

Ben-Miller0 commented 3 days ago

how are you supposed to build avrlibc

FliegendeWurst commented 3 days ago

I'd assume

          avr = with pkgs.pkgsCross.avr; [
            binutils
            gcc
            avrdude
            avrlibc
          ];

but I did not test.

Ben-Miller0 commented 3 days ago

doesn't work

trofi commented 3 days ago

pkgsCross.avr.stdenv.cc.libc is in the cache on hydra.

Ben-Miller0 commented 1 day ago

this flake works

{
  description = "Avr Dev Env";

  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
  };

  outputs = { self, nixpkgs, ... }:
    {
      devShell."x86_64-linux" =
        let
          pkgs = import nixpkgs {
            system = "x86_64-linux";
          };
          avr = with pkgs.pkgsCross.avr; [
            stdenv.cc
            stdenv.cc.libc
          ];
        in
        pkgs.mkShell {
          name = "Wearables-shell";
          buildInputs = avr;
          nativeBuildInputs = with pkgs; [ avrdude ];
        };
    };
}