4

I am following the Udemy Haskell course, which at one point I'm shown to download Haskell using the Stack option. I've configured my $PATH and ran stack setup when I run into an issue.

configure: WARNING: configure can't recognize your CPP program, you may need to set --with-hs-cpp-flags=FLAGS explicitly
configure: error: in `/Users/Dylan/.stack/programs/x86_64-osx/ghc-8.0.2.temp/ghc-8.0.2':
configure: error: C compiler cannot create executables

I have looked into .stack/programs/x86_64-osx/ghc-8.0.2.temp/ghc-8.0.2/config.log and found this...

configure:2234: checking for path to top of build tree
configure:2255: result: /Users/Dylan/.stack/programs/x86_64-osx/ghc-8.0.2.temp/$
configure:2981: checking for perl
configure:2999: found /usr/bin/perl
configure:3011: result: /usr/bin/perl
configure:3070: checking for a BSD-compatible install
configure:3138: result: /usr/bin/install -c
configure:3152: checking whether ln -s works
configure:3156: result: yes
configure:3168: checking for gsed
configure:3199: result: sed
configure:3211: checking XCode version
configure:3222: result: 8.3.3
configure:3226: XCode version component 1: 8
configure:3228: XCode version component 2: 3
configure:3263: checking for gcc
configure:3281: found /usr/bin/gcc
configure:3293: result: /usr/bin/gcc
configure:3573: WARNING: configure can't recognize your CPP program, you may ne$
configure:3623: checking for llc-3.7
configure:3656: result: no
configure:3739: checking for llc
configure:3772: result: no
configure:3872: checking for opt-3.7
configure:3905: result: no
configure:3988: checking for opt
configure:4021: result: no
configure:4120: checking for ld
configure:4138: found /usr/bin/ld
configure:4150: result: /usr/bin/ld
configure:4388: checking for gcc
configure:4415: result: /usr/bin/gcc
configure:4644: checking for C compiler version
configure:4653: /usr/bin/gcc --version >&5

I am able to read configure: WARNING: configure can't recognize your CPP program, you may need to set --with-hs-cpp-flags=FLAGS explicitly, but I am not sure how or where to do that. I've found my settings.in file...

[("GCC extra via C opts", "@GccExtraViaCOpts@"),
 ("C compiler command", "@SettingsCCompilerCommand@"),
 ("C compiler flags", "@SettingsCCompilerFlags@"),
 ("C compiler link flags", "@SettingsCCompilerLinkFlags@"),
 ("C compiler supports -no-pie", "@SettingsCCompilerSupportsNoPie@"),
 ("Haskell CPP command","@SettingsHaskellCPPCommand@"),
 ("Haskell CPP flags","@SettingsHaskellCPPFlags@"),
 ("ld command", "@SettingsLdCommand@"),
 ("ld flags", "@SettingsLdFlags@"),
 ("ld supports compact unwind", "@LdHasNoCompactUnwind@"),
 ("ld supports build-id", "@LdHasBuildId@"),
 ("ld supports filelist", "@LdHasFilelist@"),
 ("ld is GNU ld", "@LdIsGNULd@"),
 ("ar command", "@SettingsArCommand@"),
 ("ar flags", "@ArArgs@"),
 ("ar supports at file", "@ArSupportsAtFile@"),
 ("touch command", "@SettingsTouchCommand@"),
 ("dllwrap command", "@SettingsDllWrapCommand@"),
 ("windres command", "@SettingsWindresCommand@"),
 ("libtool command", "@SettingsLibtoolCommand@"),
 ("perl command", "@SettingsPerlCommand@"),
 ("cross compiling", "@CrossCompiling@"),
 ("target os", "@HaskellTargetOs@"),
 ("target arch", "@HaskellTargetArch@"),
 ("target word size", "@WordSize@"),
 ("target has GNU nonexec stack", "@HaskellHaveGnuNonexecStack@"),
 ("target has .ident directive", "@HaskellHaveIdentDirective@"),
 ("target has subsections via symbols", "@HaskellHaveSubsectionsViaSymbols@"),
 ("Unregisterised", "@Unregisterised@"),
 ("LLVM llc command", "@SettingsLlcCommand@"),
 ("LLVM opt command", "@SettingsOptCommand@")
 ]

But again, I do not know what to do with it. Sorry, if my question is basic, but I have not done something similar to this before, and what I have found online has been difficult to interpret how it is applicable to my situation.

Any help would be greatly appreciated.

Dylan Landry
  • 1,150
  • 11
  • 27
  • May be relevant https://stackoverflow.com/questions/10357804/configure-error-c-compiler-cannot-create-executables – n. m. could be an AI Aug 21 '17 at 13:08
  • @n.m. After reading the accepted answer in your link, I was led to check my Xcode command line tools version. My version was fine, but then I noticed an additional line in my `config.log`. `Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command` Running `sudo xcodebuild -license` fixed my issue. Thanks for the lead n.m. – Dylan Landry Aug 21 '17 at 15:19

1 Answers1

3

@n.m Commented a link leading me to a question's answer that recommended I check my xCode listed version of the developer command line tools. Turns out my version was fine, but I did later find this line in .stack/programs/x86_64-osx/ghc-8.0.2.temp/ghc-8.0.2/config.log that led me to the solution of my problem.

Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command

sudo xcodebuild -license allowed me to then run stack install successfully.

Dylan Landry
  • 1,150
  • 11
  • 27