when building latest GHC on Mac with Xcode 8: Symbol not found: _clock_gettime

Hi everyone, I'm trying to compile ghc from the latest source and am hitting an error "Symbol not found: _clock_gettime". I'm on Mac El Capitan and recently installed Xcode 8 which I'm sure is what caused the problem. Using Google I found some relevant pages including this one https://mail.haskell.org/pipermail/ghc-devs/2016-July/012511.html but I've been unable to figure out what I can do to fix the problem. Any help would be appreciated. The tail end of my compilation output is below. Thanks in advance. John cat ghc/ghc.wrapper >> inplace/bin/ghc-stage2 chmod +x inplace/bin/ghc-stage2 "inplace/bin/ghc-stage2" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -O -H64m -Wall -hide-all-packages -i -iutils/ghctags/. -iutils/ghctags/dist-install/build -Iutils/ghctags/dist-install/build -iutils/ghctags/dist-install/build/ghctags/autogen -Iutils/ghctags/dist-install/build/ghctags/autogen -optP-include -optPutils/ghctags/dist-install/build/ghctags/autogen/cabal_macros.h -package-id Cabal-1.25.0.0 -package-id base-4.9.0.0 -package-id containers-0.5.7.1 -package-id ghc-8.1 -XHaskell2010 -no-user-package-db -rtsopts -Wnoncanonical-monad-instances -odir utils/ghctags/dist-install/build -hidir utils/ghctags/dist-install/build -stubdir utils/ghctags/dist-install/build -c utils/ghctags/./Main.hs -o utils/ghctags/dist-install/build/Main.dyn_o "inplace/bin/ghc-stage2" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -O -H64m -Wall -hide-all-packages -i -iutils/check-api-annotations/. -iutils/check-api-annotations/dist-install/build -Iutils/check-api-annotations/dist-install/build -iutils/check-api-annotations/dist-install/build/check-api-annotations/autogen -Iutils/check-api-annotations/dist-install/build/check-api-annotations/autogen -optP-include -optPutils/check-api-annotations/dist-install/build/check-api-annotations/autogen/cabal_macros.h -package-id Cabal-1.25.0.0 -package-id base-4.9.0.0 -package-id containers-0.5.7.1 -package-id directory-1.2.6.2 -package-id ghc-8.1 -Wall -XHaskell2010 -no-user-package-db -rtsopts -Wnoncanonical-monad-instances -odir utils/check-api-annotations/dist-install/build -hidir utils/check-api-annotations/dist-install/build -stubdir utils/check-api-annotations/dist-install/build -c utils/check-api-annotations/./Main.hs -o utils/check-api-annotations/dist-install/build/Main.dyn_o dyld: lazy symbol binding failed: Symbol not found: _clock_gettime Referenced from: /Users/leo/haskell/ghc/rts/dist/build/libHSrts_thr-ghc8.1.20161010.dylib (which was built for Mac OS X 10.12) Expected in: /usr/lib/libSystem.B.dylib dyld: Symbol not found: _clock_gettime Referenced from: /Users/leo/haskell/ghc/rts/dist/build/libHSrts_thr-ghc8.1.20161010.dylib (which was built for Mac OS X 10.12) Expected in: /usr/lib/libSystem.B.dylib dyld: lazy symbol binding failed: Symbol not found: _clock_gettime Referenced from: /Users/leo/haskell/ghc/rts/dist/build/libHSrts_thr-ghc8.1.20161010.dylib (which was built for Mac OS X 10.12) Expected in: /usr/lib/libSystem.B.dylib dyld: Symbol not found: _clock_gettime Referenced from: /Users/leo/haskell/ghc/rts/dist/build/libHSrts_thr-ghc8.1.20161010.dylib (which was built for Mac OS X 10.12) Expected in: /usr/lib/libSystem.B.dylib make[1]: *** [utils/ghctags/dist-install/build/Main.dyn_o] Trace/BPT trap: 5 make[1]: *** Waiting for unfinished jobs.... make[1]: *** [utils/check-api-annotations/dist-install/build/Main.dyn_o] Trace/BPT trap: 5 make: *** [all] Error 2 i

On Mon, Oct 10, 2016 at 11:22 PM, John Leo
I'm trying to compile ghc from the latest source and am hitting an error "Symbol not found: _clock_gettime". I'm on Mac El Capitan and recently installed Xcode 8 which I'm sure is what caused the problem. Using Google I found some relevant pages including this one https://mail.haskell.org/pipermail/ghc-devs/2016-July/012511.html
but I've been unable to figure out what I can do to fix the problem. Any help would be appreciated.
You need to download the 10.11 Command Line Tools from download.apple.com and reinstall them over the Xcode 8 command line tools, which are for 10.12 and will have problems like this. (Apple intends to correct this in Xcode 8.1.) You need a free Mac Developer account for this, or maybe you can find the 10.11 tools elsewhere. You will then need to clean and rebuild ghc. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

Thanks very much Brandon for your fast reply! That did the trick. I had
to rerun configure as well since when I didn't do that I got a different
but seemingly related error. But after clean, configure and make
everything seems to work again.
John
On Mon, Oct 10, 2016 at 8:27 PM, Brandon Allbery
On Mon, Oct 10, 2016 at 11:22 PM, John Leo
wrote: I'm trying to compile ghc from the latest source and am hitting an error "Symbol not found: _clock_gettime". I'm on Mac El Capitan and recently installed Xcode 8 which I'm sure is what caused the problem. Using Google I found some relevant pages including this one https://mail.haskell.org/pipermail/ghc-devs/2016-July/012511.html
but I've been unable to figure out what I can do to fix the problem. Any help would be appreciated.
You need to download the 10.11 Command Line Tools from download.apple.com and reinstall them over the Xcode 8 command line tools, which are for 10.12 and will have problems like this. (Apple intends to correct this in Xcode 8.1.) You need a free Mac Developer account for this, or maybe you can find the 10.11 tools elsewhere. You will then need to clean and rebuild ghc.
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (2)
-
Brandon Allbery
-
John Leo