Skip to content

running ghc gets gcc linker compile error on mac os

Summary

I downloaded ghc from https://www.haskell.org/ghcup/. I am trying to run the program hello.hs which contains main = putStrLn "Hello, world" by typing ghc hello.hs in the terminal. Doing so gives me this error;

Linking hello ...
Undefined symbols for architecture x86_64:
  "___darwin_check_fd_set_overflow", referenced from:
      _awaitEvent in libHSrts.a(Select.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

I have XCode version 12.5.1 and xcode-select installed. I also have stack version 2.7.1

Steps to reproduce

Download ghc on mac os https://www.haskell.org/ghcup/, create the hello.hs file, run ghc hello.hs

Expected behavior

I expect the program to compile into an executable

Environment

  • GHC version used: 8.10.5

Optional:

  • Operating System: Big Sur 11.1
  • System Architecture:
Edited by Johnmancini30
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information