You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This command fails because c2hs interprets Files\include as a filename to process.
The -IC:\Program Files ... should be quoted to preserve the space in the path.
I have attached a test.cabal and Test.chs file that demonstrate the problem.
The text was updated successfully, but these errors were encountered:
Ok, it turns out to be a c2hs bug, not a Cabal bug. It's not clear from the build -v output that we're doing it right, but actually we are! :-) If you run with -v3 then Cabal logs how it's calling external programs using unambiguous Haskell Show syntax: //(formatted for clarity)//
The point is, we are passing "--cppopts=-IC:\Program Files\include" as a single argument to c2hs. There's no shell getting in between so that's the actual argument we pass. No escaping is necessary.
The problem is that c2hs is not nearly so careful. It calls cpp like so:
let cmd = unwords [cpp, cppOpts, newHeaderFile,
">" ++ preprocFile]
exitCode <\- system cmd
That is, it's using the system function. This goes via the system shell so has problems with spaces and escaping.
The solution is for us to fix c2hs to use rawSystem as Cabal does. Actually since c2hs needs to capture the output of the command it'll have to use System.Process.runProcess.
(Imported from Trac #316, reported by jwlato on 2008-08-01)
On windows, path names with spaces aren't passed to build tools properly. In a new project, with a source file Test.chs
and a cabal file with (boilerplate excluded)
I have attached a test.cabal and Test.chs file that demonstrate the problem.
The text was updated successfully, but these errors were encountered: