ghc 8.8.1 fails on macOS 10.15 Catalina
Summary
ghc 8.8.1 compiled on macOS 10.15 with system compiler (Xcode 11.1) completes bootstrap, but the compiler later fails to run simple programs with a memory-related error:
ghc: mmap 131072 bytes at 0x0: Operation not permitted
ghc: Try specifying an address with +RTS -xm<addr> -RTS
ghc: internal error: m32_allocator_init: Failed to map
(GHC version 8.8.1 for x86_64_apple_darwin)
This is reproducible in several setups, both inside VMs and on physical hardware.
Steps to reproduce
On macOS 10.15 Catalina, with Xcode 11.1 (system compiler):
- ghc 8.8.1 is built from ghc-8.8.1-src.tar.xz (as part of Homebrew)
- bootstrap completes
- Run a simple test, watch if fail:
rmeur /tmp $ cat hello.rs
main = putStrLn "Hello Homebrew"
rmeur /tmp $ /usr/local/Cellar/ghc/8.8.1/bin/runghc -v hello.rs
Glasgow Haskell Compiler, Version 8.8.1, stage 2 booted by GHC version 8.6.5
Using binary package database: /usr/local/Cellar/ghc/8.8.1/lib/ghc-8.8.1/package.conf.d/package.cache
package flags []
loading package database /usr/local/Cellar/ghc/8.8.1/lib/ghc-8.8.1/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.5.3
wired-in package integer-wired-in mapped to integer-gmp-1.0.2.0
wired-in package base mapped to base-4.13.0.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.15.0.0
wired-in package ghc mapped to ghc-8.8.1
package flags []
loading package database /usr/local/Cellar/ghc/8.8.1/lib/ghc-8.8.1/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.5.3
wired-in package integer-wired-in mapped to integer-gmp-1.0.2.0
wired-in package base mapped to base-4.13.0.0
wired-in package rts mapped to rts-1.0
wired-in package template-haskell mapped to template-haskell-2.15.0.0
wired-in package ghc mapped to ghc-8.8.1
*** Desugar:
*** Simplify [expr]:
!!! Simplify [expr]: finished in 0.18 milliseconds, allocated 0.056 megabytes
*** CorePrep [expr]:
!!! CorePrep [expr]: finished in 3.17 milliseconds, allocated 1.705 megabytes
*** ByteCodeGen [Ghci1]:
!!! ByteCodeGen [Ghci1]: finished in 0.10 milliseconds, allocated 0.029 megabytes
ghc: mmap 131072 bytes at 0x0: Operation not permitted
ghc: Try specifying an address with +RTS -xm<addr> -RTS
ghc: internal error: m32_allocator_init: Failed to map
(GHC version 8.8.1 for x86_64_apple_darwin)
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
Expected behavior
The program should run without error.
Environment
- GHC version used:
Optional:
- Operating System: macOS 10.15 Catalina
- System Architecture: x86_64