-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathREADME.MinGW-cross
76 lines (52 loc) · 2.8 KB
/
README.MinGW-cross
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
-----------------------------------------------------------------------------
COMPILING MERCURY WITH A MINGW / MINGW-W64 CROSS-COMPILER
You can compile Mercury on Linux with a MinGW or MinGW-w64 cross-compiler.
After copying and adjusting some paths, the Mercury installation should be
usable on Windows. When combined with a native Mercury compiler, it can be
used to cross-compile Mercury applications for Windows.
NOTE: There are currently problems with 64-bit executables in the 'asm_fast*'
grade. The 'none*' and 'reg*' grades do appear to work correctly in our
limited testing.
-----------------------------------------------------------------------------
PREREQUISITES
We assume you are on Linux. You will need a native Mercury installation
installed in the normal way. The native Mercury version should match the
version of Mercury you intend to cross-compile.
You need a MinGW or MinGW-w64 cross-compiler, and a pthreads implementation.
Many Linux distributions will have packages available, e.g. gcc-mingw32 and
friends on Debian. Otherwise, you may try <http://mxe.cc/>.
git clone -b stable https://github.com/mxe/mxe.git
cd mxe
make gcc pthreads JOBS=6
-----------------------------------------------------------------------------
INSTALLATION
Ensure that the MinGW cross-compiler i686-pc-mingw-gcc or similar is in your
PATH. In a fresh copy of the Mercury source tree, run the following in place
of the configure script:
tools/configure_mingw_cross [--host=HOST] OPTIONS...
If your installation uses a host triplet other than "i686-pc-mingw32" then
you must pass that using the --host= option. You may pass other options
through to configure as well, e.g.
tools/configure_mingw_cross \
--host=x86_64-w64-mingw32 \
--prefix=/usr/local/mercury-mingw
Then install Mercury as usual:
mmake install -j6
-----------------------------------------------------------------------------
USING THE CROSS-COMPILER ON LINUX
To use the cross-compiled installation on Linux, you must provide Linux
binaries to substitute each of the .exe files in the bin directory.
The Linux binaries should be from the same version of the Mercury compiler.
For example, you can run a command such as below to hard link the binaries
from the native compiler to the cross-compiler installation, or add the '-s'
option to create symbolic links instead. Be careful not to overwrite the
shell scripts.
ln /usr/local/mercury/bin/* /usr/local/mercury-mingw/bin || true
Now you can run the 'mmc' script from the cross-compiled installation:
% /usr/local/mercury-mingw/bin/mmc -m hello
Making Mercury/int3s/hello.int3
Making Mercury/ints/hello.int
Making Mercury/cs/hello.c
Making Mercury/os/hello.o
Making hello.exe
-----------------------------------------------------------------------------