NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.95k stars 1.53k forks source link

Build failure: nix-cmd #11353

Closed sukhmancs closed 3 months ago

sukhmancs commented 3 months ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. Run nixos-rebuild switch.

Build log

xdg-desktop-portal-hyprland> [ 55%] Building CXX object CMakeFiles/xdg-desktop-portal-hyprland.dir/src/portals/GlobalShortcuts.cpp.o
nix-cmd> [16/17] Compiling C++ object libnixcmd.so.p/installables.cc.o
nix-cmd> [17/17] Linking target libnixcmd.so
nix-cmd> FAILED: libnixcmd.so 
nix-cmd> g++  -o libnixcmd.so libnixcmd.so.p/built-path.cc.o libnixcmd.so.p/command-installable-value.cc.o libnixcmd.so.p/command.cc.o libnixcmd.so.p/common-eval-args.cc.o libnixcmd.so.p/editor-for.cc.o libnixcmd.so.p/installable-attr-path.cc.o libnixcmd.so.p/installable-derived-path.cc.o libnixcmd.so.p/installable-flake.cc.o libnixcmd.so.p/installable-value.cc.o libnixcmd.so.p/installables.cc.o libnixcmd.so.p/legacy.cc.o libnixcmd.so.p/markdown.cc.o libnixcmd.so.p/misc-store-flags.cc.o libnixcmd.so.p/network-proxy.cc.o libnixcmd.so.p/repl-interacter.cc.o libnixcmd.so.p/repl.cc.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,-soname,libnixcmd.so -fuse-ld=gold -Wl,--start-group /nix/store/9krqri5z05j5ncl93jr7m6701j2zaz8k-nix-util-2.25.0pre/lib/libnixutil.so /nix/store/mccadsxm3sgrcx2z0b9c8d5wgnlg7a3z-libarchive-3.7.4-lib/lib/libarchive.so /nix/store/gyzfknwn7glfp3m6ngqgyz380hrlv4z8-nix-store-2.25.0pre/lib/libnixstore.so /nix/store/gkp2j8ay67vi9s9g577m5fpk1dj88jkm-nix-fetchers-2.25.0pre/lib/libnixfetchers.so /nix/store/pnqdc2f5p00jfhirb46sbraf19423dkj-nix-expr-2.25.0pre/lib/libnixexpr.so /nix/store/0wq0r67l1lixwiwb7zyjbpl3yff5nbxw-boehm-gc-8.2.6/lib/libgc.so -lpthread -ldl /nix/store/w106xa5c9q274qr36b8ilvrh8wg3fyb8-nix-flake-2.25.0pre/lib/libnixflake.so /nix/store/87y10zn5m6cm4vp47ayi2cs2zb6d4bag-nix-main-2.25.0pre/lib/libnixmain.so -pthread /nix/store/isqwk2fj3d87ykqkhgr1513jqlrkymr6-lowdown-1.1.0-lib/lib/liblowdown.so -lm /nix/store/qcwlfkj0yggkfvv43y0bv7wyb35w1dh0-editline-1.17.1/lib/libeditline.so -Wl,--end-group
nix-cmd> ../installables.cc:632: error: undefined reference to 'nix::SourceExprCommand::modifyInstallable(nix::ref<nix::Store>, nix::ref<nix::EvalState>, nix::ref<nix::InstallableValue>, std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, nix::ExtendedOutputsSpec)'
nix-cmd> ../installables.cc:688: error: undefined reference to 'nix::SourceExprCommand::modifyInstallable(nix::ref<nix::Store>, nix::ref<nix::EvalState>, nix::ref<nix::InstallableValue>, std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, nix::ExtendedOutputsSpec)'
nix-cmd> collect2: error: ld returned 1 exit status
nix-cmd> ninja: build stopped: subcommand failed.
error: builder for '/nix/store/8w6vlwdprjhwv2vsniyb4r1jfln9vscx-nix-cmd-2.25.0pre.drv' failed with exit code 1;
       last 30 log lines:
       >     wrap_mode      : nodownload
       >     markdown       : enabled
       >     readline-flavor: editline
       >
       > Found ninja-1.11.1 at /nix/store/al76pgxn6m2i7p5yc9nih5zaajcil7ak-ninja-1.11.1/bin/ninja
       > Running phase: buildPhase
       > build flags: -j4
       > [1/17] Compiling C++ object libnixcmd.so.p/command-installable-value.cc.o
       > [2/17] Compiling C++ object libnixcmd.so.p/built-path.cc.o
       > [3/17] Compiling C++ object libnixcmd.so.p/editor-for.cc.o
       > [4/17] Compiling C++ object libnixcmd.so.p/common-eval-args.cc.o
       > [5/17] Compiling C++ object libnixcmd.so.p/command.cc.o
       > [6/17] Compiling C++ object libnixcmd.so.p/installable-derived-path.cc.o
       > [7/17] Compiling C++ object libnixcmd.so.p/installable-attr-path.cc.o
       > [8/17] Compiling C++ object libnixcmd.so.p/legacy.cc.o
       > [9/17] Compiling C++ object libnixcmd.so.p/installable-value.cc.o
       > [10/17] Compiling C++ object libnixcmd.so.p/installable-flake.cc.o
       > [11/17] Compiling C++ object libnixcmd.so.p/network-proxy.cc.o
       > [12/17] Compiling C++ object libnixcmd.so.p/markdown.cc.o
       > [13/17] Compiling C++ object libnixcmd.so.p/misc-store-flags.cc.o
       > [14/17] Compiling C++ object libnixcmd.so.p/repl-interacter.cc.o
       > [15/17] Compiling C++ object libnixcmd.so.p/repl.cc.o
       > [16/17] Compiling C++ object libnixcmd.so.p/installables.cc.o
       > [17/17] Linking target libnixcmd.so
       > FAILED: libnixcmd.so
       > g++  -o libnixcmd.so libnixcmd.so.p/built-path.cc.o libnixcmd.so.p/command-installable-value.cc.o libnixcmd.so.p/command.cc.o libnixcmd.so.p/common-eval-args.cc.o libnixcmd.so.p/editor-for.cc.o libnixcmd.so.p/installable-attr-path.cc.o libnixcmd.so.p/installable-derived-path.cc.o libnixcmd.so.p/installable-flake.cc.o libnixcmd.so.p/installable-value.cc.o libnixcmd.so.p/installables.cc.o libnixcmd.so.p/legacy.cc.o libnixcmd.so.p/markdown.cc.o libnixcmd.so.p/misc-store-flags.cc.o libnixcmd.so.p/network-proxy.cc.o libnixcmd.so.p/repl-interacter.cc.o libnixcmd.so.p/repl.cc.o -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,-soname,libnixcmd.so -fuse-ld=gold -Wl,--start-group /nix/store/9krqri5z05j5ncl93jr7m6701j2zaz8k-nix-util-2.25.0pre/lib/libnixutil.so /nix/store/mccadsxm3sgrcx2z0b9c8d5wgnlg7a3z-libarchive-3.7.4-lib/lib/libarchive.so /nix/store/gyzfknwn7glfp3m6ngqgyz380hrlv4z8-nix-store-2.25.0pre/lib/libnixstore.so /nix/store/gkp2j8ay67vi9s9g577m5fpk1dj88jkm-nix-fetchers-2.25.0pre/lib/libnixfetchers.so /nix/store/pnqdc2f5p00jfhirb46sbraf19423dkj-nix-expr-2.25.0pre/lib/libnixexpr.so /nix/store/0wq0r67l1lixwiwb7zyjbpl3yff5nbxw-boehm-gc-8.2.6/lib/libgc.so -lpthread -ldl /nix/store/w106xa5c9q274qr36b8ilvrh8wg3fyb8-nix-flake-2.25.0pre/lib/libnixflake.so /nix/store/87y10zn5m6cm4vp47ayi2cs2zb6d4bag-nix-main-2.25.0pre/lib/libnixmain.so -pthread /nix/store/isqwk2fj3d87ykqkhgr1513jqlrkymr6-lowdown-1.1.0-lib/lib/liblowdown.so -lm /nix/store/qcwlfkj0yggkfvv43y0bv7wyb35w1dh0-editline-1.17.1/lib/libeditline.so -Wl,--end-group
       > ../installables.cc:632: error: undefined reference to 'nix::SourceExprCommand::modifyInstallable(nix::ref<nix::Store>, nix::ref<nix::EvalState>, nix::ref<nix::InstallableValue>, std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, nix::ExtendedOutputsSpec)'
       > ../installables.cc:688: error: undefined reference to 'nix::SourceExprCommand::modifyInstallable(nix::ref<nix::Store>, nix::ref<nix::EvalState>, nix::ref<nix::InstallableValue>, std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, nix::ExtendedOutputsSpec)'
       > collect2: error: ld returned 1 exit status
       > ninja: build stopped: subcommand failed.

