I am trying to compile a (minimal) NixOS image for i686 hardware; I understand Nix dropped official support for i686 years ago, but I am willing to fix broken packages as they come up. However, I am still learning how to debug and fix failing derivations, so some hand-holding would be appreciated!
The sqlite package fails to cross-compile on recent nixpkgs: nix build --impure --expr "(import <nixpkgs> {}).pkgsCross.gnu32.sqlite"
It fails at the check phase, and from digging into the logs it seems to be related to linking libstdc++: .../sqlite-src-3530300/testrunner_bld_all_debug_fuzzcheck-ubsan/fuzzcheck-ubsan: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
The derivation seems to be a pretty bog-standard stdenv derivation, so I am hoping there is an easy fix. I fixed a couple other broken derivations by just adding NIX_LDFLAGS = "-lgcc_s", though I never looked into why the flag is needed on i686 and not on x86-64.
I will look into it further in a couple hours but wanted to ask for help early. Thanks in advance!
I think I avoided pkgsi686Linux because it fails on non-x86-64-linux build machines. Ideally, I’d like to be able to build the derivations from my friend’s MacBook, in addition to my x86-64 computer.
Would a possible solution be for my friend to enable x86-64 emulation? Also, what is the difference between pkgsCross.gnu32 and pkgsi686Linux? I have read through the top-level/stage.nix file but can’t spot the meaningful differences
Also, I am not sure how to use pkgsi686Linux without depending on broken build-time packages. For example, rsync fails to build on i686 after commit 1d337c3: nix build github:nixos/nixpkgs/1d337c3#pkgsi686Linux.rsync
In the relevant NixOS configuration, I have removed rsync from the actual system, but it is still a build dependency (used for constructing the eventual output directory, I believe). If I set nixpkgs.pkgs = nixpkgs.legacyPackages.${system}.pkgsi686Linux;in the configuration, then this failing rsync derivation prevents building the system, because the build-time dependencies are pulling from pkgsi686Linux (I think?)
Instead, if I set nixpkgs.buildPlatform and nixpkgs.hostPlatform, the rsync dependency builds fine (because it builds the native x86_64 version), which avoids blocking the build. But then as we’ve seen, this causes other packages (sqlite) to fail to build