-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathINSTALL.WINDOWS.txt
158 lines (154 loc) · 5.13 KB
/
INSTALL.WINDOWS.txt
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
% This script gives instructions to compile lbfgsb with MatLab on Windows
% The source of the code is provided by Peter CARBONETTO
% http://www.cs.ubc.ca/~pcarbo/lbfgsb-for-matlab.html
%
% The tools used here are MatLab, GNUMEX and MinGW
%
% Guillaume JACQUENOT
% guillaume dot jacquenot at gmail dot com
% 2009 03 24
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INSTRUCTIONS
% 0) Install GNUMEX and MinGW
% GNUMEX is used to generate script files that will contain instructions
% for MINGW compilers.
% GNUMEX can be found at the following adress
% http://gnumex.sourceforge.net/
% If you do not know GNUMEX, try to run examples before trying to
% compile lbfgsb
%
% MINGW stands for MINimum GNU for Windows, it is the port of the GNU
% Compiler Collection (GCC), and GNU Binutils for Windows
% It is used to compile and link the dll
%
% 1) Generate two script files to compile C and Fortran files
% 1a) mexopts.bat for C
% Run GNUMEX and asks for language C/C++
% Don't forget to set the correct MINGW path (c:\mingw for me)
% Saves the results in mexopts.bat
% 1b) mexopts_fortran.bat
% Run GNUMEX and asks for language fortran77
% Saves the results in mexopts_fortran.bat
%
% 2) Modify the generated file script mexopts.bat
% Set the correct programming in mexopts.bat: c++
% "set GM_MEXLANG=c++"
% To avoid linkage problems, I also manually set the compiler
% "set COMPILER=g++"
% I therefore delete the additional option "-x c++"
% "set CPPCOMPFLAGS=%COMPFLAGS% -x c++"
% becomes
% "set CPPCOMPFLAGS=%COMPFLAGS%"
%
% I also add the g2c library in the mexopts.bat for the linkage with
% fortran objects
% "set GM_ADD_LIBS=-lg2c -llibmx -llibmex -llibmat"
%
% 3) Modify the generated file mexopts_fortran.bat
% I replaced compilation flags provided by the generated file
% mexopts_fortran.bat
% Originally, these options looked like something like this
% "set COMPFLAGS=-c -DMATLAB_MEX_FILE -fcase-upper -mrtd -fno-underscoring"
% I set these flags to
% "set COMPFLAGS=-c -DMATLAB_MEX_FILE -mrtd -fexceptions"
%
% The header of my script files (.bat) and my configuration are given at
% the end of this file
%
% 4) Perform compilation
% Here are the commands I used to compile lbfgsb
% I assume the source code and the script files are in the same directory
%
% I had to add the -g option to have the program worked.
% I don't understand why
% Option -g: Build an executable with debugging symbols included.
mex -v -g -c -f mexopts_fortran.bat solver.f
mex -v -g -c -f mexopts.bat arrayofmatrices.cpp
mex -v -g -c -f mexopts.bat lbfgsb.cpp
mex -v -g -c -f mexopts.bat matlabexception.cpp
mex -v -g -c -f mexopts.bat matlabmatrix.cpp
mex -v -g -c -f mexopts.bat matlabprogram.cpp
mex -v -g -c -f mexopts.bat matlabscalar.cpp
mex -v -g -c -f mexopts.bat matlabstring.cpp
mex -v -g -c -f mexopts.bat program.cpp
mex -v -g -f mexopts.bat -output lbfgsb *.obj
delete *.obj
% List of generated obj
% arrayofmatrices.obj lbfgsb.obj matlabexception.obj \
% matlabmatrix.obj matlabprogram.obj matlabscalar.obj \
% matlabstring.obj program.obj solver.obj
%
% Have fun.
% Run the example examplehs038 to test the compilation
%
% You should see something like that
%
% 1 573
% 2 393
% 3 132
% 4 11.5
% 5 1.48
% 6 1.12
% 7 0.984
% 8 0.305
% 9 0.0847
% 10 0.0101
% 11 0.000123
% 12 0.000113
% 13 0.000113
% 14 0.000112
% 15 0.000109
% 16 9.75e-005
% 17 7.93e-005
% 18 7.17e-005
% 19 3.55e-005
% 20 1.46e-005
% 21 1.71e-006
% 22 1.94e-007
% 23 1.47e-007
% 24 8.84e-010
% 25 2e-011
% 26 2.21e-012
% 27 7.16e-014
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MY CONFIGURATION
% Windows XP 32 bits
% Matlab 7.0
% MINGW 1.0
% GNUMEX 2.01
%
% I guess with Windows Vista, you will have to change the scripts generated
% by the GNUMEX tool.
%
% Mexopts_fortran.bat header
% rem D:\GJ\Outils_resolutions\GNUMEX\mexopts_fortran.bat
% rem Generated by gnumex.m script in d:\gj\OUTILS~1\gnumex
% rem gnumex version: 2.01
% rem Compile and link options used for building MEX etc files with
% rem the Mingw/Cygwin tools. Options here are:
% rem Gnumex, version 2.01
% rem MinGW linking
% rem Mex (*.dll) creation
% rem Libraries regenerated now
% rem Language: Fortran 77
% rem Optimization level: -O3 (full optimization)
% rem Matlab version 7
% rem
% Mexopts.bat header
% rem D:\GJ\Outils_resolutions\GNUMEX\mexopts.bat
% rem Generated by gnumex.m script in d:\gj\OUTILS~1\gnumex
% rem gnumex version: 2.01
% rem Compile and link options used for building MEX etc files with
% rem the Mingw/Cygwin tools. Options here are:
% rem Gnumex, version 2.01
% rem MinGW linking
% rem Mex (*.dll) creation
% rem Libraries regenerated now
% rem Language: C / C++
% rem Optimization level: -O3 (full optimization)
% rem Matlab version 7
%