Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makeFontsCache: Fix cross-compilation, use nativeBuildInputs #73344

Merged
merged 1 commit into from Nov 13, 2019

Conversation

ebkalderon
Copy link
Contributor

@ebkalderon ebkalderon commented Nov 13, 2019

Motivation for this change

This commit fixes missing fc-cache binary from the make-fonts-cache.nix build:

builder for '/nix/store/az48nr8gdqrw3fliddmi82ghj2ljxrj4-fc-cache.drv' failed with exit code 127; last 1 log lines:
  /nix/store/p3z1lgsi7xymvl7akg531ikwiisqs4x5-stdenv-linux/setup: line 1299: fc-cache: command not found
cannot build derivation '/nix/store/swaxvjsf8h0rsmm9kigp6j3f5q5h4nvg-fc-00-nixos-cache.conf.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/wiaiv0pq7w1xm2i2fqp2ngd1ljb4n6n9-fontconfig-conf.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/4zhiwpiyccs0rs26bs3q0w8fwaxrrgw0-fontconfig-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/xhvljdp9b00fbkapx6cbfs4sjdh49qwv-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/w63q0n0vh7vkdfrjmhb41qy1alx7qa8s-nixos-system-nixos-19.09.git.c814289.drv': 1 dependencies couldn't be built

This pull request fixes #67916 (comment) from pull request #67916.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @symphorien @Mic92

This commit fixes missing fc-cache binary from make-fonts-cache.nix build:
```
builder for '/nix/store/az48nr8gdqrw3fliddmi82ghj2ljxrj4-fc-cache.drv' failed with exit code 127; last 1 log lines:
  /nix/store/p3z1lgsi7xymvl7akg531ikwiisqs4x5-stdenv-linux/setup: line 1299: fc-cache: command not found
cannot build derivation '/nix/store/swaxvjsf8h0rsmm9kigp6j3f5q5h4nvg-fc-00-nixos-cache.conf.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/wiaiv0pq7w1xm2i2fqp2ngd1ljb4n6n9-fontconfig-conf.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/4zhiwpiyccs0rs26bs3q0w8fwaxrrgw0-fontconfig-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/xhvljdp9b00fbkapx6cbfs4sjdh49qwv-etc.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/w63q0n0vh7vkdfrjmhb41qy1alx7qa8s-nixos-system-nixos-19.09.git.c814289.drv': 1 dependencies couldn't be built
```
@FRidh FRidh merged commit a95e0ac into NixOS:master Nov 13, 2019
@ebkalderon ebkalderon deleted the cross-compile-make-fonts-cache branch November 14, 2019 03:48
@flokli
Copy link
Contributor

flokli commented Dec 6, 2019

For some reason, I'm still getting a non-native fc-cache binary in there:

building '/nix/store/a6pp3gz1fhbsahc30zgxhhx3mv7snwcf-fc-cache.drv'...
building '/nix/store/rsda56ilyx26aw9nm8if8asqxwh8l2d4-fc-cache.drv'...
/nix/store/vy4gjjx6dqb7mdq1ajpa86ls6mi7ilbk-stdenv-linux/setup: line 1282: /nix/store/57gyiixabb6j4rvhas815nx6vg9y9jg8-fontconfig-2.10.2-armv7l-unknown-linux-gnueabihf-bin/bin/fc-cache: cannot execute binary file: Exec format error
/nix/store/vy4gjjx6dqb7mdq1ajpa86ls6mi7ilbk-stdenv-linux/setup: line 1282: /nix/store/zwampf5q50p3p5hhx1f196ggimyhnzkp-fontconfig-2.12.6-armv7l-unknown-linux-gnueabihf-bin/bin/fc-cache: cannot execute binary file: Exec format error
builder for '/nix/store/a6pp3gz1fhbsahc30zgxhhx3mv7snwcf-fc-cache.drv' failed with exit code 126
builder for '/nix/store/rsda56ilyx26aw9nm8if8asqxwh8l2d4-fc-cache.drv' failed with exit code 126
cannot build derivation '/nix/store/000mcnczvsrsq9554x95alzfky05sn8n-fc-00-nixos-cache.conf.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/xbiml82zmz4c6ih8wahsgj55wq1fgw51-fc-00-nixos-cache.conf.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/xsv6dlgzq6lswszi4w5jdzidm6ynakn8-fontconfig-conf.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/l1h0m0lm9i6553hzqfskh7zabk2qxrn7-fontconfig-etc.drv': 1 dependencies couldn't be built

That's on c33bd19, with

nixpkgs.localSystem = { system = "x86_64-linux"; };
nixpkgs.crossSystem = { system = "armv7l-linux"; };

cc @samueldr @grahamc

@danbst
Copy link
Contributor

danbst commented Feb 5, 2020

was fixed, and then reverted in #51601

@ghost
Copy link

ghost commented Feb 6, 2020

@flokli is right, but the error happens with nixos' fontconfig module, right here

makeCacheConf = { version ? null }:
let
fcPackage = if version == null
then "fontconfig"
else "fontconfig_${version}";
makeCache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; };
cache = makeCache pkgs.${fcPackage};
cache32 = makeCache pkgs.pkgsi686Linux.${fcPackage};
in
pkgs.writeText "fc-00-nixos-cache.conf" ''
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- Font directories -->
${concatStringsSep "\n" (map (font: "<dir>${font}</dir>") config.fonts.fonts)}
<!-- Pre-generated font caches -->
<cachedir>${cache}</cachedir>
${optionalString (pkgs.stdenv.isx86_64 && cfg.cache32Bit) ''
<cachedir>${cache32}</cachedir>
''}
</fontconfig>
'';

Im unsure how to fix this

@flokli
Copy link
Contributor

flokli commented Feb 8, 2020

Hoooh, cache32 is some scary x86_64 only assumption, but it shouldn't be what breaks aarch64. cc @samueldr on that.

@samueldr
Copy link
Member

samueldr commented Feb 8, 2020

Something about nativeBuildInputs splicing being a derivation+callPackage thing, that is hurting us in the nixos module?

@flokli
Copy link
Contributor

flokli commented May 23, 2020

I haven't tried cross-compiling an aarch64/armv7l system from x86_64-linux since some time now, but I what I meant to say here is that https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/config/fonts/fontconfig.nix#L58 refers to pkgs.pkgsi686Linux, which doesn't really makes sense when producing arm images.

This could have been fixed by #84415. @matthewbauer, can you confirm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants