Skip to content

Unable to compile Bisons/Flex benchmarks #5

Description

@ju1m

Looks like C files listed in:
https://github.com/J-mie6/ParsleyHaskell/blob/a20a8a6ad1c266b4eb3e5f3c3cb72be3daf1e6de/parsley.cabal#L51
are missing or voluntarily not committed in the git repository.
I thus naïvely tried to generate them manually like so:

cd benchmarks/Bisons/
flex Nandlang.l
bison -d Nandlang.y # -d also generates Nandlang.tab.h

However, when compiling benchmarks I hit this error:

$ nix -L run .#benchmarks
[…]
  ghc: panic! (the 'impossible' happened)
    (GHC version 8.6.5 for x86_64-unknown-linux):
        Loading temp shared object failed: /build/ghc396_0/libghc_5.so: undefined symbol: yylex

Should I add some pkgconfig-depends: or extra-libraries: because some C lib is missing?
Or is it related to haskell/cabal#5623 ? But then how could it have ever worked?
Anyway, everything works as expected after removing this problematic benchmark: https://github.com/J-mie6/ParsleyHaskell/blob/a20a8a6ad1c266b4eb3e5f3c3cb72be3daf1e6de/benchmarks/Benchmarks.hs#L189

Thanks for this amazing library.

My current hacky flake.nix to reproduce if need be:

{
# Update inputs with:
# nix flake update --recreate-lock-file
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.haskell-nix.url = "github:input-output-hk/haskell.nix";
inputs.all-hies.url = "github:infinisil/all-hies";
inputs.all-hies.flake = false;
outputs = inputs: let
  projectName = "parsley";
  in inputs.flake-utils.lib.eachDefaultSystem (system: let
    #pkgs = inputs.haskell-nix.legacyPackages.${system};
    pkgs = import inputs.haskell-nix.sources.nixpkgs (inputs.haskell-nix.nixpkgsArgs // {
      localSystem = { inherit system; };
      overlays = inputs.haskell-nix.nixpkgsArgs.overlays ++ [
        (import inputs.all-hies {}).overlay
        (self: super: {
          fl = self.flex;
        })
      ];
    });
    compiler-nix-name = "ghc865";
    project = pkgs.haskell-nix.cabalProject {
      src = pkgs.haskell-nix.haskellLib.cleanGit {
        name = projectName;
        src = ./.;
      };
      inherit compiler-nix-name;
      index-state = "2020-08-28T00:00:00Z";
      # To be kept up to date with source-repository-package entries in cabal.project
      sha256map = {
        "https://github.com/J-mie6/lift-plugin.git"."e7bf0b4ee361a17c55170ce234a5542544625991" =
          "kLw6EjBApspjMs9kC+2Jl9sIgTnM/wfO+iADElpTfa0=";
        "https://github.com/J-mie6/idioms-plugins.git"."1ca37d047d5c8568bee6caf5a506995cd53265f5" =
          "PoBllnC7Q2S+cKriqjGR58QsA0GvrZ8R8h7GWHsZyxc=";
      };
      # Update by commenting materialized and running:
      # nix run .#materialize
      #materialized = ./plan-nix;
    };
    in {
    # Build with: nix build
    defaultPackage = project.${projectName}.components.exes."playground";
    #packages.${projectName} = project;
    # Run with: nix run .#benchmarks -- --output=benchmarks.html
    apps."benchmarks" = {
      type = "app";
      program = "${project.${projectName}.components.exes."benchmarks"}/bin/benchmarks";
    };
    # Run with: nix run .#playground
    apps."playground" = {
      type = "app";
      program = "${inputs.self.defaultPackage.${system}}/bin/playground";
    };
    # Run with: nix run .#materialize
    apps.materialize = {
      type = "app";
      program = (pkgs.writeShellScript "materialize" ''
        ${pkgs.rsync}/bin/rsync --delete -ai ${project.plan-nix}/ plan-nix/
      '').outPath;
    };
    # Run with: nix run .#register
    apps.register = {
      type = "app";
      program = (pkgs.writeShellScript "register" ''
        set -x
        nix-store --add-root nix.root --indirect --realise ${project.roots}
      '').outPath;
    };
    # Get a development environment with: nix develop
    devShell = project.shellFor {
      packages = hpkgs: [
        hpkgs."${projectName}"
      ];
      #components = hpkgs: [];
      #additional = hpkgs: [];
      withHoogle = false;
      tools = {
        cabal = "3.2.0.0";
        #hie = "unstable";
        #hlint = "2.2.11";
      };
      builtInputs = with project.haskellPackages; [
      ];
      exactDeps = true;
      shellHook = ''
      '';
    };
    }
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions