[Haskell-cafe] Using m4 as a preprocessor

20 views
Skip to first unread message

Francesco Ariis

unread,
Jan 30, 2015, 3:29:12 PM1/30/15
to haskel...@haskell.org
Hello,
today I tried to compile a Haskell program using m4 as preprocessor,
with the

{-# OPTIONS_GHC -F -pgmF m4 #-}

pragma on top of a .hs file. I didn't add anything else, there are no
''' or '`' in the source. Upon compiling, ghc (7.8.3) complains:

m4: cannot open `/tmp/ghc10655_0/ghc10655_1.hspp': No such file or directory

I searched the net for a solution, but no dice (apparently there are no
Haskell programs using -F -pgmF m4?), so I am writing here.
Any ideas on what is wrong?
_______________________________________________
Haskell-Cafe mailing list
Haskel...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Brandon Allbery

unread,
Jan 30, 2015, 3:48:48 PM1/30/15
to haskell-cafe
On Fri, Jan 30, 2015 at 3:26 PM, Francesco Ariis <fa...@ariis.it> wrote:
pragma on top of a .hs file. I didn't add anything else, there are no
''' or '`' in the source.  Upon compiling, ghc (7.8.3) complains:

    m4: cannot open `/tmp/ghc10655_0/ghc10655_1.hspp': No such file or directory

I searched the net for a solution, but no dice (apparently there are no
Haskell programs using -F -pgmF m4?), so I am writing here.
Any ideas on what is wrong?

"Use -pgmF cmd to select the program to use as the preprocessor. When invoked, the cmd pre-processor is given at least three arguments on its command-line: the first argument is the name of the original source file, the second is the name of the file holding the input, and the third is the name of the file where cmdshould write its output to." 

m4 won't process those parameters the way ghc expects; you'll need a wrapper script.

--
brandon s allbery kf8nh                               sine nomine associates
allb...@gmail.com                                  ball...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

Claude Heiland-Allen

unread,
Jan 30, 2015, 3:49:15 PM1/30/15
to haskel...@haskell.org
Hi Francesco,

On 30/01/15 20:26, Francesco Ariis wrote:
> Hello,
> today I tried to compile a Haskell program using m4 as preprocessor,
> with the
>
> {-# OPTIONS_GHC -F -pgmF m4 #-}
>
> pragma on top of a .hs file. I didn't add anything else, there are no
> ''' or '`' in the source. Upon compiling, ghc (7.8.3) complains:
>
> m4: cannot open `/tmp/ghc10655_0/ghc10655_1.hspp': No such file or directory
>
> I searched the net for a solution, but no dice (apparently there are no
> Haskell programs using -F -pgmF m4?), so I am writing here.
> Any ideas on what is wrong?

Probably the missing file is where the preprocessor should store the
output. Probably you need to write a wrapper script. See:

https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/options-phases.html#pre-processor


Claude
--
http://mathr.co.uk

Francesco Ariis

unread,
Jan 30, 2015, 6:11:02 PM1/30/15
to haskel...@haskell.org
On Fri, Jan 30, 2015 at 08:49:07PM +0000, Claude Heiland-Allen wrote:
> Probably the missing file is where the preprocessor should store the
> output. Probably you need to write a wrapper script. See:
>
> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/options-phases.html#pre-processor

Woops, must have missed that section, thanks!
Reply all
Reply to author
Forward
0 new messages