NixOS / nixpkgs

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

nixpkgs.retroarchFull on aarch64 install/build failure #188091

Closed kha84 closed 2 years ago

kha84 commented 2 years ago

Describe the bug

Cannot install nixpkgs.retroarchFull via nix-env to Debian 11 Bullseye aarch64

Steps To Reproduce

Steps to reproduce the behavior:

  1. Installed nix just today to a system where it was never installed, in multi-user mode with using the shell script from your website:
    sh <(curl -L https://nixos.org/nix/install) --daemon
  2. Installed few random packages - they were ok
  3. Attempted to install nixpkgs.retroarchFull:
    $ nix-env -iA nixpkgs.retroarchFull

Errors during installation

....
copying path '/nix/store/982l0dr0561z0asd8yb4a117mmbqb166-libretro-vbam-unstable-2022-04-21' from 'https://cache.nixos.org'...
copying path '/nix/store/6m7w57g1p6f4yfv8xlqlgh3vg1n76g4b-libretro-vecx-unstable-2022-04-21' from 'https://cache.nixos.org'...
copying path '/nix/store/gy7dh5wczzf606jc6lwknqclngdphqbf-libretro-virtualjaguar-unstable-2022-04-21' from 'https://cache.nixos.org'...
copying path '/nix/store/6mjp1xd8jc8qglglf2ryw3pmanghpv2i-libretro-yabause-unstable-2022-04-21' from 'https://cache.nixos.org'...
building '/nix/store/q6n0cg3s9kj3xswr0s3ll7sc21mlcglf-libretro-blastem-unstable-2022-04-21.drv'...
unpacking sources
unpacking source archive /nix/store/abw0nkrdxsiwbimvjikk5jv5f0hck1ji-source
source root is source
patching sources
updateAutotoolsGnuConfigScriptsPhase
configuring
no configure script, doing nothing
building
build flags: -j6 -l6 SHELL=/nix/store/dkxainri6rb3kv03k4k1imy4axb2f73v-bash-5.1-p16/bin/bash platform=unix ARCH=aarch64
make libblastem.so OS=Linux CC=gcc CPU=x86_64 LIBRETRO=1
make[1]: Entering directory '/build/source'
/nix/store/dkxainri6rb3kv03k4k1imy4axb2f73v-bash-5.1-p16/bin/bash: line 1: /bin/echo: No such file or directory
gcc -O2 -flto -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value  -Wpointer-arith -Werror=pointer-arith  -DHAVE_UNISTD_H -DX86_64 -m64 -fpic -DIS_LIB -c -o libblastem.o libblastem.c
gcc -O2 -flto -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value  -Wpointer-arith -Werror=pointer-arith  -DHAVE_UNISTD_H -DX86_64 -m64 -fpic -DIS_LIB -c -o system.o system.c
gcc -O2 -flto -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value  -Wpointer-arith -Werror=pointer-arith  -DHAVE_UNISTD_H -DX86_64 -m64 -fpic -DIS_LIB -c -o genesis.o genesis.c
gcc -O2 -flto -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value  -Wpointer-arith -Werror=pointer-arith  -DHAVE_UNISTD_H -DX86_64 -m64 -fpic -DIS_LIB -c -o debug.o debug.c
gcc -O2 -flto -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value  -Wpointer-arith -Werror=pointer-arith  -DHAVE_UNISTD_H -DX86_64 -m64 -fpic -DIS_LIB -c -o gdb_remote.o gdb_remote.c
gcc -O2 -flto -std=gnu99 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value  -Wpointer-arith -Werror=pointer-arith  -DHAVE_UNISTD_H -DX86_64 -m64 -fpic -DIS_LIB -c -o vdp.o vdp.c
gcc: error: unrecognized command line option '-m64'
gcc: error: unrecognized command line option '-m64'
make[1]: *** [Makefile:363: genesis.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:363: debug.o] Error 1
gcc: error: unrecognized command line option '-m64'
gcc: error: unrecognized command line option '-m64'
make[1]: *** [Makefile:363: system.o] Error 1
make[1]: *** [Makefile:363: gdb_remote.o] Error 1
gcc: error: unrecognized command line option '-m64'
make[1]: *** [Makefile:363: vdp.o] Error 1
gcc: error: unrecognized command line option '-m64'
make[1]: *** [Makefile:363: libblastem.o] Error 1
make[1]: Leaving directory '/build/source'
make: *** [Makefile.libretro:61: core] Error 2
error: builder for '/nix/store/q6n0cg3s9kj3xswr0s3ll7sc21mlcglf-libretro-blastem-unstable-2022-04-21.drv' failed with exit code 2;
       last 10 log lines:
       > gcc: error: unrecognized command line option '-m64'
       > gcc: error: unrecognized command line option '-m64'
       > make[1]: *** [Makefile:363: system.o] Error 1
       > make[1]: *** [Makefile:363: gdb_remote.o] Error 1
       > gcc: error: unrecognized command line option '-m64'
       > make[1]: *** [Makefile:363: vdp.o] Error 1
       > gcc: error: unrecognized command line option '-m64'
       > make[1]: *** [Makefile:363: libblastem.o] Error 1
       > make[1]: Leaving directory '/build/source'
       > make: *** [Makefile.libretro:61: core] Error 2
       For full logs, run 'nix log /nix/store/q6n0cg3s9kj3xswr0s3ll7sc21mlcglf-libretro-blastem-unstable-2022-04-21.drv'.
error: 1 dependencies of derivation '/nix/store/kfzsqipdnzd4i8vs81hg54aym7yih5qb-retroarch-1.10.3.drv' failed to build

Additional context

As I can see it from logs, during the installation process an attempt to build some libretro core (libretro-blastem-unstable-2022-04-21.drv?) is happening, but I'm guessing the aarch64 platform (the one I'm running on) was not properly recognized during configuration, as I see -DX86_64 defines there and '-m64' flag doesn't seem to be recognized by aarch64 gcc

