NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.29k stars 14.27k forks source link

Build failure: kicad-unstable #335003

Open uzytkownik opened 3 months ago

uzytkownik commented 3 months ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. build kicad-unstable

Build log

kicad-unstable.log

Additional context

Updating to TOT does not fix issue.

Notify maintainers

@evils

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.44, NixOS, 24.11 (Vicuna), 24.11pre666839.c3aa7b8938b1`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - channels(root): `"nixos"`
 - channels(mpiechotka): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

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

uzytkownik commented 3 months ago

Actually the update might work but my WAR to build kicad-unstable might prevent it:

    (final: prev: {
      kicad-unstable = (prev.kicad-unstable.override {
        srcs = {
          kicadVersion = "2024-08-15";
          libVersion = "2024-08-15";
          symbols = pkgs.fetchFromGitLab {
            group = "kicad";
            owner = "libraries";
            repo = "kicad-symbols";
            rev = "6c4c693f7dce65185f4059795d60b784ac4c76a8";
            sha256 = "sha256-Auz4gZWKBYgTZ6YNMHM+K4Oi9h1rpjayFCR9xUgn1x4=";
          };
          templates = pkgs.fetchFromGitLab {
            group = "kicad";
            owner = "libraries";
            repo = "kicad-templates";
            rev = "b65257c57a6222d67db23a6d2b205600e3bf4c9a";
            sha256 = "sha256-6jNq2ZCeEDPwRGY1Av9crTu72rqYIom+EjDJPWbmLQ4=";
          };
          footprints = pkgs.fetchFromGitLab {
            group = "kicad";
            owner = "libraries";
            repo = "kicad-footprints";
            rev = "cbbd20409d6b3220b50edd5daefcae73290a88e1";
            sha256 = "sha256-ikbmXUGhGujxwq9JdoUZ30Isfw7oMSu5leGaaRZS/Q4=";
          };
          packages3d = pkgs.fetchFromGitLab {
            group = "kicad";
            owner = "libraries";
            repo = "kicad-packages3d";
            rev = "eef24e75adc1d7a09e987b00fee9967b29aedd2e";
            sha256 = "sha256-UVVggKKvHIkkiZdKTdvYW3tCC5nzSgtW5qB/MzZm0Q8=";
          };
        };
      }).overrideAttrs(finalAttrs: prevAttrs: {
        src = prevAttrs.base.overrideAttrs (finalAttr: prevAttrs: {
          version = builtins.substring 0 10 "6641183d0929e255f3c3f449ab2f5df078c83cb5";
          src = pkgs.fetchFromGitLab {
            group = "kicad";
            owner = "code";
            repo = "kicad";
            rev = "6641183d0929e255f3c3f449ab2f5df078c83cb5";
            sha256 = "sha256-YLSTOAIybyhbbjLyj2AZNOWiVV7sfctELiBx/SxrYz8=";
          };
          cmakeFlags = prevAttrs.cmakeFlags ++ [
            "-D Protobuf_DIR=${pkgs.protobuf}"
          ];
          buildInputs = prevAttrs.buildInputs ++ [pkgs.protobuf];
          nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [pkgs.protobuf];
          doCheck = false;
          doInstallCheck = false;
        });
      });
    })
uzytkownik commented 3 months ago

I will try to create pr if I succeeds with update directly in nixpkgs.

pdlloyd commented 3 weeks ago

Unstable Kicad fails for me with the following:

sudo nixos-rebuild switch --upgrade
unpacking 4 channels...
building Nix...
building the system configuration...
error:
       … while calling the 'head' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:1:35787:
       … while evaluating the attribute 'value'
         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1:33591:
       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `system.systemBuilderArgs':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activatable-system.nix':

       … while evaluating the option `system.activationScripts.etc.text':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/etc/etc-activation.nix':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/etc/etc.nix':

       … while evaluating the option `environment.etc."profiles/per-user/human".source':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: expected a Boolean but found a set: { _type = "pkgs"; AAAAAASomeThingsFailToEvaluate = «thunk»; AMB-plugins = «thunk»; ArchiSteamFarm = «thunk»; AusweisApp2 = «thunk»; BeatSaberModManager = «thunk»; CHOWTapeModel = «thunk»; ChowCentaur = «thunk»; ChowKick = «thunk»; ChowPhaser = «thunk»; «21563 attributes elided» }
       at /nix/store/jp1m4r344yhziff9kc6bjbw72mhfmjhr-nixos/nixos/pkgs/applications/science/electronics/kicad/default.nix:276:20:
          275|   meta = rec {
          276|     description = (if (stable)
             |                    ^
          277|     then "Open Source Electronics Design Automation suite"
fpf3 commented 5 days ago

I'm finding that this issue recently found its way into the normal kicad package.

fpf3 commented 5 days ago

We have the following helpful comment in the kicad source itself...

#if( LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR == 8                                              \
     && ( LIBGIT2_VER_REVISION < 2 || LIBGIT2_VER_REVISION == 3 ) )
        /*
         * For libgit2 versions 1.8.0, 1.8.1.               (cf19ddc52)
         * This change was reverted for 1.8.2               (49d3fadfc, main branch)
         * The revert for 1.8.2 was not included for 1.8.3  (which is on the maint/v1.8 branch, not main)
         * This change was also reverted for 1.8.4          (94ba816f6, also maint/v1.8 branch)
         *
         * As of 1.8.4, the history is like this:
         *
         *  * 3f4182d15 (tag: v1.8.4, maint/v1.8)
         *  * 94ba816f6 Revert "commit: fix const declaration"      [puts const back]
         *  * 3353f78e8 (tag: v1.8.3)
         *  | * 4ce872a0f (tag: v1.8.2-rc1, tag: v1.8.2)
         *  | * 49d3fadfc Revert "commit: fix const declaration"    [puts const back]
         *  |/
         *  * 36f7e21ad (tag: v1.8.1)
         *  * d74d49148 (tag: v1.8.0)
         *  * cf19ddc52 commit: fix const declaration               [removes const]
         */
        git_commit* const parents[1] = { parent };
#else
        // For libgit2 versions older than 1.8.0, or equal to 1.8.2, or 1.8.4+
        const git_commit* parents[1] = { parent };
#endif

Combined with the error from the build, it seems we are trying to build kicad against a version of libgit2 covered by the top branch of that ifdef. If those are simply undefined, we take the bottom (wrong) branch. Are these missing from the cmake flags?

fpf3 commented 5 days ago

Really strange. Adding the cmake flags doesn't help. It looks like we are building against 1.8.4, so I'm really confused.

fpf3 commented 4 days ago

Hardcoding the parents type to either/or causes the build to fail either way for me. (wtf?)

mse63 commented 4 days ago

I think it's the other way around. The commit that added that code was only added two weeks ago: https://gitlab.com/kicad/code/kicad/-/commit/9f579f787bc6b62ca456f87f92d8e96107b24206

We're actually taking the top branch, which was fine when libgit2 was version 1.8.3. But now that libgit2 has updated to 1.8.4 in nixpkgs, we should be taking the bottom branch, but we're still using sources older than when that commit was made, so we're still taking the top branch.

Possibly we could add in a patch to apply that change to all of our kicad derivations? Either that or have kicad use version 1.8.3 of gitlib2 until everything is worked out upstream