linux-nixos-hyprland-config-dotfiles icon indicating copy to clipboard operation
linux-nixos-hyprland-config-dotfiles copied to clipboard

How do I find which file is causing this error?

Open Shark-with-Blue-Shoes opened this issue 10 months ago • 4 comments

Error

error: builder for '/nix/store/r7sdgmpdxla5mflazs05ynnyyqh6lgpn-libsemanage-3.7.drv' failed with exit code 2;
       last 25 log lines:
       >       | ^~~~~~~~~~~~~~~~~~~~~~~~
       > semanageswig_wrap.c: In function '_wrap_semanage_node_list_local':
       > semanageswig_wrap.c:17123:21: error: too few arguments to function 'SWIG_Python_AppendOutput'
       > 17123 |         resultobj = SWIG_Python_AppendOutput(resultobj, plist);
       >       |                     ^~~~~~~~~~~~~~~~~~~~~~~~
       > semanageswig_wrap.c:1259:1: note: declared here
       >  1259 | SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) {
       >       | ^~~~~~~~~~~~~~~~~~~~~~~~
       > semanageswig_wrap.c: In function '_wrap_semanage_node_query':
       > semanageswig_wrap.c:17170:17: error: too few arguments to function 'SWIG_Python_AppendOutput'
       > 17170 |     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj(*arg3, SWIGTYPE_p_semanage_node, 0));
       >       |                 ^~~~~~~~~~~~~~~~~~~~~~~~
       > semanageswig_wrap.c:1259:1: note: declared here
       >  1259 | SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) {
       >       | ^~~~~~~~~~~~~~~~~~~~~~~~
       > semanageswig_wrap.c: In function '_wrap_semanage_node_list':
       > semanageswig_wrap.c:17350:21: error: too few arguments to function 'SWIG_Python_AppendOutput'
       > 17350 |         resultobj = SWIG_Python_AppendOutput(resultobj, plist);
       >       |                     ^~~~~~~~~~~~~~~~~~~~~~~~
       > semanageswig_wrap.c:1259:1: note: declared here
       >  1259 | SWIG_Python_AppendOutput(PyObject* result, PyObject* obj, int is_void) {
       >       | ^~~~~~~~~~~~~~~~~~~~~~~~
       > make[1]: *** [Makefile:77: pythonsemanageswig_wrap.lo] Error 1
       > make[1]: Leaving directory '/build/libsemanage-3.7/src'
       > make: *** [Makefile:20: install-pywrap] Error 2

Steps to reproduce:

  1. I cloned the repository

  2. installed fish and ripgrep

  3. set usbguard to false

  4. enabled flake permanently

  5. replaced username 'xnm' with my username (only in the nixos directory, as I just want to get sudo nixos-rebuild switch --flake /etc/nixos#your-hostname --update-input nixpkgs --update-input rust-overlay --commit-lock-file --upgrade to work

  6. I cloned the home folder into my home directory and nixos into nixos directory

  7. ran sudo nixos-rebuild switch --flake /etc/nixos#isitreal-laptop --update-input nixpkgs --update-input rust-overlay --commit-lock-file --upgrade

My system.stateVersion = 24.11

Question: My current goal is to comment out the faulty file using flake.nix, however, it'll be a long process of trial and error. These are the files I have commented out in flake.nix

nvidia disable-nvidia fingerprint-scanner clamav yubi auto-upgrade location internalization printing gnome mac-randomize open-ssh mosh vpn virtualization programming-languages lsp rust wasm info-fetchers

These are what I've tried so far, however, I will try some more in a couple hours and comment my findings here. Thank you

Shark-with-Blue-Shoes avatar Feb 07 '25 00:02 Shark-with-Blue-Shoes

Answering the question: "How do I find which file is causing this error?" Since this is NixOS, debugging can sometimes be tricky because Nix doesn’t always provide the best debugging information. There isn't a single definitive method to find the source of the error. Personally, I usually analyze the error messages and try to infer which program or library in which module has failed to build.

For this particular issue, I suggest commenting out the following section in linux-kernel.nix:

environment.systemPackages = with pkgs; [
  policycoreutils
];

After the latest nixpkgs updates, it fails during the build process.

Let me know if this helps

XNM1 avatar Feb 07 '25 00:02 XNM1

In addition to my previous reply regarding the investigation of which file is causing this error, I suggest not interrupting the build process even if errors appear. Allow it to complete on its own; this way, you will get a complete trace of all the derivatives that failed. Then, you can identify the broken package and use grep to locate the file where this package is referenced.

This approach doesn’t always work, but in some cases, it can be helpful—like in the situation shown in the screenshot I encountered recently.

Image Image

Error trace:

  • Lib: duckduckgo-search
  • Package: open-webui
  • File: llm.nix

XNM1 avatar Feb 10 '25 18:02 XNM1

Answering the question: "How do I find which file is causing this error?" Since this is NixOS, debugging can sometimes be tricky because Nix doesn’t always provide the best debugging information. There isn't a single definitive method to find the source of the error. Personally, I usually analyze the error messages and try to infer which program or library in which module has failed to build.

For this particular issue, I suggest commenting out the following section in linux-kernel.nix:

environment.systemPackages = with pkgs; [ policycoreutils ]; After the latest nixpkgs updates, it fails during the build process.

Let me know if this helps

It worked, but the lunatic and wasmedge packages from wasm.nix, and python-lsp-server aren't compiling either. Since I just hopped to Nix a few days ago, commenting troublesome packages is my go-to workaround for now lol

dazzayah avatar Mar 06 '25 04:03 dazzayah

commenting troublesome packages is my go-to workaround for now lol

for me either, unstable nixpkgs is really unstable, but it has latest packages compared to stable, so for desktop\laptop setup despite some inconvenience unstable is one to go for me, but obviously for production servers I prefer stable

XNM1 avatar Apr 11 '25 17:04 XNM1