[mercury-users] Cross-compiling with mingw32

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Feb 13 22:30:28 AEDT 2003

On 13-Feb-2003, Michael Day <mikeday at yeslogic.com> wrote:
> Is it possible to use mingw32 with Mercury on Linux to cross compile 
> programs intended to run on Windows?

In theory yes, but I haven't tried it -- it might require a bit of
fooling around.

> I cannot configure Mercury with --with-cc mingw32-gcc as the configure 
> script appears to default lots of values to unknown if $cross_compiling is 
> yes,

Well, you should be able to configure Mercury that way, and it should work.

But you're right that the result might not be as nice as a native version,
because it may fall back to using minimal capabilities.

> Using mmc --cc mingw32-gcc appears to work, but it fails to link as it
> does not know to use mingw32-ld

In 0.11 and in ROTD releases until very recently (Feb 6th),
`mmc' would invoke `ml' to do the linking.  `ml' uses the
program named in the `MERCURY_C_COMPILER' environment variable
to do the linking.  `mmc' also uses that variable.
So you can use

	MERCURY_C_COMPILER=mingw32-gcc mmc

in bash.

> and of course there is no version of the
> Mercury standard library compiled with mingw32 installed.

You can solve that by installing the Mingw binary distribution of

I suggest the following procedure:

	- install the Mingw binary distribution of Mercury
	  (on your Linux machine)
	- replace the `mercury_compile', `mkinit', and `mdemangle'
	  executables in the installed Mingw distribution with Linux versions
	  (e.g. from one of the Linux binary distribution of Mercury)

	- set the MERCURY_C_COMPILER variable to mingw32-gcc before
	  invoking `mmc' or `mmake'.

Let us know if it works!

Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe

More information about the users mailing list