Also, nanocurses fails to compile on Mac OS X 10.6.6 with GHC 7.0.2.<br><br>$ cabal install nanocurses<br>Resolving dependencies...<br>Downloading nanocurses-1.5.2...<br>Configuring nanocurses-1.5.2...<br>Preprocessing library nanocurses-1.5.2...<br>

In file included from Curses.hsc:42:<br>cbits/utils.h:7:20: error: config.h: No such file or directory<br>compiling dist/build/UI/Nanocurses/Curses_hsc_make.c failed (exit code 1)<br>command was: /usr/bin/gcc -c dist/build/UI/Nanocurses/Curses_hsc_make.c -o dist/build/UI/Nanocurses/Curses_hsc_make.o -march=i686 -m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -fno-stack-protector -march=i686 -m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -fno-stack-protector -march=i686 -m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -D__GLASGOW_HASKELL__=700 -Ddarwin_BUILD_OS -Ddarwin_HOST_OS -Di386_BUILD_ARCH -Di386_HOST_ARCH -Icbits -I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/unix-2.4.2.0/include -I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/bytestring-0.9.1.10/include -I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/base-4.3.1.0/include -I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/include -I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/include -I/Library/Frameworks/GHC.framework/Versions/7.0.2-i386/usr/lib/ghc-7.0.2/include/<br>

cabal: Error: some packages failed to install:<br>nanocurses-1.5.2 failed during the building phase. The exception was:<br>ExitFailure 1<br clear="all"><div><br></div>Cheers,<div><br></div><div>Andrew Pennebaker</div><div>

<a href="http://www.yellosoft.us" target="_blank">www.yellosoft.us</a></div><br>
<br><br><div class="gmail_quote">On Tue, Apr 5, 2011 at 11:46 PM, Andrew Pennebaker <span dir="ltr">&lt;<a href="mailto:andrew.pennebaker@gmail.com">andrew.pennebaker@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

I&#39;m having trouble using Haskell and ncurses Mac OS X (10.6.6 to be precise).<br><br>GHC 6.12.3 gives me a lot of trouble, and GHC 7.0.2 even more.<br><br>rogue.hs, is a text adventure game in the works.<br><br>$ cat rogue.hs<br>


