pure-gen / dump-ast for Windows

44 views
Skip to first unread message

Albert Graef

unread,
Feb 25, 2009, 11:36:21 AM2/25/09
to pure...@googlegroups.com
I just uploaded dump-ast.exe (as a .zip) to the file area, for those who
want to run pure-gen on Windows.

Please note that the gcc 3.x from mingw stable isn't quite good enough
for pure-gen, it needs the C preprocessor from gcc 4.3 (for which there
is a development snapshot on the mingw website). pure-gen will run with
gcc < 4.3, but then the -fdirectives-only option of the C preprocessor
won't work, meaning that pure-gen won't be able to scrape #define'd
constants from the source.

--
Dr. Albert Gr"af
Dept. of Music-Informatics, University of Mainz, Germany
Email: Dr.G...@t-online.de, a...@muwiinfa.geschichte.uni-mainz.de
WWW: http://www.musikinformatik.uni-mainz.de/ag

Albert Graef

unread,
Feb 25, 2009, 11:39:17 AM2/25/09
to pure...@googlegroups.com
Albert Graef wrote:
> I just uploaded dump-ast.exe (as a .zip) to the file area, for those who
> want to run pure-gen on Windows.

Forgot the link:
http://pure-lang.googlegroups.com/web/dump-ast.exe.zip

Ryan Schmidt

unread,
Feb 25, 2009, 5:37:33 PM2/25/09
to pure...@googlegroups.com

On Feb 25, 2009, at 10:36, Albert Graef wrote:

> Please note that the gcc 3.x from mingw stable isn't quite good enough
> for pure-gen, it needs the C preprocessor from gcc 4.3 (for which
> there
> is a development snapshot on the mingw website). pure-gen will run
> with
> gcc < 4.3, but then the -fdirectives-only option of the C preprocessor
> won't work, meaning that pure-gen won't be able to scrape #define'd
> constants from the source.

Is that gcc 4.3 requirement for all OSes? Should I be making the pure-
gen port in MacPorts build with MacPorts gcc 4.3 instead of Apple gcc
4.0?

It built ok with Apple gcc 4.0. How can I test whether it has the
problem you describe?

Albert Graef

unread,
Feb 26, 2009, 5:02:19 AM2/26/09
to pure...@googlegroups.com
Ryan Schmidt wrote:
> Is that gcc 4.3 requirement for all OSes?

Yes. Unless Apple has backported support for -fdirectives-only to its
gcc version.

> Should I be making the pure-
> gen port in MacPorts build with MacPorts gcc 4.3 instead of Apple gcc
> 4.0?

No, it's not a build requirement, pure-gen needs gcc-4.3 as its C
preprocessor at *runtime*. For the build any gcc version should be fine,
as long as ghc is happy with it.

> It built ok with Apple gcc 4.0. How can I test whether it has the
> problem you describe?

Having pure and pure-gen installed, run pure-gen on the attached dummy.h:

pure-gen dummy.h

If everything is ok, there should be no messages and the created
dummy.pure should contain:

/* dummy.h: */
const DUMMY = 99;

But if your gcc lacks support for -fdirectives-only, you'll get a
message like the following:

cc1: error: unrecognized command line option "-fdirectives-only"
Warning: empty output

Also, the generated dummy.pure will then lack the const definition.

I've solved this on Windows by just installing gcc-4.3 in its own
directory and having a little wrapper script which sets PATH so that
pure-gen finds the right gcc. Well, on Windows it's actually a real
executable instead of a script, but on OSX it's much easier, a little
shell script like the following should do:

#! /bin/sh
PATH=/path/to/gcc-4.3/bin:$PATH
export PATH
pure -x /path/to/lib/pure-gen-0.2/pure-gen.pure $*

(You'll have to fill in the /path/to placeholders, of course. That
script should be generated as part of your build process so that it has
the proper pure-gen version number.)

Then you install that script in place of the symbolic link to
pure-gen.pure which 'make install' put into the $(prefix)/bin directory.
Problem solved. (Disclaimer: I didn't test this, but something like this
should do the trick. It works fine on Windows for me.)

Cheers,
Albert

dummy.h

Ryan Schmidt

unread,
Feb 28, 2009, 6:06:33 AM2/28/09
to pure...@googlegroups.com

You're right, using Apple's gcc 4.0 I get:

$ pure-gen dummy.h


cc1: error: unrecognized command line option "-fdirectives-only"
Warning: empty output

$

So I changed it to MacPorts gcc 4.3.3. Unfortunately now I still get:

$ pure-gen dummy.h
Warning: empty output
$

Also, it takes unexpectedly long to do this, or anything else. For
example:

$ time pure-gen --version
pure-gen version 0.3 Copyright (c) 2009 Scott E. Dillard, Albert Graef

real 0m4.181s
user 0m3.810s
sys 0m0.161s
$

This is on Mac OS X 10.4.11 Intel.

Albert Graef

unread,
Feb 28, 2009, 11:42:05 AM2/28/09
to pure...@googlegroups.com
Ryan Schmidt wrote:
> So I changed it to MacPorts gcc 4.3.3. Unfortunately now I still get:
>
> $ pure-gen dummy.h
> Warning: empty output

Hmm, I'm still running gcc 4.3.2. Can you please try the latest pure-gen
in svn:

make
make check

Reply all
Reply to author
Forward
0 new messages