{"id":20132527,"url":"https://github.com/aherrmann/demo-cabal-reproducibility-issue","last_synced_at":"2026-05-13T03:04:49.495Z","repository":{"id":71967631,"uuid":"434314756","full_name":"aherrmann/demo-cabal-reproducibility-issue","owner":"aherrmann","description":null,"archived":false,"fork":false,"pushed_at":"2022-01-31T16:00:10.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-13T09:10:04.277Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aherrmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"bazel-rules-authors-sig"}},"created_at":"2021-12-02T17:30:54.000Z","updated_at":"2021-12-02T17:31:04.000Z","dependencies_parsed_at":"2023-09-13T18:34:39.803Z","dependency_job_id":null,"html_url":"https://github.com/aherrmann/demo-cabal-reproducibility-issue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aherrmann%2Fdemo-cabal-reproducibility-issue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aherrmann%2Fdemo-cabal-reproducibility-issue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aherrmann%2Fdemo-cabal-reproducibility-issue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aherrmann%2Fdemo-cabal-reproducibility-issue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aherrmann","download_url":"https://codeload.github.com/aherrmann/demo-cabal-reproducibility-issue/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241577189,"owners_count":19984951,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T20:53:53.711Z","updated_at":"2026-05-13T03:04:44.456Z","avatar_url":"https://github.com/aherrmann.png","language":"Shell","funding_links":["https://opencollective.com/bazel-rules-authors-sig"],"categories":[],"sub_categories":[],"readme":"Demonstrates how Cabal not supporting `${pkgroot}` or similar in\n`--extra-include-dirs` and `--extra-lib-dirs` makes builds of Cabal packages\nnon-relocatable and non-reproducible.\n\nThis repository contains:\n\n- A C library in `myclib`.\n- A Cabal package in `mypackage` that depends on the C library.\n- A build and install script in `build.sh`.\n\nThe build script builds and installs the C library and Cabal package into\n`install1` and `install2` next to the build script.\n\nThe build is configured to produce relocatable and reproducible outputs.\nHowever, because Cabal requires that `--extra-include-dirs` and\n`--extra-lib-dirs` be absolute paths, the install directory leaks into the\noutputs, making them neither relocatable nor reproducible if the install dir is\nnon-deterministic.\n\nThis models the [Bazel][bazel] use-case with [`rules_haskell`][rules_haskell],\nwhere the Cabal package is built and installed within a Bazel controlled\nsandbox directory. This directory is created by Bazel under a non-deterministic\npath.\n\nThe install directory leaks into the output in two places:\n\n1. The GHC package configuration and cached package-db in the `library-dirs`,\n   `dynamic-library-dirs`, and `include-dirs` fields.\n2. In the flag hash of the generated interface files.\n\n1\\. can be fixed retroactively by replacing the absolute install path by\n`${pkgroot}` in the package configuration file and re-caching the package-db.\n\n2\\. poses a problem.\n\n```\n$ ./build.sh\n$ diff -ru install1 install2\nBinary files install1/mypackage/lib/x86_64-linux-ghc-8.10.4/mypackage-0.1.0.0/MyLib.dyn_hi and install2/mypackage/lib/x86_64-linux-ghc-8.10.4/mypackage-0.1.0.0/MyLib.dyn_hi differ\nBinary files install1/mypackage/lib/x86_64-linux-ghc-8.10.4/mypackage-0.1.0.0/MyLib.hi and install2/mypackage/lib/x86_64-linux-ghc-8.10.4/mypackage-0.1.0.0/MyLib.hi differ\n\n$ diff -u \u003c(ghc --show-iface install1/mypackage/lib/x86_64-linux-ghc-8.10.4/mypackage-0.1.0.0/MyLib.dyn_hi) \u003c(ghc --show-iface install2/mypackage/lib/x86_64-linux-ghc-8.10.4/mypackage-0.1.0.0/MyLib.dyn_hi)\n--- /dev/fd/63  2021-12-02 18:28:50.384451386 +0100\n+++ /dev/fd/62  2021-12-02 18:28:50.384451386 +0100\n@@ -9,7 +9,7 @@\n   ABI hash: 40c998ce5a2efd19318802ef4b6e99c8\n   export-list hash: fabac45b1ffe69f3e298cb12c382dbdd\n   orphan hash: 693e9af84d3dfcc71e640e005bdc5e2e\n-  flag hash: 11ce02affc63497bd31721d744d1d5aa\n+  flag hash: f6e9c244bf005cd7b0940ab9a3cf58a6\n   opt_hash: cb09a535710eb16767a299f2ded44a31\n   hpc_hash: 93b885adfe0da089cdf634904fd59f71\n   plugin_hash: ad164012d6b1e14942349d58b1132007\n\n$ diff -u \u003c(ghc --show-iface install1/mypackage/lib/x86_64-linux-ghc-8.10.4/mypackage-0.1.0.0/MyLib.hi) \u003c(ghc --show-iface install2/mypackage/lib/x86_64-linux-ghc-8.10.4/mypackage-0.1.0.0/MyLib.hi)\n--- /dev/fd/63  2021-12-02 18:28:21.115660287 +0100\n+++ /dev/fd/62  2021-12-02 18:28:21.115660287 +0100\n@@ -9,7 +9,7 @@\n   ABI hash: 40c998ce5a2efd19318802ef4b6e99c8\n   export-list hash: fabac45b1ffe69f3e298cb12c382dbdd\n   orphan hash: 693e9af84d3dfcc71e640e005bdc5e2e\n-  flag hash: 11ce02affc63497bd31721d744d1d5aa\n+  flag hash: f6e9c244bf005cd7b0940ab9a3cf58a6\n   opt_hash: cb09a535710eb16767a299f2ded44a31\n   hpc_hash: 93b885adfe0da089cdf634904fd59f71\n   plugin_hash: ad164012d6b1e14942349d58b1132007\n```\n\n[bazel]: https://bazel.build\n[rules_haskell]: https://haskell.build\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faherrmann%2Fdemo-cabal-reproducibility-issue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faherrmann%2Fdemo-cabal-reproducibility-issue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faherrmann%2Fdemo-cabal-reproducibility-issue/lists"}