-
Notifications
You must be signed in to change notification settings - Fork 763
/
OLD_INSTALL.txt
217 lines (157 loc) · 7.93 KB
/
OLD_INSTALL.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
===> CAUTION: This guide refers to an old style Makefile installation. <===
===> Refer to INSTALL.md for newer cmake-based installation. <===
===> We no longer recommend this method to install HElib. <===
Additional Notes, September 2020
--------------------------------
version.in.h header and some source code (version.in.cpp and
TestVersion.in.cpp) has been added so that HElib can introspect on its version.
These are template files that cmake fills in the version numbers for us during
a build. The old Makefile does not compile these. So, if you wish to use them
we recommend moving to the cmake build.
HElib Installation Notes, August 2020
---------------------------------------
Much has changed since the note in 2015 and there are many updates. So this
is a refreshed note.
To build HElib, you will need to have GMP and NTL libraries installed.
Many distributions come with GMP pre-installed. If not, install GMP as follows:
1. Download GMP from http://www.gmplib.org
2. Uncompress and cd into the directory gmp-XXX
3. On the command line:
./configure
make
sudo make install
4. This should install GMP into /usr/local
Once GMP is installed, you can install NTL as follows:
(NOTE: you will needs NTL v11.4.3 or higher)
1. Download NTL from http://www.shoup.net/ntl/download.html
2. Uncompress and cd into the directory ntl-XXX/src
3. On the command line:
./configure NTL_GMP_LIP=on
make
sudo make install
4. This should install NTL into /usr/local
Now that you have these libraries in place, cd to the HElib src directory to
build HElib.
This "build system" for HElib is very rudimentary: no configure script and just
a Makefile (with no "make install"). The Makefile will build the static
library fhe.a in the HElib src directory, and then one can build application
programs based on fhe.a, also in the HElib src directory (or set the include
and library parameters to include the right things). Hopefully, this build
system will be improved in the future.
Before building HElib, you may want to look at the Makefile, and consider
adjusting some of the defaults for CC and CFLAGS. The defaults should be OK on
most systems, but you can see the suggested options, which are documented in
the Makefile.
On the command line in the HElib src directory:
make
will compile and build the library fhe.a. Once built, run
make check
which will compile and runs a series of test programs.
If you want to build your own program based on HElib, the easiest way
to do it is to write the program in a file called myprog.cpp and then
run
make myprog_x
which will compile myprog.cpp and link in fhe.a and all required
support libraries, and create the executable myprog_x.
Take a look at the programs Test_*.cpp for examples of using HElib.
These programs can be found in the misc/legacy_tests directory.
Some comments:
* HElib uses C++14, for gcc you may need to specify the flags '-std=c++14'
to be able to compile (depending on the gcc version that you use).
* There are compilation flags that control some aspects of the
library, currently these are:
-DHELIB_THREADS tells HElib to enable generic multithreading capabilities;
must be used with a thread-enabled NTL and the -pthread
flag should be passed to gcc
-DHELIB_BOOT_THREADS tells HElib to use a multithreading strategy for
bootstrapping; requires -DHELIB_THREADS (see above)
-DHELIB_DEBUG
Add some debugging printouts
HElib Installation Notes, October 2015
---------------------------------------
To build HElib, you will need to have GMP and NTL libraries installed.
Many distributions come with GMP pre-installed.
If not, you can install GMP as follows.
1. Download GMP from http://www.gmplib.org
2. uncompress and cd into the directory gmp-XXX
3. On the command line:
./configure
make
sudo make install
4. This should install GMP into /usr/local
Once GMP is installed, you can install NTL as follows:
(NOTE: you will needs NTL v9.4.0 or higher)
1. Download NTL from http://www.shoup.net/ntl/download.html
2. uncompress and cd into the directory ntl-XXX/src
3. On the command line:
./configure NTL_GMP_LIP=on
make
sudo make install
4. This should install NTL into /usr/local
Now that you have these libraries in place, you can cd to the HElib
src directory to build HElib.
Right now, the "build system" for HElib is very rudimentary: no
configure script and just a Makefile (with no "make install").
The Makefile will build the static library fhe.a in the HElib src
directory, and then one can build applications programs based on
fhe.a, also in the HElib src directory (or set the include and library
parameters to include the right things). Hopefully, this build system
will be improved in the future.
Before building HElib, you may want to look at the Makefile, and
consider adjusting some of the defaults for CC and CFLAGS. The
defaults should be OK on most systems, but you can see the suggested
options, which are documented in the Makefile.
On the command line in the HElib src directory:
make
will compile and build the library fhe.a. Once built, run
make check
which will compile and runs a series of test programs.
If you want to build your own program based on HElib, the easiest way
to do it is to write the program in a file called myprog.cpp and then
run
make myprog_x
which will compile myprog.cpp and link in fhe.a and all required
support libraries, and create the executable myprog_x.
Take a look at the programs Test_*.cpp for examples of using HElib.
Some comments:
* HElib uses C++11, for gcc you may need to specify the flags '-std=c++11'
to be able to compile (depending on the gcc version that you use).
* There are compilation flags that control some aspects of the
library, currently these are:
-DUSE_ALT_CRT
Tells HElib to use an alternative to the default DoubleCRT
representation of polynomials. The DoubleCRT class is described in
the (rather outdated) design document (Section 2.8). Specifying the
flag USE_ALT_CRT invokes a different implementation of the same
interfaces. This is an experimental feature, the alternative
implementation can be either faster or slower, depending on the
operation mixture in use by the application.
-DNO_HALF_SIZE_PRIME
Tells HElib to not use the half size prime in the prime chain. By
default, the modulus-chain in HElib consists of many "full-size primes"
(of size n bits, typically n=50 or n=60 for 64-bit machines) and
one "half-size prime" of n/2 bits. A level corresponds to n/2 bits
in the size of the modulus, and dropping to a lower level is done
either by dropping the half-size prime (if it is part of the current
modulus) or by dropping a full-size prime and adding back the
half-size prime (if it is not part of the current modulus).
Specifying the flag NO_HALF_SIZE_PRIME makes all the primes the
same size, with each prime corresponding to a level (so dropping to
a lower level means dropping one of the primes).
-DEVALMAP_CACHED=0
-DEVALMAP_CACHED=1
This flag only affect bootstrapping, it tells HElib to cache some
constants that are used during recryption (rather than having to
encode then anew with every recryption operation).
EVALMAP_CACHED=0 caches these constants as ZZX'es, this takes
less space but it means that they still need to be converted to
DoubleCRT's with every recryption operation.
EVALMAP_CACHED=1 caches these constants directly as DoubleCRT's,
this may take a significant amount of memory.
-DHELIB_THREADS tells HElib to enable generic multithreading capabilities;
must be used with a thread-enabled NTL and the -pthread
flag should be passed to gcc
-DHELIB_BOOT_THREADS tells HElib to use a multithreading strategy for
bootstrapping; requires -DHELIB_THREADS (see above)
-DDEBUG_PRINTOUT
Add some debugging printouts