DavHau / nix-on-armv7l

Nix without NixOS on arm32v7 / armv7l / Raspberry Pi OS / Raspbian
MIT License
19 stars 3 forks source link

stdenv doesn't build on Raspbian on Raspberry Pi 4B #2

Open ShamrockLee opened 3 years ago

ShamrockLee commented 3 years ago

I'm trying to install nix on a Raspberry Pi 4 (arch: armv8) purchased about a year ago with Raspbian (arch: armv7l) installed right after I purchase the board.

Reproduction Steps

  1. Ensure that curl and xzutils have been installed.
  2. Run
    mkdir -p /tmp/nix-install && \
    cd /tmp/nix-install && \
    curl -L https://github.com/DavHau/nix-on-armv7l/releases/download/2.3.7-armv7l/nix-2.3.7pre0_0000000-armv7l-linux.tar.xz | tar xJ && \
    cd nix-* &&\
    ./install-multi-user
  3. Run
    sudo su
    echo "extra-substituters = https://thefloweringash-armv7.cachix.org" >> /etc/nix/nix.conf
    echo "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= thefloweringash-armv7.cachix.org-1:v+5yzBD2odFKeXbmC+OPWVqx4WVoIVO6UXgnSAWFtso=" >> /etc/nix/nix.conf
  4. Log out and log in.
  5. Run
    nix-shell -p nix-info --run 'nix-info'

Error message

post-installation fixup
checking for references to /build/ in /nix/store/9xjp4x40mwcw3x9va0vcf936p7c06jgw-bootstrap-stage2-gcc-wrapper-...
substituteStream(): WARNING: pattern '
' doesn't match anything in file '/nix/store/9xjp4x40mwcw3x9va0vcf936p7c06jgw-bootstrap-stage2-gcc-wrapper-/nix-support/libc-ldflags'
substituteStream(): WARNING: pattern '
' doesn't match anything in file '/nix/store/9xjp4x40mwcw3x9va0vcf936p7c06jgw-bootstrap-stage2-gcc-wrapper-/nix-support/libcxx-cxxflags'
substituteStream(): WARNING: pattern '
' doesn't match anything in file '/nix/store/9xjp4x40mwcw3x9va0vcf936p7c06jgw-bootstrap-stage2-gcc-wrapper-/nix-support/libcxx-ldflags'
building '/nix/store/wv5aqr1jmx230jxmk6dnr15lv98a1i79-bootstrap-stage2-stdenv-linux.drv'...
building '/nix/store/cxfslskkf96vsw9wr4xw5wzpqidakljk-linux-headers-5.10.4.drv'...
unpacking sources
unpacking source archive /nix/store/h0a8a370h9sf9c0dg27ndahmr1jda573-linux-5.10.4.tar.xz
source root is linux-5.10.4
setting SOURCE_DATE_EPOCH to timestamp 1609325669 of file linux-5.10.4/virt/lib/irqbypass.c
patching sources
applying patch /nix/store/69lyjyca86317hdsc1rwf3ahn7s5kiyn-no-relocs.patch
patching file arch/x86/Makefile
Hunk #1 succeeded at 213 (offset -18 lines).
configuring
no configure script, doing nothing
building
  HOSTCC  scripts/basic/fixdep
bash: line 1:  3866 Segmentation fault      scripts/basic/fixdep scripts/basic/.fixdep.d scripts/basic/fixdep 'gcc -Wp,-MMD,scripts/basic/.fixdep.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89         -o scripts/basic/fixdep scripts/basic/fixdep.c   ' > scripts/basic/.fixdep.cmd
make[1]: *** [scripts/Makefile.host:95: scripts/basic/fixdep] Error 139
make[1]: *** Deleting file 'scripts/basic/fixdep'
make: *** [Makefile:535: scripts_basic] Error 2
builder for '/nix/store/cxfslskkf96vsw9wr4xw5wzpqidakljk-linux-headers-5.10.4.drv' failed with exit code 2
building '/nix/store/ghlikj7xwqzgxzzkw9aa1v1ladzr1lpg-expand-response-params.drv'...
cannot build derivation '/nix/store/zy2h7z1wqa63sl365g0xsax8r7agcly8-glibc-2.32-24.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/32i1h92g6c92h52gsb3qlyyly1pjibd3-stdenv-linux.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/xwx1dw2ma4665zwz6pwl0n8m57g0maxv-stdenv-linux.drv': 1 dependencies couldn't be built
error: build of '/nix/store/556znrr71mxaqks0gxhgarwgr0ydbqhv-bash-interactive-4.4-p23.drv', '/nix/store/dfknbdvf8pb12wrw5vafcir7yjaf6k0f-bash-4.4-p23.drv', '/nix/store/xi3dx7mrvcqikm3bkb3is7ysnpag1nd2-nix-info.drv', '/nix/store/xwx1dw2ma4665zwz6pwl0n8m57g0maxv-stdenv-linux.drv' failed
DavHau commented 3 years ago

Did you know, that modern Raspbian / Respberry PI OS can be configured to work with aarch64 binaries? I'd highly recommend to go that route instead of going through the hassle of armv7l+nix.

See: https://medium.com/for-linux-users/how-to-make-your-raspberry-pi-4-faster-with-a-64-bit-kernel-77028c47d653

Afterwards you might have to also set nix to use aarch64 via /etc/nix/nix.conf. Please let me know if that worked for you

ShamrockLee commented 3 years ago

@DavHau Thank you for that.

I later got Raspberry Pi 64bit (beta) and installed Nix and nixpkgs packages on it. All work smoothly without hacks.

Here is how I did it; https://discourse.nixos.org/t/install-nix-on-raspberry-pi-4-without-hacks/11107