ormolu icon indicating copy to clipboard operation
ormolu copied to clipboard

Ormolu 0.5.0.0 fails to build on M1 Macs

Open i-am-tom opened this issue 3 years ago • 8 comments

Describe the bug

... Or, at least, I think it does. I've so far checked it on an M1 Pro, and received much the same output as this. Specifically, everything seems to build happily until the executable:

Configuring executable 'ormolu' for ormolu-0.5.0.0..
Preprocessing executable 'ormolu' for ormolu-0.5.0.0..
Building executable 'ormolu' for ormolu-0.5.0.0..
[1 of 2] Compiling Paths_ormolu     ( /Users/tom/Git/ormolu/dist-newstyle/build/aarch64-osx/ghc-8.10.7/ormolu-0.5.0.0/x/ormolu/build/ormolu/autogen/Paths_ormolu.hs, /Users/tom/Git/ormolu/dist-newstyle/build/aarch64-osx/ghc-8.10.7/ormolu-0.5.0.0/x/ormolu/build/ormolu/ormolu-tmp/Paths_ormolu.o, /Users/tom/Git/ormolu/dist-newstyle/build/aarch64-osx/ghc-8.10.7/ormolu-0.5.0.0/x/ormolu/build/ormolu/ormolu-tmp/Paths_ormolu.dyn_o )
[2 of 2] Compiling Main             ( app/Main.hs, /Users/tom/Git/ormolu/dist-newstyle/build/aarch64-osx/ghc-8.10.7/ormolu-0.5.0.0/x/ormolu/build/ormolu/ormolu-tmp/Main.o, /Users/tom/Git/ormolu/dist-newstyle/build/aarch64-osx/ghc-8.10.7/ormolu-0.5.0.0/x/ormolu/build/ormolu/ormolu-tmp/Main.dyn_o )
Linking /Users/tom/Git/ormolu/dist-newstyle/build/aarch64-osx/ghc-8.10.7/ormolu-0.5.0.0/x/ormolu/build/ormolu/ormolu ...
clang-11: error: unable to execute command: Segmentation fault: 11
clang-11: error: linker command failed due to signal (use -v to see invocation)
`clang' failed in phase `Linker'. (Exit code: 254)

To Reproduce

Assuming I'm correct, then run the following on an M1 Mac:

Expected behavior The build should complete successfully.

Environment

  • Apple macOS Monterey 12.2.1 on an M1 Pro chip
  • Tested with 0.5.0.0 and HEAD

Additional context The error was originally encountered after finding the linked homebrew error when 0.5.0.0 wasn't found on Brew.

i-am-tom avatar Jun 16 '22 15:06 i-am-tom

+1, same issue using an M1 Pro.

asarkar avatar Jul 06 '22 08:07 asarkar

+1 too, same with an M1.

using cabal install ormolu

Configuring executable 'ormolu' for ormolu-0.5.0.0..
Preprocessing executable 'ormolu' for ormolu-0.5.0.0..
Building executable 'ormolu' for ormolu-0.5.0.0..
[1 of 2] Compiling Paths_ormolu     ( dist/build/ormolu/autogen/Paths_ormolu.hs, dist/build/ormolu/ormolu-tmp/Paths_ormolu.o, dist/build/ormolu/ormolu-tmp/Paths_ormolu.dyn_o )
[2 of 2] Compiling Main             ( app/Main.hs, dist/build/ormolu/ormolu-tmp/Main.o, dist/build/ormolu/ormolu-tmp/Main.dyn_o )
Linking dist/build/ormolu/ormolu ...
clang: error: unable to execute command: Segmentation fault: 11
clang: error: linker command failed due to signal (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 254)
cabal: Failed to build exe:ormolu from ormolu-0.5.0.0. See the build log above
for details.

and using stack install ormolu :

Linking /Users/XXX/.stack/setup-exe-cache/aarch64-osx/tmp-Cabal-simple_mPHDZzAJ_3.4.1.0_ghc-9.0.2 ...
ld: warning: ignoring file /Users/XXX/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
ld: warning: ignoring file /Users/XXX/.stack/setup-exe-src/setup-mPHDZzAJ.o, building for macOS-arm64 but attempting to link with file built for unknown-x86_64
Undefined symbols for architecture arm64:
  "_ZCMain_main_closure", referenced from:
      _main in ghc_2.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

--  While building simple Setup.hs (scroll up to its section to see the error) using:
      /Users/XXX/.stack/programs/aarch64-osx/ghc-9.0.2/bin/ghc-9.0.2 -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-3.4.1.0 /Users/XXX/.stack/setup-exe-src/setup-mPHDZzAJ.hs /Users/XXX/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -o /Users/XXX/.stack/setup-exe-cache/aarch64-osx/tmp-Cabal-simple_mPHDZzAJ_3.4.1.0_ghc-9.0.2
    Process exited with code: ExitFailure 1

To Reproduce

Assuming we are correct, then run the following on an M1 Mac:

cabal install ormolu or stack install ormolu

Expected behavior

The build should complete successfully.

Environment

Apple macOS Monterey 12.4 on an M1 chip Tested with 0.5.0.0 and HEAD

hvpaiva avatar Jul 20 '22 23:07 hvpaiva

Just to make sure: Is this Ormolu-specific, or does this also happen with other tools (i.e. hlint, stylish-haskell, etc.)?

amesgen avatar Jul 21 '22 07:07 amesgen

hlint is fine for me, haven't tried stylish-haskell.

asarkar avatar Jul 21 '22 08:07 asarkar

Just to make sure: Is this Ormolu-specific, or does this also happen with other tools (i.e. hlint, stylish-haskell, etc.)?

Just Ormolu for me. I installed both HLint and stylish-haskell successfully.

hvpaiva avatar Jul 26 '22 23:07 hvpaiva

Just to make sure: Is this Ormolu-specific, or does this also happen with other tools (i.e. hlint, stylish-haskell, etc.)?

Just Ormolu for me. I installed both HLint and stylish-haskell successfully.

Exactly same here.

sourabhxyz avatar Aug 17 '22 12:08 sourabhxyz

Though, latest binary on release page is working fine on my M1 system ✌️

sourabhxyz avatar Aug 17 '22 13:08 sourabhxyz

I managed to install today via cabal install ormolu too! 🙌

hvpaiva avatar Aug 18 '22 00:08 hvpaiva

Looks good for me, too! Thanks!

i-am-tom avatar Sep 07 '22 12:09 i-am-tom