Skip to content

GHC 9.4.5 build fails during 'installPhase' on 'x86_64-darwin' #2008

@rvem

Description

@rvem

Describe the bug

An attempt to build ghc945 on x86_64-darwin fails during the installation phase, related error log:

ghc> Configuration done, ready to 'make install'
ghc> (see README and INSTALL files for more info.)
ghc> ****************************************************
ghc> Copying binaries to /nix/store/2q707g19dwc7hn8j1qhv1p1j4rixqdhi-ghc-9.4.5/lib/ghc-9.4.5/bin
ghc> /nix/store/8d6h6q4jpd1z2cjf2lxcp9xpi6dbpz5g-coreutils-9.1/bin/install -c -m 755 -d "/nix/store/2q707g19dwc7hn8j1qhv1p1j4rixqdhi-ghc-9.4.5/lib/ghc-9.4.5/bin"
ghc> for i in ./bin/deriveConstants ./bin/deriveConstants-ghc-9.4.5 ./bin/genprimopcode ./bin/genprimopcode-ghc-9.4.5 ./bin/ghc ./bin/ghc-9.4.5 ./bin/ghc-iserv ./bin/ghc-iserv-dyn ./bin/ghc-iserv-dyn-ghc-9.4.5 ./bin/ghc-iserv-ghc-9.4.5 ./bin/ghc-iserv-prof ./bin/ghc-iserv-prof-ghc-9.4.5 ./bin/ghc-pkg ./bin/ghc-pkg-9.4.5 ./bin/haddock ./bin/haddock-ghc-9.4.5 ./bin/hp2ps ./bin/hp2ps-ghc-9.4.5 ./bin/hpc ./bin/hpc-ghc-9.4.5 ./bin/hsc2hs ./bin/hsc2hs-ghc-9.4.5 ./bin/runghc ./bin/runghc-9.4.5 ./bin/runhaskell ./bin/runhaskell-9.4.5 ./bin/unlit ./bin/unlit-ghc-9.4.5; do \
ghc>         if test -L "$i"; then \
ghc>                 cp -RP "$i" "/nix/store/2q707g19dwc7hn8j1qhv1p1j4rixqdhi-ghc-9.4.5/lib/ghc-9.4.5/bin"; \
ghc>         else \
ghc>                 /nix/store/8d6h6q4jpd1z2cjf2lxcp9xpi6dbpz5g-coreutils-9.1/bin/install -c -m 755 "$i" "/nix/store/2q707g19dwc7hn8j1qhv1p1j4rixqdhi-ghc-9.4.5/lib/ghc-9.4.5/bin"; \
ghc>         fi; \
ghc> done
ghc> # Work around #17418 on Darwin
ghc> if [ -e "/usr/bin/xattr" ]; then \
ghc>         "/usr/bin/xattr" -c -r "/nix/store/2q707g19dwc7hn8j1qhv1p1j4rixqdhi-ghc-9.4.5/lib/ghc-9.4.5/bin"; \
ghc> fi
ghc> Traceback (most recent call last):
ghc>   File "/usr/bin/xattr", line 8, in <module>
ghc>     from pkg_resources import load_entry_point
ghc>   File "/nix/store/a8yaz6nkw14zy5f8jkb9v81cg7dfpmf7-python3.10-setuptools-67.4.0/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1435
ghc>     raise SyntaxError(e) from e
ghc>                             ^
ghc> SyntaxError: invalid syntax
ghc> make: *** [Makefile:144: install_bin_libdir] Error 1
  • Build system: x86_64-darwin (MacOS 11.6 20G165).
  • GHC version: 9.4.5.
  • Haskell.nix version (or commit) used: b113a4a63c54f34d49d9f5d48ba6bbd65300bfa3.

Steps To Reproduce

On x86_64-darwin:

nix flake init --template templates#haskell-nix --impure
nix build .#legacyPackages.x86_64-darwin.haskell-nix.compiler.ghc945

Expected behavior

Build succeeds.

Additional context

Seems like xattr is used during installation since 9.2.3.
See https://gitlab.haskell.org/ghc/ghc/-/blob/ghc-9.4.5-release/hadrian/bindist/Makefile?ref_type=tags#L149.
There is an existing workaround for buildPhase that uses xattr as well. Perhaps, it can be reused for installation but a naive approach to add it to preInstall didn't work for some reason

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions