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

Cross-compilation of Haskell packages with custom setup program #39417

Open
bgamari opened this issue Apr 24, 2018 · 3 comments
Open

Cross-compilation of Haskell packages with custom setup program #39417

bgamari opened this issue Apr 24, 2018 · 3 comments
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 6.topic: haskell

Comments

@bgamari
Copy link
Contributor

bgamari commented Apr 24, 2018

Issue description

Currently cross-compilation is broken as Setup.hs is built against host packages, rather than build packages (buildHaskellPackages) as it should be.

Steps to reproduce

$ git clone git@github.com:nixos/nixpkgs
$ git -C nixpkgs checkout 51a345c6bb5010fda083ed7e1467b1b5e267fe4e
$ cat <<EOF >default.nix
let
  config_module = {config, lib, pkgs, ... }: {
    environment.systemPackages = with pkgs; [
      perlXMLParser
      haskellPackages.heaps
    ];
    nixpkgs.crossSystem = {
      config = "armv7l-unknown-linux-gnueabihf";
      arch = "armv7l";
      float = "hard";
      fpu = "vfpv3-d16";
      withTLS = true;
      openssl.system = "linux-armv4";
      platform = pkgs.platforms.armv7l-hf-multiplatform // {
        kernelBaseConfig = "xilinx_zynq_defconfig";
        kernelTarget = "uImage";
        kernelMakeFlags = [ "LOADADDR=0x0200000" ];
        uboot = pkgs.ubootMicrozed;
      };
    };

    boot.loader.grub.enable = false;
    boot.loader.generic-extlinux-compatible.enable = true;
    boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux;
    boot.kernelParams = [];
    boot.supportedFilesystems = [ "vfat" ];
  };

  nixos = import ./nixpkgs/nixos {
    configuration = {
      imports = [ config_module ];

      environment.noXlibs = true;
      documentation.info.enable = false;
      fonts.fontconfig.enable = false;
      security.polkit.enable = false;
      security.rngd.enable = false;
      system.autoUpgrade.enable = false;
      services.udisks2.enable = false;
      services.nixosManual.enable = false;
      services.bind.enable = false;

      #nixpkgs.overlays = [ (import ./overlay) ];
      nixpkgs.config.allowBroken = true;

      fileSystems."/".device = "/dev/mmcblk0p2";

      # FIXME: this probably should be in installation-device.nix
      users.extraUsers.root.initialHashedPassword = "";
    };
  };

in
  nixos
EOF
$ nix build -f . pkgs.haskellPackages.heaps
...
  compileBuildDriverPhase
  setupCompileFlags: -package-db=/tmp/nix-build-heaps-0.3.6-armv7l-unknown-linux-gnueabihf.drv-0/package.conf.d -j16 -threaded
  [1 of 1] Compiling Main             ( Setup.lhs, /tmp/nix-build-heaps-0.3.6-armv7l-unknown-linux-gnueabihf.drv-0/Main.o )

  Setup.lhs:12:1: error:
      Bad interface file: /nix/store/k2cmlas0kjj1zbh7yzy4lv3y5v544zf1-cabal-doctest-1.0.6-armv7l-unknown-linux-gnueabihf/lib/ghc-8.2.2/cabal-doctest-1.0.6/Distribution/Extra/Doctest.hi
          magic number mismatch: old/corrupt interface file? (wanted 33214052, got 129742)
     |
  12 | import Distribution.Extra.Doctest ( defaultMainWithDoctests )
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the
results.

@Ericson2314 Ericson2314 added 6.topic: portability General portability concerns, not specific to cross-compilation or a specific platform 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 6.topic: haskell and removed 6.topic: portability General portability concerns, not specific to cross-compilation or a specific platform labels Apr 24, 2018
@Ericson2314 Ericson2314 added this to the 18.09 milestone Apr 24, 2018
@bgamari
Copy link
Contributor Author

bgamari commented Apr 24, 2018

It's possible that @angerman fixes this in #37254.

@matthewbauer matthewbauer modified the milestones: 18.09, 19.03 Oct 1, 2018
@matthewbauer matthewbauer modified the milestones: 19.03, 19.09 May 27, 2019
@Ericson2314
Copy link
Member

Isn't this fixed now?

@stale
Copy link

stale bot commented Jun 2, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 2, 2020
@veprbl veprbl removed this from the 19.09 milestone May 31, 2021
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 6.topic: haskell
Projects
None yet
Development

No branches or pull requests

4 participants