Project

General

Profile

Installing MinGW » History » Version 2

Redmine Admin, 11/19/2015 02:54 PM

1 1 Redmine Admin
# Installing MinGW
2
3
This is slightly experimental, but we have built Vorpal with it, and it is currently our only path to building facetsall.
4 2 Redmine Admin
5 1 Redmine Admin
This is for 64 bit only.
6
7
8 2 Redmine Admin
* Install the latest compilers from http://tdm-gcc.tdragon.net/download.  The webdl installer is recommended.  Assuming the version is 5.1.0-2, install into C:\TDM-GCC-64\5.1.0-2.
9
* This should add `C:\TDM-GCC-64\5.1.0-2\bin` correctly to the end of your Windows path, but one should check.
10 1 Redmine Admin
* Most recent attempt required installing binutils to be able to create libraries with the mingw ar.  Will need some more sorting out, as previously found:
11
12
NumPy build failure with incorrect MinGW binutils:
13
14 2 Redmine Admin
~~~~~~
15 1 Redmine Admin
generate_def(dll_file, def_file)
16
File "C:\Users\jsalvatier\workspace\numpy\numpy\distutils\mingw32ccompiler.py", line 282, in generate_def
17
raise ValueError("Symbol table not found")
18 2 Redmine Admin
~~~~~~
19 1 Redmine Admin
20
To make your mingw paths consistent, do
21 2 Redmine Admin
22
~~~~~~
23 1 Redmine Admin
mount binary C:/TDM-GCC-64 /TDM-GCC-64
24 2 Redmine Admin
~~~~~~
25
26 1 Redmine Admin
in the bash shell.
27
28
To make this permanent, put
29 2 Redmine Admin
30
~~~~~~
31 1 Redmine Admin
C:/TDM-GCC-64 /TDM-GCC-64 ntfs binary 0 0
32 2 Redmine Admin
~~~~~~
33 1 Redmine Admin
34
as one line in /etc/fstab.
35
36 2 Redmine Admin
[Installing ATLAS on Windows] requires that one link the MinGW compilers into /usr/bin as follows for 64-bit:
37 1 Redmine Admin
38 2 Redmine Admin
~~~~~~
39 1 Redmine Admin
cd /usr/bin
40
ln -s /TDM-GCC-64/5.1.0-2/bin/x86_64-w64-mingw32-gcc.exe .
41
ln -s /TDM-GCC-64/5.1.0-2/bin/x86_64-w64-mingw32-g++.exe .
42
ln -s /TDM-GCC-64/5.1.0-2/bin/x86_64-w64-mingw32-gfortran.exe .
43 2 Redmine Admin
~~~~~~
44 1 Redmine Admin
45 2 Redmine Admin
# MPI for MinGW
46 1 Redmine Admin
47
These notes have not been upgraded in a while.
48
49
A useful reference is http://www.symscape.com/configure-msmpi-for-mingw-w64.
50
51
* Copy the Microsoft HPC Pack 2008 SDK distribution to a new place:
52
53 2 Redmine Admin
~~~~~~
54 1 Redmine Admin
cd /winsame
55
mkdir contrib-mingw
56
cd contrib-mingw
57
mkdir microsoft-hpc-mingw
58
cd microsoft-hpc-mingw
59
cp -R /cygdrive/c/Program\ Files/Microsoft\ HPC\ Pack\ 2008\ SDK/* .
60 2 Redmine Admin
~~~~~~
61 1 Redmine Admin
62 2 Redmine Admin
* Add `#include <basetsd.h>` to the copied mpi.h as line 304.
63
* If `msmpi.dll` is not in `/winsame/contrib-mingw/microsoft-hpc-mingw/Lib/amd64`, there may be a copy of `msmpi.dll` in `C:\\Windows\\System321 that you can copy over.  If so, do the following before the above.
64
65
~~~~~~
66 1 Redmine Admin
cp /cygdrive/c/Windows/System32/msmpi.dll /winsame/contrib-mingw/microsoft-hpc-mingw/Lib/amd64 # For 64 bit, otherwise i386
67 2 Redmine Admin
~~~~~~
68 1 Redmine Admin
69 2 Redmine Admin
* Once `msmpi.dll` is in `/winsame/contrib-mingw/microsoft-hpc-mingw/Lib/amd64` do the following:
70
71
~~~~~~
72 1 Redmine Admin
cd /winsame/contrib-mingw/microsoft-hpc-mingw/Lib
73
cd amd64
74
/TDM-GCC-64/5.1.0-2/x86_64-w64-mingw32/bin/gendef msmpi.dll # creates msmpi.def
75
/TDM-GCC-64/5.1.0-2/x86_64-w64-mingw32/bin/dlltool -d msmpi.def -l libmsmpi.a -D msmpi.dll 
76 2 Redmine Admin
~~~~~~
77 1 Redmine Admin
78
79 2 Redmine Admin
The build system for your project then will need to add the flags
80 1 Redmine Admin
81 2 Redmine Admin
* `-I/winsame/contrib-mingw/microsoft-hpc-mingw/Include/mpi.h`
82
* `-L/winsame/contrib-mingw/microsoft-hpc-mingw/Lib/amd64 -lmsmpi`
83 1 Redmine Admin
84
for compiling and linking.
85
86
87
### MPI for MinGW Fortran ###
88
89 2 Redmine Admin
* modify mpif.h by adding the following as line 9:
90 1 Redmine Admin
91 2 Redmine Admin
~~~~~~
92 1 Redmine Admin
use ISO_C_BINDING
93 2 Redmine Admin
~~~~~~
94 1 Redmine Admin
95
Change the line 308 (309 now that you've added the above as line 9) to read
96
97 2 Redmine Admin
~~~~~~
98 1 Redmine Admin
PARAMETER (MPI_ADDRESS_KIND=C_INTPTR_T)
99 2 Redmine Admin
~~~~~~
100 1 Redmine Admin
101 2 Redmine Admin
* modify mpi.f90 by adding the following as line 10:
102 1 Redmine Admin
103 2 Redmine Admin
~~~~~~
104 1 Redmine Admin
use ISO_C_BINDING
105 2 Redmine Admin
~~~~~~
106 1 Redmine Admin
107
Change line 311 (312 now that you've added the above as line 10) to read
108
109 2 Redmine Admin
~~~~~~
110 1 Redmine Admin
PARAMETER (MPI_ADDRESS_KIND=C_INTPTR_T)
111 2 Redmine Admin
~~~~~~
112 1 Redmine Admin
113
and compile to generate the module files:
114 2 Redmine Admin
115
~~~~~~
116 1 Redmine Admin
$ mingw32-gfortran.exe -o mpigf.o -c mpi.f90 && rm mpigf.o
117 2 Redmine Admin
~~~~~~
118 1 Redmine Admin
119
The link flags are now:
120
121 2 Redmine Admin
* `-L/winsame/contrib-mingw32/microsoft-hpc-mingw/Lib/amd64 -lmsmpifec -lmsmpi`