1 | <html> |
---|
2 | <head> |
---|
3 | <title> |
---|
4 | A Tour of NTL: Obtaining and Installing NTL for UNIX </title> |
---|
5 | </head> |
---|
6 | |
---|
7 | <body bgcolor="#fff9e6"> |
---|
8 | <center> |
---|
9 | <a href="tour-stdcxx.html"><img src="arrow1.gif" alt="[Previous]" align=bottom></a> |
---|
10 | <a href="tour.html"><img src="arrow2.gif" alt="[Up]" align=bottom></a> |
---|
11 | <a href="tour-win.html"> <img src="arrow3.gif" alt="[Next]" align=bottom></a> |
---|
12 | </center> |
---|
13 | |
---|
14 | <h1> |
---|
15 | <p align=center> |
---|
16 | A Tour of NTL: Obtaining and Installing NTL for UNIX |
---|
17 | </p> |
---|
18 | </h1> |
---|
19 | |
---|
20 | <p> <hr> <p> |
---|
21 | |
---|
22 | This procedure should work on most Unix or Unix-like platorms |
---|
23 | (including Mac OSX, and Windows with Cygwin tools). |
---|
24 | |
---|
25 | <p> |
---|
26 | |
---|
27 | |
---|
28 | To obtain the source code and documentation for NTL, |
---|
29 | <a href="http://www.shoup.net/ntl/download.html"> |
---|
30 | download <tt>ntl-xxx.tar.gz</tt></a>, |
---|
31 | placing it a directory, and then, working in this directory, |
---|
32 | do the following. |
---|
33 | Here, "<tt>xxx</tt>" denotes the current version number. |
---|
34 | |
---|
35 | |
---|
36 | |
---|
37 | <p> |
---|
38 | <pre> |
---|
39 | % gunzip ntl-xxx.tar.gz |
---|
40 | % tar xf ntl-xxx.tar |
---|
41 | % cd ntl-xxx/src |
---|
42 | % ./configure PREFIX=$HOME/sw |
---|
43 | % make |
---|
44 | % make check |
---|
45 | % make install |
---|
46 | </pre> |
---|
47 | |
---|
48 | This will build, test, and install NTL in <tt>$HOME/sw</tt>. |
---|
49 | Of course, change <tt>$HOME/sw</tt> to whatever you want (the default is |
---|
50 | <tt>/usr/local</tt>). |
---|
51 | You will find the NTL header files in <tt>$HOME/sw/include/NTL</tt> |
---|
52 | and the compiled binary |
---|
53 | in <tt>$HOME/sw/lib/libntl.a</tt> |
---|
54 | (this is a <i>static</i> library -- if you want a <i>shared</i> |
---|
55 | library, <a href="#shared">see below</a>). |
---|
56 | <p> |
---|
57 | If you really are interested in high-performace, you will |
---|
58 | <i>definitely</i> want to build NTL |
---|
59 | using GMP (the GNU Multi-Precision package). |
---|
60 | If GMP has already been installed in a standard |
---|
61 | place, like <tt>/usr/local</tt>, then invoke <tt>configure</tt> |
---|
62 | above as |
---|
63 | <pre> |
---|
64 | % ./configure PREFIX=$HOME/sw NTL_GMP_LIP=on |
---|
65 | </pre> |
---|
66 | and if GMP is installed somewhere else, say <tt>$HOME/sw</tt>, then |
---|
67 | either |
---|
68 | <pre> |
---|
69 | % ./configure PREFIX=$HOME/sw NTL_GMP_LIP=on GMP_PREFIX=$HOME/sw |
---|
70 | </pre> |
---|
71 | or, more simply, |
---|
72 | <pre> |
---|
73 | % ./configure DEF_PREFIX=$HOME/sw NTL_GMP_LIP=on |
---|
74 | </pre> |
---|
75 | does the job. |
---|
76 | Here, <tt>DEF_PREFIX</tt> is a variable that is used |
---|
77 | to specify the location of all software, |
---|
78 | and it defaults to <tt>/usr/local</tt>. |
---|
79 | <a href="tour-gmp.html">This page</a> provides more |
---|
80 | details. |
---|
81 | |
---|
82 | <p> |
---|
83 | If you want very high-performance for polynomial arithmetic |
---|
84 | over <i>GF(2)</i>, you may want to consider using the <tt>gf2x</tt> library. |
---|
85 | To do this, <tt>gf2x</tt> must already be installed somewhere. |
---|
86 | In addition, you should invoke <tt>configure</tt> |
---|
87 | with the option <tt>NTL_GF2X_LIB=on</tt>. |
---|
88 | If <tt>gf2x</tt> is installed in a standard location, this is |
---|
89 | all you need to do; |
---|
90 | otherwise, if <tt>gf2x</tt> is installed, say, in <tt>$HOME/sw</tt>, |
---|
91 | then you also need to pass the option <tt>GF2X_PREFIX=$HOME/sw</tt>. |
---|
92 | <a href="tour-gf2x.html">This page</a> provides more details. |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | <p> |
---|
98 | Now suppose you want to compile a program that uses NTL. |
---|
99 | Suppose you are working in some directory and <tt>foo.c</tt> |
---|
100 | is your program. |
---|
101 | Assume that you have installed NTL in <tt>$HOME/sw</tt> as above. |
---|
102 | The following should work: |
---|
103 | <pre> |
---|
104 | % g++ -I$HOME/sw/include foo.c -o foo -L$HOME/sw/lib -lntl -lm |
---|
105 | </pre> |
---|
106 | If you are using GMP, then: |
---|
107 | <pre> |
---|
108 | % g++ -I$HOME/sw/include foo.c -o foo -L$HOME/sw/lib -lntl -lgmp -lm |
---|
109 | </pre> |
---|
110 | If you are using GMP and <tt>gf2x</tt>, then |
---|
111 | <pre> |
---|
112 | % g++ -I$HOME/sw/include foo.c -o foo -L$HOME/sw/lib -lntl -lgmp -lgf2x -lm |
---|
113 | </pre> |
---|
114 | |
---|
115 | |
---|
116 | <p> |
---|
117 | <h2> |
---|
118 | More Details |
---|
119 | </h2> |
---|
120 | <p> |
---|
121 | What follows is a more detailed description of the installation process. |
---|
122 | |
---|
123 | |
---|
124 | |
---|
125 | |
---|
126 | <p> |
---|
127 | <b>Step 1.</b> |
---|
128 | Extract the source files by executing: |
---|
129 | <pre> |
---|
130 | % gunzip ntl-xxx.tar.gz |
---|
131 | % tar xvf ntl-xxx.tar |
---|
132 | </pre> |
---|
133 | |
---|
134 | <p> |
---|
135 | Note that this will unpack everything into a sub-directory <tt>ntl-xxx</tt>, |
---|
136 | creating this directory if necessary. |
---|
137 | Next: |
---|
138 | <pre> |
---|
139 | % cd ntl-xxx |
---|
140 | % ls |
---|
141 | </pre> |
---|
142 | You should see a file "<tt>README</tt>", and directories |
---|
143 | "<tt>include</tt>", "<tt>doc</tt>", and "<tt>src</tt>". |
---|
144 | The directory "<tt>doc</tt>" contains all the documentation. |
---|
145 | The file "<tt>doc/tour.html</tt>" contains a copy of the on-line documentation. |
---|
146 | The directory "<tt>include</tt>" |
---|
147 | contains all the header files within a subdirectory |
---|
148 | "<tt>include/NTL</tt>". |
---|
149 | The directory "<tt>src</tt>" contains everything else. |
---|
150 | Go there now: |
---|
151 | <pre> |
---|
152 | % cd src |
---|
153 | </pre> |
---|
154 | |
---|
155 | <p> |
---|
156 | <b>Step 2.</b> |
---|
157 | Run the configuration script. |
---|
158 | |
---|
159 | <p> |
---|
160 | Execute the command |
---|
161 | <pre> |
---|
162 | % ./configure [ variable=value ]... |
---|
163 | </pre> |
---|
164 | |
---|
165 | This configure script generates the file "<tt>makefile</tt>" and the file |
---|
166 | "<tt>../include/NTL/config.h</tt>", based upon the values assigned to the |
---|
167 | variables on the command line. |
---|
168 | |
---|
169 | |
---|
170 | <p> |
---|
171 | |
---|
172 | Here are the most important variables, and their default values. |
---|
173 | |
---|
174 | <p> |
---|
175 | <pre> |
---|
176 | CC=gcc # The C compiler |
---|
177 | CXX=g++ # The C++ compiler |
---|
178 | CFLAGS=-O2 # C complilation flags |
---|
179 | CXXFLAGS=$(CFLAGS) # C++ compilation flags (by default, same as CFLAGS) |
---|
180 | |
---|
181 | DEF_PREFIX=/usr/local # Default software directory |
---|
182 | PREFIX=$(DEF_PREFIX) # Directory in which to install NTL library components |
---|
183 | SHARED=off # Generate a shared library (as well as static) |
---|
184 | |
---|
185 | NTL_STD_CXX=on # ISO Mode switch |
---|
186 | |
---|
187 | NTL_GMP_LIP=off # Switch to enable the use of GMP as primary |
---|
188 | # long integer package |
---|
189 | |
---|
190 | GMP_PREFIX=$(DEF_PREFIX) # Directory in which GMP components are installed |
---|
191 | |
---|
192 | NTL_GF2X_LIB=off # Switch to enable the use of the gf2x package |
---|
193 | # for faster arithmetic over GF(2)[X] |
---|
194 | |
---|
195 | GF2X_PREFIX=$(DEF_PREFIX) # Directory in which gf2x components are installed |
---|
196 | </pre> |
---|
197 | |
---|
198 | <p> |
---|
199 | <i>Examples.</i> |
---|
200 | <p> |
---|
201 | |
---|
202 | <ul> |
---|
203 | <li> |
---|
204 | If you are happy with all the default values, run: |
---|
205 | <pre> |
---|
206 | % ./configure |
---|
207 | </pre> |
---|
208 | Actually, the initially installed <tt>makefile</tt> and <tt>config.h</tt> files |
---|
209 | already reflect the default values, and you do not have to even run |
---|
210 | the configure script. |
---|
211 | |
---|
212 | <p> |
---|
213 | <li> |
---|
214 | If your C/C++ compilers are called cc/CC, run: |
---|
215 | <pre> |
---|
216 | % ./configure CC=cc CXX=CC |
---|
217 | </pre> |
---|
218 | |
---|
219 | <p> |
---|
220 | <li> |
---|
221 | If you want to use, say, the options <tt>-g</tt> and <tt>-O</tt> for |
---|
222 | compiling <tt>C</tt> and <tt>C++</tt>, run: |
---|
223 | <pre> |
---|
224 | % ./configure "CFLAGS=-g -O" |
---|
225 | </pre> |
---|
226 | Note the use of quotes to keep the argument in one piece. |
---|
227 | |
---|
228 | <p> |
---|
229 | <li> |
---|
230 | If <a href="tour-gmp.html">GMP (the GNU Multi-Precision package)</a> |
---|
231 | is installed in a standard system directory, and you want to use it |
---|
232 | to obtain better performance for long integer arithemtic, run: |
---|
233 | <pre> |
---|
234 | % ./configure NTL_GMP_LIP=on |
---|
235 | </pre> |
---|
236 | If GMP was installed in |
---|
237 | <tt>$HOME/sw</tt>, |
---|
238 | run: |
---|
239 | <pre> |
---|
240 | % ./configure NTL_GMP_LIP=on GMP_PREFIX=$HOME/sw |
---|
241 | </pre> |
---|
242 | Go <a href="tour-gmp.html">here</a> for complete details. |
---|
243 | |
---|
244 | |
---|
245 | <p> |
---|
246 | <li> |
---|
247 | If <a href="tour-gf2x.html"><tt>gf2x</tt></a> |
---|
248 | is installed in a standard system directory, and you want to use it |
---|
249 | to obtain better performance for polynomial arithemtic over <i>GF(2)</i>, |
---|
250 | run: |
---|
251 | <pre> |
---|
252 | % ./configure NTL_GF2X_LIB=on |
---|
253 | </pre> |
---|
254 | If <tt>gf2x</tt> was installed in |
---|
255 | <tt>$HOME/sw</tt>, |
---|
256 | run: |
---|
257 | <pre> |
---|
258 | % ./configure NTL_GF2X_LIB=on GF2X_PREFIX=$HOME/sw |
---|
259 | </pre> |
---|
260 | Go <a href="tour-gf2x.html">here</a> for complete details. |
---|
261 | |
---|
262 | <p> |
---|
263 | <li> |
---|
264 | If you want to use |
---|
265 | <a href="tour-stdcxx.html">traditional rather than ISO mode</a>, run: |
---|
266 | <pre> |
---|
267 | % ./configure NTL_STD_CXX=off |
---|
268 | </pre> |
---|
269 | |
---|
270 | <p> |
---|
271 | <li> |
---|
272 | If you want to install NTL in the directory <tt>$HOME/sw</tt>, |
---|
273 | run: |
---|
274 | <pre> |
---|
275 | % ./configure PREFIX=$HOME/sw |
---|
276 | </pre> |
---|
277 | </ul> |
---|
278 | |
---|
279 | <p> |
---|
280 | There are a number of more esoteric configuration variables that can be set. |
---|
281 | See <a href="config.txt"><tt>config.txt</tt></a> for a complete |
---|
282 | description. |
---|
283 | |
---|
284 | <p> |
---|
285 | Note that all of these configuration options can also be set |
---|
286 | by editing the two files <tt>makefile</tt> |
---|
287 | and <tt>../include/NTL/def_config.h</tt> by hand. |
---|
288 | These files are fairly simple and well documented, and so this is not |
---|
289 | too hard to do. |
---|
290 | |
---|
291 | <p> |
---|
292 | Note that the file "<tt>../include/NTL/def_config.h</tt>" |
---|
293 | contains a backup copy of the original <tt>config.h</tt> file, |
---|
294 | and that the file "<tt>def_makefile</tt>" |
---|
295 | contains a backup copy of the original <tt>makefile</tt> file. |
---|
296 | |
---|
297 | <p> |
---|
298 | This command is intended only as a convenience |
---|
299 | and -- more importantly -- to allow the configuration process |
---|
300 | to be script driven. |
---|
301 | This script does not perform any "magic", like finding out what |
---|
302 | the local C compiler is called, etc. |
---|
303 | If the defaults are not |
---|
304 | correct for your platform, you have to set an appropriate variable. |
---|
305 | |
---|
306 | |
---|
307 | |
---|
308 | <p> |
---|
309 | <b>Step 3.</b> |
---|
310 | Execute <tt>make</tt>. |
---|
311 | |
---|
312 | <p> |
---|
313 | Just type: |
---|
314 | <pre> |
---|
315 | % make |
---|
316 | </pre> |
---|
317 | |
---|
318 | <p> |
---|
319 | The build process after this point is fully automatic. |
---|
320 | But here is a description of what happens. |
---|
321 | |
---|
322 | <p> |
---|
323 | |
---|
324 | <ol> |
---|
325 | <li> |
---|
326 | The makefile |
---|
327 | builds the file "<tt>../include/NTL/mach_desc.h</tt>", which defines some machine characteristics |
---|
328 | such as word size and machine precision. |
---|
329 | This is done by compiling and running a <tt>C</tt> program |
---|
330 | called <tt>MakeDesc</tt> |
---|
331 | that figures out these characteristics on its |
---|
332 | own, and prints some diagnostics to the terminal. |
---|
333 | |
---|
334 | <p> |
---|
335 | <li> |
---|
336 | A script is run that "automagically" |
---|
337 | determines the best way to write a timing function |
---|
338 | on your platform. |
---|
339 | It tries different routines in the files <tt>GetTime1.c</tt>, |
---|
340 | <tt>GetTime2.c</tt>, etc., and when it finds a good one, |
---|
341 | it copies the file into <tt>GetTime.c</tt>. |
---|
342 | |
---|
343 | <p> |
---|
344 | <li> |
---|
345 | The files "<tt>lip_gmp_aux_impl.h</tt>" and "<tt>../include/NTL/gmp_aux.h</tt>" |
---|
346 | are generated for use with GMP. |
---|
347 | If not using GMP, these files are still created, but they are empty. |
---|
348 | |
---|
349 | |
---|
350 | <p> |
---|
351 | <li> |
---|
352 | The configuration wizard script is run. |
---|
353 | This script works in a sub-directory, |
---|
354 | compiling several programs, |
---|
355 | and performing a number of timing experiments, |
---|
356 | in order to determine the optimal setting for a number of flags |
---|
357 | in the file <tt>../include/NTL/config.h</tt>. |
---|
358 | When the script finishes (it may take several minutes), |
---|
359 | you will be told what the wizard thinks are the best settings, |
---|
360 | and your <tt>config.h</tt> file will be automatically updated. |
---|
361 | Note that any flags you set in Step 2 |
---|
362 | will be in |
---|
363 | effect while the wizard runs, and will be retained in the updated |
---|
364 | <tt>config.h</tt> file, with the exception of the flags |
---|
365 | <pre> |
---|
366 | NTL_LONG_LONG NTL_AVOID_FLOAT NTL_TBL_REM NTL_AVOID_BRANCHING |
---|
367 | NTL_SPMM_UL NTL_SPMM_ULL NTL_SPMM_ASM NTL_GF2X_NOINLINE NTL_GF2X_ALTCODE |
---|
368 | </pre> |
---|
369 | which are set by the wizard. |
---|
370 | Also note that if you <i>do not</i> want the wizard to run, |
---|
371 | you should pass <tt>WIZARD=off</tt> to the configure script; |
---|
372 | however, this is not recommended. |
---|
373 | |
---|
374 | <p> |
---|
375 | <li> |
---|
376 | The makefile will compile all the source files, |
---|
377 | and then creates the library "<tt>ntl.a</tt>" in the current directory. |
---|
378 | </ol> |
---|
379 | |
---|
380 | <p> |
---|
381 | Note that for finer control you can optionally break up this process |
---|
382 | into the five |
---|
383 | component steps: |
---|
384 | <pre> |
---|
385 | % make setup1 |
---|
386 | % make setup2 |
---|
387 | % make setup3 |
---|
388 | % make setup4 |
---|
389 | % make ntl.a |
---|
390 | </pre> |
---|
391 | |
---|
392 | |
---|
393 | <p> |
---|
394 | |
---|
395 | <p> |
---|
396 | <b>After NTL is built.</b> |
---|
397 | |
---|
398 | <p> |
---|
399 | Executing <tt>make check</tt> runs a series of timing and test programs. |
---|
400 | It is a good idea to run this to see if everything really |
---|
401 | went well. |
---|
402 | |
---|
403 | <p> |
---|
404 | Executing <tt>make install</tt> |
---|
405 | copies a number of files to a directory <tt><prefix></tt> that you |
---|
406 | specify by passing <tt>PREFIX=<prefix></tt> |
---|
407 | as an argument to <tt>configure</tt> at configuration time, |
---|
408 | or as an argument to <tt>make install</tt> at installation time. |
---|
409 | The default is <tt>/usr/local</tt>, so either you need root |
---|
410 | permissions, or you choose a <tt><prefix></tt> for which |
---|
411 | you have write permission. |
---|
412 | The files <tt>../include/NTL/*</tt> are copied into |
---|
413 | <tt><prefix>/include/NTL</tt>. |
---|
414 | The file <tt>ntl.a</tt> is copied to <tt><prefix>/lib/libntl.a</tt>. |
---|
415 | The files <tt>../doc/*</tt> are copied into |
---|
416 | <tt><prefix>/share/doc/NTL</tt>. |
---|
417 | |
---|
418 | <p> |
---|
419 | You can also "fine tune" the installation procedure further. |
---|
420 | See the <a href="config.txt">configure documentation</a> for details. |
---|
421 | |
---|
422 | <p> |
---|
423 | Executing <tt>make uninstall</tt> undoes <tt>make install</tt>. |
---|
424 | |
---|
425 | |
---|
426 | <p> |
---|
427 | Executing <tt>make clobber</tt> essentially |
---|
428 | undoes <tt>make</tt>. |
---|
429 | <i>Make sure you do this if you re-build NTL for a different architecture!</i> |
---|
430 | |
---|
431 | <p> |
---|
432 | Executing <tt>make clean</tt> will remove object files, but not |
---|
433 | <tt>ntl.a</tt>. |
---|
434 | To rebuild after executing <tt>make clean</tt>, execute <tt>make ntl.a</tt>. |
---|
435 | |
---|
436 | |
---|
437 | <p> |
---|
438 | Assuming you have installed NTL as above, |
---|
439 | to compile a program <tt>foo.c</tt> that uses NTL, |
---|
440 | execute |
---|
441 | <pre> |
---|
442 | g++ -I<prefix>/include foo.c -o foo -L<prefix>/lib -lntl -lm |
---|
443 | </pre> |
---|
444 | This compiles <tt>foo.c</tt> as a <tt>C++</tt> program |
---|
445 | and creates the binary <tt>foo</tt>. |
---|
446 | <p> |
---|
447 | If you built NTL using <a href="tour-gmp.html">GMP</a>, execute: |
---|
448 | <pre> |
---|
449 | g++ -I<prefix>/include foo.c -o foo -L<prefix>/lib -lntl -L<gmp_prefix>/lib -lgmp -lm |
---|
450 | </pre> |
---|
451 | <p> |
---|
452 | Of course, if <tt><prefix></tt> and <tt><gmp_prefix></tt> |
---|
453 | are the same, you do not need to duplicate the <tt>-L</tt> |
---|
454 | flags, and if either are standard directories, like <tt>/usr/local</tt>, |
---|
455 | you can leave out the corresponding <tt>-I</tt> and <tt>-L</tt> |
---|
456 | flags altogether. |
---|
457 | <p> |
---|
458 | Similarly, if you built NTL using <a href="tour-gf2x.html"><tt>gf2x</tt></a>, |
---|
459 | you should include flags |
---|
460 | <pre> |
---|
461 | -L<gf2x_prefix>/lib -lgf2x |
---|
462 | </pre> |
---|
463 | on the command line. |
---|
464 | <p> |
---|
465 | This works even if you are not working in the directory |
---|
466 | in which you built NTL. |
---|
467 | If you <i>are</i> working in that directory, you can just execute |
---|
468 | <pre> |
---|
469 | make foo |
---|
470 | </pre> |
---|
471 | |
---|
472 | <p> |
---|
473 | <h2> |
---|
474 | <a name="shared"> |
---|
475 | Building a Shared Library |
---|
476 | </a> |
---|
477 | </h2> |
---|
478 | <p> |
---|
479 | |
---|
480 | |
---|
481 | By default, the above installation procedure builds |
---|
482 | a <i>static</i> library only. |
---|
483 | Static libraries are nice because the procedures for building |
---|
484 | and using them are nearly identical across various flavors |
---|
485 | of Unix. |
---|
486 | However, static libraries have their drawbacks, and sometimes |
---|
487 | it is desirable to build a <i>shared</i> library. |
---|
488 | This can be done (in theory) by simply passing <tt>SHARED=on</tt> to |
---|
489 | NTL's <tt>configure</tt>. |
---|
490 | |
---|
491 | <p> |
---|
492 | If you set <tt>SHARED=on</tt>, then behind the scenes, |
---|
493 | the procedure used by the <tt>makefile</tt> changes a bit. |
---|
494 | In particular, the magical GNU program <tt>libtool</tt> is used |
---|
495 | to deal with all idiosyncracies of shared libraries. |
---|
496 | You may need to set the |
---|
497 | configuration variable <tt>LIBTOOL</tt>, to point to another version of |
---|
498 | <tt>libtool</tt>. |
---|
499 | For example, on <i>Mac OSX</i>, the built-in command called <tt>libtool</tt> |
---|
500 | is not |
---|
501 | actually the GNU <tt>libtool</tt> program; |
---|
502 | in this case, you will want to set |
---|
503 | <tt>LIBTOOL=glibtool</tt>. |
---|
504 | On other systems, it may be necssary to downlaod and |
---|
505 | install a fresh copy of the libtool program (which can be obtained from |
---|
506 | <a href="http://www.gnu.org/software/libtool">here</a>). |
---|
507 | Note that if <tt>SHARED=on</tt>, then |
---|
508 | in addition to using the <tt>libtool</tt> program, the <tt>makefile</tt> |
---|
509 | relies on |
---|
510 | features specific to GNU make. |
---|
511 | |
---|
512 | <p> |
---|
513 | Note that if you want to build NTL as a shared library, |
---|
514 | then if you use them, GMP and <tt>gf2x</tt> must also |
---|
515 | be built and installed as shared libraries. |
---|
516 | Also note that to use a shared library version of NTL, |
---|
517 | you may have to do something special, like set a special |
---|
518 | shell variable: the output generated by the <tt>libtool</tt> |
---|
519 | program during <tt>make install</tt> should give specific |
---|
520 | instructions. |
---|
521 | In addition, if NTL is built as a shared library, then |
---|
522 | you typically do not have to include <tt>-lgmp</tt> (if using GMP), |
---|
523 | or <tt>-lgf2x</tt> (if using <tt>gf2x</tt>), or corresponding |
---|
524 | <tt>-L</tt> flags, or <tt>-lm</tt> |
---|
525 | on |
---|
526 | the command line when compiling programs that use NTL. |
---|
527 | |
---|
528 | |
---|
529 | <p> |
---|
530 | <h2> |
---|
531 | <a name="abi"> |
---|
532 | 32-bit and 64-bit ABIs |
---|
533 | </a> |
---|
534 | </h2> |
---|
535 | <p> |
---|
536 | |
---|
537 | |
---|
538 | An ABI (Application Binary Interface) defines the sizes of various |
---|
539 | <tt>C</tt> data types. |
---|
540 | Typically, with a 32-bit ABI, int's and long's are 32 bits, |
---|
541 | while on a 64-bit ABI, int's are 32 bits and long's are 64 bits. |
---|
542 | Some platforms |
---|
543 | support both 64-bit and 32-bit ABI's; |
---|
544 | typically in such settings, the 64-bit ABI will yield much better |
---|
545 | performance, while the 32-bit ABI is available for backward compatibility. |
---|
546 | In addition, the 64-bit ABI may <i>not</i> be the default: |
---|
547 | if you are using <tt>gcc</tt>, you need to pass the <tt>-m64</tt> |
---|
548 | flag to the compiler to get the 64-bit ABI. |
---|
549 | |
---|
550 | <p> |
---|
551 | When compiling NTL, you may want to try running <tt>configure</tt> |
---|
552 | with <tt>CFLAGS="-O2 -m64"</tt> to force a 64-bit ABI -- this |
---|
553 | may yield a very marked performance improvement. |
---|
554 | |
---|
555 | <p> |
---|
556 | If you are using NTL with either the GMP or <tt>gf2x</tt> libraries, |
---|
557 | then these must be built with the same ABI as NTL. |
---|
558 | The installation script for GMP will typically select the 64-bit ABI |
---|
559 | automatically if it is available. |
---|
560 | The installation script for <tt>gf2x</tt> may need some hints. |
---|
561 | |
---|
562 | <p> |
---|
563 | When compiling programs that use NTL, you must also ensure that |
---|
564 | the program is compiled with the same ABI as NTL. |
---|
565 | Again, if you want a 64-bit ABI, then just pass the flag <tt>-m64</tt> |
---|
566 | to the compiler. |
---|
567 | |
---|
568 | |
---|
569 | |
---|
570 | |
---|
571 | |
---|
572 | <p> <p> |
---|
573 | <p> <p> |
---|
574 | |
---|
575 | <center> |
---|
576 | <a href="tour-stdcxx.html"><img src="arrow1.gif" alt="[Previous]" align=bottom></a> |
---|
577 | <a href="tour.html"><img src="arrow2.gif" alt="[Up]" align=bottom></a> |
---|
578 | <a href="tour-win.html"> <img src="arrow3.gif" alt="[Next]" align=bottom></a> |
---|
579 | </center> |
---|
580 | |
---|
581 | </body> |
---|
582 | </html> |
---|