Haskell入門という本を買いました。
Haskell入門 関数型プログラミング言語の基礎と実践
まずは環境構築からということで本に沿って進めていたのですが、
$ stack setup
したところで以下のようなエラーが出ました。
configure: WARNING: configure can’t recognize your CPP program, you may need to set –with-hs-cpp-flags=FLAGS explicitly
configure: error: in /Users/yoshikiito/.stack/programs/x86_64-osx/ghc-8.0.2.temp/ghc-8.0.2′:
configure: error: C compiler cannot create executables Seeconfig.log’ for more detailsError: Error encountered while configuring GHC with
/Users/yoshikiito/.stack/programs/x86_64-osx/ghc-8.0.2.temp/ghc-8.0.2/configure –prefix=/Users/yoshikiito/.stack/programs/x86_64-osx/ghc-8.0.2/
run in /Users/yoshikiito/.stack/programs/x86_64-osx/ghc-8.0.2.temp/ghc-8.0.2/
ライセンス条項に同意が必要
どうも、xcodeがらみの問題のようでした。
エラーメッセージ内にかかれているconfig.log
の中を確認すると
$ sudo xcodebuild -license
を実行しろと書いてあるので、実行。
その過程で、ライセンス条項への同意を促されるので、同意したのちで再度stack setup
を行い、正常に完了しました。
参考:c++ – Haskell Stack Setup – Can’t Recognize CPP Program – Stack Overflow