It also looks like this package was never successfully built yet - https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.retroarchFull.aarch64-linux/latest

Notify maintainers

@MP2E @edwtjo @matthewbauer @kolbycrouch @thiagokokada

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"
pi@orangepi4-lts:~$ nix-shell -p nix-info --run "nix-info -m"
these 5 paths will be fetched (0.55 MiB download, 2.68 MiB unpacked):
  /nix/store/6a19v6fwsvlq188dc640a68s7c7m5hp8-bash-interactive-5.1-p16-info
  /nix/store/ffygajjfcyrkn2qzzjc2509vf573jf8m-bash-interactive-5.1-p16-doc
  /nix/store/fl0fqz3qc0xa06dqwlvn62whizsppfy0-bash-interactive-5.1-p16-dev
  /nix/store/fsqydgc63aikq89jv2m3jf3pp70399f1-nix-info
  /nix/store/zjcnddwhbnnr0j31rnrmv6nx27hsc8vp-bash-interactive-5.1-p16-man
copying path '/nix/store/ffygajjfcyrkn2qzzjc2509vf573jf8m-bash-interactive-5.1-p16-doc' from 'https://cache.nixos.org'...
copying path '/nix/store/fl0fqz3qc0xa06dqwlvn62whizsppfy0-bash-interactive-5.1-p16-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/6a19v6fwsvlq188dc640a68s7c7m5hp8-bash-interactive-5.1-p16-info' from 'https://cache.nixos.org'...
copying path '/nix/store/zjcnddwhbnnr0j31rnrmv6nx27hsc8vp-bash-interactive-5.1-p16-man' from 'https://cache.nixos.org'...
copying path '/nix/store/fsqydgc63aikq89jv2m3jf3pp70399f1-nix-info' from 'https://cache.nixos.org'...
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
/nix/store/dkxainri6rb3kv03k4k1imy4axb2f73v-bash-5.1-p16/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
 - system: `"aarch64-linux"`
 - host os: `Linux 5.18.5-rk3399, Debian GNU/Linux, 11 (bullseye), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.10.3`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
thiagokokada commented 2 years ago

Patches are definitely welcome, I don't have a aarch64 system to test.

kha84 commented 2 years ago

Sure. I never built anything more complex than my Arduino projects, but I'm guessing it's time to start looking into that. For me it might take a while. A long while :)

thiagokokada commented 2 years ago

Another option is remove aarch64-linux in meta.platforms only for this specific core (or alternatively, add aarch64-linux inmeta.badPlatforms). This is how theretroarchFull` package is defined:

{
  retroarchFull = retroarch.override {
    cores = builtins.filter
      # Remove cores not supported on platform
      (c: c ? libretroCore && (lib.meta.availableOn stdenv.hostPlatform c))
      (builtins.attrValues libretro);
  };
}

So retroarchFull should be composed only for the platforms that are supported in that arch.

However, of course, fixing compilation if possible is a better solution.

thiagokokada commented 2 years ago

Should have been fixed in #193939 since I made libretro.blastem x86 only.