Additional context

The build fails during the linking stage due to undefined references to nix::SourceExprCommand::modifyInstallable. This issue may be related to missing or incorrectly linked libraries, or a mismatch between header and implementation files.

Metadata

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

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.10.3, NixOS, 24.11 (Vicuna), 24.11.20240811.a58bc8a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix Super) 2.24.0pre20240723_fbe214b`
 - nixpkgs: `/nix/store/h60m1fwahjd2mv6gsg77ji3vb4gpj4dk-source`

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

roberth commented 3 months ago

nixcmd only exists as a derivation in the nix flake at this point. I assume you have a dependency on NixOS/nix in your flake? Which revision, and how did you add it to your NixOS config?

sukhmancs commented 3 months ago

No i don't have any dependency on NixOS/nix. Here’s what my flake.nix file looks like. I initially thought it might be a build issue, but even after waiting for over a month and receiving several updates, the problem persists.

{
  description = "Xi's NixOS configuration";

  inputs = {
    systems.url = "github:nix-systems/default-linux";

    # Fork of the Nix package manager
    nix-super.url = "github:privatevoid-net/nix-super";

    # NixOS stable
    # nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";

    # NixOS unstable
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixpkgs-small.url = "github:NixOS/nixpkgs/nixos-unstable-small"; # moves faster, has less packages

    # Sometimes nixpkgs breaks something I need, pin a working commit when that occurs
    # nixpkgs-pinned.url = github:NixOS/nixpkgs/80657da2c1d4c35ba4331e85513223c7c2cdc485;

    # Flake parts for easier flake development
    flake-parts = {
      url = "github:hercules-ci/flake-parts";
      inputs.nixpkgs-lib.follows = "nixpkgs";
    };

    # Home Manager
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Flake utilities
    flake-utils = {
      url = "github:numtide/flake-utils";
      inputs.systems.follows = "systems";
    };

    # NixOS hardware configuration
    nixos-hardware.url = "github:nixos/nixos-hardware";

    # Nix hepler
    nh = {
      url = "github:viperML/nh";
      inputs.nixpkgs.follows = "nixpkgs-small";
    };

    # Stylix - System-Wide theme configuration
    stylix.url = "github:danth/stylix";

    # Deploy-rs - A deployment tool
    deploy-rs = {
      url = "github:serokell/deploy-rs";
      inputs = {
        nixpkgs.follows = "nixpkgs-small";
        utils.follows = "flake-utils";
        flake-compat.follows = "flake-compat";
      };
    };

    # Documentation generation for module options
    ndg = {
      url = "github:feel-co/ndg";
      inputs = {
        flake-parts.follows = "flake-parts";
        nixpkgs.follows = "nixpkgs-small";
      };
    };

    # A tree-wide formatter
    treefmt-nix = {
      url = "github:numtide/treefmt-nix";
      inputs.nixpkgs.follows = "nixpkgs-small";
    };

    nixfmt = {
      url = "github:nixos/nixfmt";
      flake = false;
    };

    # Project shells
    devshell = {
      url = "github:numtide/devshell";
      inputs.nixpkgs.follows = "nixpkgs-small";
    };

    # git-hooks for nix
    git-hooks = {
      url = "github:cachix/pre-commit-hooks.nix";
      inputs = {
        nixpkgs.follows = "nixpkgs-small";
        flake-compat.follows = "flake-compat";
      };
    };

    # Sandbox wrappers for programs
    nixpak = {
      url = "github:nixpak/nixpak";
      inputs = {
        nixpkgs.follows = "nixpkgs-small";
        flake-parts.follows = "flake-parts";
      };
    };

    flake-compat = {
      url = "github:edolstra/flake-compat";
      flake = false;
    };

    # Gaming on NixOS
    nix-gaming.url = "github:fufexan/nix-gaming";

    # Impermanence
    impermanence.url = "github:nix-community/impermanence";

    # Secure-boot support on nixos
    # Avoid on production systems for now
    lanzaboote = {
      url = "github:nix-community/lanzaboote";
      inputs = {
        nixpkgs.follows = "nixpkgs";
        flake-compat.follows = "flake-compat";
      };
    };

    # nix-index database
    nix-index-db = {
      url = "github:nix-community/nix-index-database";
      inputs.nixpkgs.follows = "nixpkgs-small";
    };

    atticd = {
      url = "github:zhaofengli/attic";
      inputs.nixpkgs.follows = "nixpkgs-small";
    };

    # Secrets management
    agenix = {
      url = "github:ryantm/agenix";
      inputs = {
        nixpkgs.follows = "nixpkgs-small";
        home-manager.follows = "home-manager";
        darwin.follows = "";
      };
    };

    # Rust overlay
    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs = {
        nixpkgs.follows = "nixpkgs-small";
      };
    };

    # Nix Language server
    nil = {
      url = "github:oxalica/nil";
      inputs = {
        nixpkgs.follows = "nixpkgs-small";
        rust-overlay.follows = "rust-overlay";
      };
    };

    # Nightly builds of Neovim
    neovim-nightly = {
      url = "github:nix-community/neovim-nightly-overlay";
      inputs = {
        nixpkgs.follows = "nixpkgs-small";
        flake-parts.follows = "flake-parts";
        git-hooks.follows = "git-hooks";
      };
    };

    # Notashelf' personal package collection for packages that are
    # not in nixpkgs.
    nyxpkgs.url = "github:NotAShelf/nyxpkgs";

    # NixVim
    nixvim = {
      url = "github:nix-community/nixvim";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Neovim configuration wrapper.
    neovim-flake = {
      url = "github:NotAShelf/nvf";
      inputs = {
        nixpkgs.follows = "nixpkgs-small";
        nil.follows = "nil";
        flake-utils.follows = "flake-utils";
        flake-parts.follows = "flake-parts";
      };
    };

    # This will provide us with the latest version of the
    # vscode extensions.
    nix-vscode-extensions = {
      url = "github:nix-community/nix-vscode-extensions";
      inputs = {
        nixpkgs.follows = "nixpkgs-small";
      };
    };

    # Notashelf' wallpapers repository to provide various
    # wallpapers as nix packages.
    wallpkgs = {
      url = "github:NotAShelf/wallpkgs";
      inputs.nixpkgs.follows = "nixpkgs-small";
    };

    # Anyrun program launcher
    anyrun.url = "github:anyrun-org/anyrun";
    anyrun-nixos-options = {
      url = "github:n3oney/anyrun-nixos-options";
      inputs = {
        flake-parts.follows = "flake-parts";
      };
    };

    # Aylur's gtk shell (ags)
    ags = {
      url = "github:Aylur/ags";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Spicetify for theming spotify
    spicetify = {
      url = "github:the-argus/spicetify-nix";
      inputs.nixpkgs.follows = "nixpkgs-small";
    };

    # Post-modern configuration management
    wrapper-manager = {
      url = "github:viperML/wrapper-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Schizophrenic Firefox configuration
    schizofox = {
      url = "github:schizofox/schizofox";
      inputs = {
        nixpkgs.follows = "nixpkgs-small";
        flake-parts.follows = "flake-parts";
        nixpak.follows = "nixpak";
      };
    };

    # Mailserver on nixos
    simple-nixos-mailserver = {
      url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master";
      inputs.nixpkgs.follows = "nixpkgs-small";
    };

    # Hyprland & Hyprland Contrib repos
    # to be able to use the binary cache, we should avoid
    # overriding the nixpkgs input - as the resulting hash would
    # mismatch if packages are built against different versions
    # of the same depended packages.
    hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1";
    xdg-portal-hyprland.url = "github:hyprwm/xdg-desktop-portal-hyprland";
    hyprpicker.url = "github:hyprwm/hyprpicker";

    # Hyprland's wallpaper repository
    hyprpaper = {
      url = "github:hyprwm/hyprpaper";
      inputs = {
        hyprlang.follows = "hyprland/hyprlang";
        nixpkgs.follows = "hyprland/nixpkgs";
        systems.follows = "hyprland/systems";
      };
    };

    hyprland-contrib = {
      url = "github:hyprwm/contrib";
      inputs.nixpkgs.follows = "hyprland/nixpkgs";
    };

    # Hyprland's plugins repository
    hyprland-plugins = {
      url = "github:hyprwm/hyprland-plugins";
      inputs.hyprland.follows = "hyprland";
    };
  };

  outputs = inputs @ { flake-parts, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } ({ withSystem, ... }: {
      systems = [
        "x86_64-linux"
        "aarch64-linux"
      ];

      imports = [ ./flake-parts ];

      flake = {
        nixosConfigurations = (
          import ./machines {
            inherit inputs withSystem;
          }
        );
      };
    });
}
roberth commented 3 months ago

It must be in a dependency then. Doesn't Nix print a set of .drvs that are unbuildable because of the failed dependency?

sukhmancs commented 3 months ago

The problem is with nix-super. I switched back to using plain old nix.