NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.08k stars 14.13k forks source link

Build failure: project-slippi/Ishiiruka (not in nixpkgs) #332856

Closed pylasnier closed 3 months ago

pylasnier commented 3 months ago

This is not a nixpkgs package, but I'm building the Ishiiruka dolphin-emu fork from project-slippi. It was previously building but doesn't anymore on unstable.

Steps To Reproduce

slippi.nix:

 { fetchFromGitHub
 , dolphin-emu
 , rustPlatform
 , glib
 , rustc
 , cargo
 , gtk3
 , wxGTK32
 }:

 dolphin-emu.overrideAttrs (new: old: {
   pname = "slippi";
   version = "3.4.2";

   name = "${new.pname}-${new.version}-netplay";

   src = fetchFromGitHub {
     owner = "project-slippi";
     repo = "Ishiiruka";
     rev = "v${new.version}";
     hash = "sha256-zvjGKneUjOXsRkWuNNK2X0MwfduCYGA9Sp0osa9fQsU=";
     fetchSubmodules = true;
   };

   cargoRoot = "Externals/SlippiRustExtensions";

   cargoDeps = rustPlatform.importCargoLock {
     lockFile = "${new.src}/${new.cargoRoot}/Cargo.lock";
     outputHashes = {
       "cpal-0.15.2" = "sha256-4C7YWUx6SZnZy6pwy0CCL3yPgaMflN1atN3cUNMbcmU=";
     };
   };

   cmakeFlags = [
     "-DLINUX_LOCAL_DEV=true"
     "-DGTK3_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include"
     "-DCMAKE_SKIP_BUILD_RPATH=ON"
   ];

   # Needed to build on stable
   dontPatch = true;

   postBuild = '' 
       cp -r -n ../Data/Sys/ Binaries/ 
       cp -r Binaries/ $out 
       mkdir -p $out/lib 
       cp $build/build/source/build/Source/Core/DolphinWX/libslippi_rust_extensions.so $out/lib 
       mkdir -p $out/bin 
     '';

   installPhase = '' 
       wrapProgram "$out/dolphin-emu" \ 
         --set "GDK_BACKEND" "x11" 
       ln -s $out/dolphin-emu $out/bin/slippi-netplay 
     '';

   nativeBuildInputs = old.nativeBuildInputs ++ [
     rustc
     cargo
     rustPlatform.cargoSetupHook
   ];

   buildInputs = old.buildInputs ++ [
     gtk3
     wxGTK32
   ];
 })

default.nix:

let pkgs = import <nixpkgs> { }; in pkgs.callPackage ./slippi.nix { }

Steps:

  1. Run nix-build on nixos-unstable

    Build log

    libslippi_rust_extensions.so is built by the Rust submodule from the Ishiiruka repo. Fails with:

    [100%] Linking CXX executable ../../../Binaries/dolphin-emu
    /nix/store/qsx2xqqm0lp6d8hi86r4y0rz5v9m62wn-binutils-2.42/bin/ld: cannot find -lslippi-rust-extensions: No such file or directory
    collect2: error: ld returned 1 exit status
    make[2]: *** [Source/Core/DolphinWX/CMakeFiles/dolphin-emu.dir/build.make:1434: Binaries/dolphin-emu] Error 1
    make[1]: *** [CMakeFiles/Makefile2:1426: Source/Core/DolphinWX/CMakeFiles/dolphin-emu.dir/all] Error 2
    make: *** [Makefile:166: all] Error 2

    Full log

    Additional context

    The build breaks after the staging-next 2024-07-20 merge. I'm new to this so I don't know if I've got this right, but I believe it is commit 146dfa0d0fbcfc03d002fa12204dfb8eaebb6f2d in the staging-next merge which initially breaks the build, but with a different error in the raptor2 package which later gets patched in ce2b619afbb13e14abc60e6b8001cbfa8e14b246 leading to the final error.

    Notify maintainers

    @reckenrode @vcunat for those specific commits (sorry if you aren't the right people to notify, I believe these are the changes which broke it?)

    Metadata

    [user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
    - system: `"x86_64-linux"`
    - host os: `Linux 6.6.43, NixOS, 24.11 (Vicuna), 24.11pre661606.d04953086551`
    - multi-user?: `yes`
    - sandbox: `yes`
    - version: `nix-env (Nix) 2.18.5`
    - channels(root): `"home-manager, nixos, stable"`
    - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

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

Atemu commented 3 months ago

I'm sorry but failures in non-nixpkgs packages aren't really on topic here.

If you can find a packaging bug in a specific library, of course open a bug for that specific package but from over here your issue does not look like it's caused by any of our doing as it fails to find a library produced by the package itself.

pylasnier commented 3 months ago

If you can find a packaging bug in a specific library, of course open a bug for that specific package but from over here your issue does not look like it's caused by any of our doing as it fails to find a library produced by the package itself.

Thank you for the quick reply. Perhaps I opened an issue in the wrong topic, but this feels like a nixpkgs issue because there's a change in behaviour of the build system; it used to find its library but with unstable it no longer can. That feels like a nix build system bug.

pylasnier commented 3 months ago

Do you have any suggestions on where to go next?

Atemu commented 3 months ago

this feels like a nixpkgs issue because there's a change in behaviour of the build system

Sure but this issue is way too vague to do anything about and the only error I can see is package-internal.

Do you have any suggestions on where to go next?

I'd recommend you create a post in the NixOS discourse. If you'd discover the root cause to be in Nixpkgs, you can open an issue with specific info of course.

pylasnier commented 3 months ago

I've dug a little bit more and found where the problem is. The Rust update from 1.78 to 1.79 broke the CMake build, where the hyphens and underscores of the library file/module name have been swapped (this feels like an inevitable sort of bug with Cargo's crate naming schemes). As far as I can tell there is no change in nixpkgs other than the version bump that breaks this, so you're right that it is not nixpkgs. I'll have to open an issue elsewhere. I appreciate the guidance!

Atemu commented 3 months ago

I had suspected something like that. Glad you were able to figure it out.