{-# LANGUAGE OverloadedStrings #-}<br>
import Data.Text<br>
import UI.NCurses<br>
<br>
main :: IO ()<br>
main = runCurses $ do<br>
    win &lt;- defaultWindow<br>
    updateWindow win $ do<br>
        moveCursor 10 10<br>
        drawText &quot;Hello world! Hit &#39;q&#39; to exit&quot;<br>
    render<br>
    waitForQ win<br>
<br>
waitForQ :: Window -&gt; Curses ()<br>
waitForQ win = do<br>
    ev &lt;- getEvent win Nothing<br>
    case ev of<br>
        Just (EventCharacter &#39;q&#39;) -&gt; return ()<br>
        _ -&gt; waitForQ win<br><br>$ sudo port install ncurses ncursesw<br>$ cabal install ncurses<br><div>Resolving dependencies...</div><div>Configuring <span>ncurses</span>-0.2...</div><div>cabal: c2hs version &gt;=0.15 is required but it could not be found.</div>



<div>cabal: Error: some packages failed to install:</div><div><span>ncurses</span>-0.2 failed during the configure step. The exception was:</div><div>ExitFailure 1<br><br>Hmm. Cabal couldn&#39;t find a solution to the c2hs dependency. So I install it manually.<br>


<br>$ cabal install c2hs<br><div>$ cabal install <span>ncurses</span></div><div><div>Resolving dependencies...</div><div>Configuring <span>ncurses</span>-0.2...</div><div>cabal: Missing dependency on a foreign library:</div>



<div>* Missing C library: ncursesw</div><div>This problem can usually be solved by installing the system package that</div><div>provides this library (you may need the &quot;-dev&quot; version). If the library is</div><div>



already installed but in a non-standard location then you can use the flags</div><div>--extra-include-dirs= and --extra-lib-dirs= to specify where it is.</div><div>cabal: Error: some packages failed to install:</div><div>



<span>ncurses</span>-0.2 failed during the configure step. The exception was:</div><div>ExitFailure 1<br></div></div></div><div><br>MacPorts&#39; ncurses isn&#39;t detected by Haskell, so I use Homebrew&#39;s.<br>
<br>$ brew install ncursesw<br><div>$ ghc --make -o rogue rogue.hs</div><div>[2 of 2] Compiling Main             ( rogue.hs, rogue.o )</div>
<div>Linking rogue ...</div><div>ld: warning: in /usr/local/lib/libncursesw.dylib, file was built for unsupported file format which is not the architecture being linked (i386)</div><br>It appears that the Homebrew ncurses library is x86, and GHC is x86_64, or vice-versa.<br>


<br>$ sudo port install ncurses +universal<br>$ sudo port install ncursesw +universal<br>$ brew install --universal ncursesw<br><br>These don&#39;t visibly improve compilation in any way.<br><br>I thought updating Haskell would fix the problem.<br>


<br>$ wget <a href="http://lambda.galois.com/hp-tmp/2011.2.0.0/Haskell%20Platform%202011.2.0.0-i386.pkg" target="_blank">http://lambda.galois.com/hp-tmp/2011.2.0.0/Haskell%20Platform%202011.2.0.0-i386.pkg</a><br>$ sudo installer -pkg &quot;Haskell Platform 2011.2.0.0-i386.pkg&quot; -target /<br>


$ ghc --version<br>The Glorious Glasgow Haskell Compilation System, version 7.0.2<br>$ cabal --version<br>cabal-install version 0.10.2<br>using version 1.10.1.0 of the Cabal library<br><br>But it only made the problem worse. Now ncurses won&#39;t even build.<br>


<br>$ cabal install ncurses<br>Resolving dependencies...<br>Configuring ncurses-0.2...<br>Preprocessing library ncurses-0.2...<br>Building ncurses-0.2...<br>[1 of 4] Compiling UI.NCurses.Enums ( dist/build/UI/NCurses/Enums.hs, dist/build/UI/NCurses/Enums.o )<br>


[2 of 4] Compiling UI.NCurses.Types ( UI/NCurses/Types.hs, dist/build/UI/NCurses/Types.o )<br>[3 of 4] Compiling UI.NCurses       ( dist/build/UI/NCurses.hs, dist/build/UI/NCurses.o )<br>[4 of 4] Compiling UI.NCurses.Panel ( dist/build/UI/NCurses/Panel.hs, dist/build/UI/NCurses/Panel.o )<br>


<br>UI/NCurses/Panel.chs:49:1:<br>    Warning: The import of `UI.NCurses&#39; is redundant<br>               except perhaps to import instances from `UI.NCurses&#39;<br>             To import instances alone, use: import UI.NCurses()<br>


<br>hsncurses-shim.c:5:29:<br>     error: ncursesw/curses.h: No such file or directory<br>cabal: Error: some packages failed to install:<br>ncurses-0.2 failed during the building phase. The exception was:<br>ExitFailure 1<br>


<br>I&#39;d settle for using hscurses, but it won&#39;t compile with GHC 7, and it has its own internal bugs besides.<br><br>$ cabal install hscurses<br>Resolving dependencies...<br>Configuring hscurses-1.4.0.0...<br>configure: WARNING: unrecognized options: --with-gcc<br>


checking for gcc... gcc<br>checking for C compiler default output file name... a.out<br>checking whether the C compiler works... yes<br>checking whether we are cross compiling... no<br>checking for suffix of executables... <br>


checking for suffix of object files... o<br>checking whether we are using the GNU C compiler... yes<br>checking whether gcc accepts -g... yes<br>checking for gcc option to accept ISO C89... none needed<br>checking for addnstr in -lcurses... yes<br>


checking for addnstr in -lncurses... yes<br>checking for waddnwstr in -lncursesw... yes<br>checking for iconv in -liconv... yes<br>checking for libiconv in -liconv... yes<br>checking for libiconv... yes<br>checking how to run the C preprocessor... gcc -E<br>


checking for grep that handles long lines and -e... /usr/bin/grep<br>checking for egrep... /usr/bin/grep -E<br>checking for ANSI C header files... yes<br>checking for sys/types.h... yes<br>checking for sys/stat.h... yes<br>


checking for stdlib.h... yes<br>checking for string.h... yes<br>checking for memory.h... yes<br>checking for strings.h... yes<br>checking for inttypes.h... yes<br>checking for stdint.h... yes<br>checking for unistd.h... yes<br>


checking iconv.h usability... yes<br>checking iconv.h presence... yes<br>checking for iconv.h... yes<br>checking curses.h usability... yes<br>checking curses.h presence... yes<br>checking for curses.h... yes<br>checking ncurses.h usability... yes<br>


checking ncurses.h presence... yes<br>checking for ncurses.h... yes<br>checking ncursesw/ncurses.h usability... no<br>checking ncursesw/ncurses.h presence... yes<br>configure: WARNING: ncursesw/ncurses.h: present but cannot be compiled<br>


configure: WARNING: ncursesw/ncurses.h:     check for missing prerequisite headers?<br>configure: WARNING: ncursesw/ncurses.h: see the Autoconf documentation<br>configure: WARNING: ncursesw/ncurses.h:     section &quot;Present But Cannot Be Compiled&quot;<br>


configure: WARNING: ncursesw/ncurses.h: proceeding with the preprocessor&#39;s result<br>configure: WARNING: ncursesw/ncurses.h: in the future, the compiler will take precedence<br>checking for ncursesw/ncurses.h... yes<br>


checking locale.h usability... yes<br>checking locale.h presence... yes<br>checking for locale.h... yes<br>checking langinfo.h usability... yes<br>checking langinfo.h presence... yes<br>checking for langinfo.h... yes<br>

checking wchar.h usability... yes<br>
checking wchar.h presence... yes<br>checking for wchar.h... yes<br>checking limits.h usability... yes<br>checking limits.h presence... yes<br>checking for limits.h... yes<br>checking signal.h usability... yes<br>checking signal.h presence... yes<br>


checking for signal.h... yes<br>configure: creating ./config.status<br>config.status: creating hscurses.buildinfo<br>config.status: creating cbits/config.h<br>configure: WARNING: unrecognized options: --with-gcc<br>cabal: Missing dependency on a foreign library:<br>


* Missing (or bad) header file: HSCurses.h<br>This problem can usually be solved by installing the system package that<br>provides this library (you may need the &quot;-dev&quot; version). If the library is<br>already installed but in a non-standard location then you can use the flags<br>


--extra-include-dirs= and --extra-lib-dirs= to specify where it is.<br>If the header file does exist, it may contain errors that are caught by the C<br>compiler at the preprocessing stage. In this case you can re-run configure<br>


with the verbosity flag -v3 to see the error messages.<br>cabal: Error: some packages failed to install:<br>hscurses-1.4.0.0 failed during the configure step. The exception was:<br>ExitFailure 1<br><br></div>Cheers,<div>

<br>
</div><div>Andrew Pennebaker</div><div><a href="http://www.yellosoft.us" target="_blank">www.yellosoft.us</a></div>
</blockquote></div><br>