[Haskell-cafe] Cross-compiling fails for package 'directory'

Phil Ruffwind rf at rufflewind.com
Sat Aug 15 21:58:11 UTC 2015

> Is the failure of hsc2hs to support this directive just a matter of "not
> implemented right now", maybe by lack of importance? Or is there a fundamental
> problem?

See also: https://ghc.haskell.org/trac/ghc/ticket/9689

One would probably have to implement a C string literal parser to do
this properly.

> If fixing hsc2hs is hard, could the 'directory' package perhaps choose another
> way to implement this function?

Can you try this workaround?

diff --git a/System/Directory/Internal.hsc b/System/Directory/Internal.hsc
index a0a71db..0f9b71f 100644
--- a/System/Directory/Internal.hsc
+++ b/System/Directory/Internal.hsc
@@ -1,3 +1,5 @@
+##include <HsDirectoryConfig.h>
 #include <HsDirectoryConfig.h>

 module System.Directory.Internal
@@ -28,4 +30,4 @@ import System.Directory.Internal.Posix
 -- | Filename extension for executable files (including the dot if any)
 --   (usually @\"\"@ on POSIX systems and @\".exe\"@ on Windows or OS\/2).
 exeExtension :: String
-exeExtension = (#const_str EXE_EXTENSION)
+exeExtension = EXE_EXTENSION

More information about the Haskell-Cafe mailing list