Annotation of OpenXM_contrib/pari-2.2/doc/appa.tex, Revision 1.2
1.2 ! noro 1: % $Id: appa.tex,v 1.24 2002/09/03 19:31:28 karim Exp $
1.1 noro 2: % Copyright (c) 2000 The PARI Group
3: %
4: % This file is part of the PARI/GP documentation
5: %
6: % Permission is granted to copy, distribute and/or modify this document
7: % under the terms of the GNU Free Documentation License
8: \appendix{Installation Guide for the UNIX Versions}
9:
10: \def\tocwrite#1{}
11: \section{Required tools}
12:
13: We assume that you have either an \kbd{ANSI C} or a \kbd{C++} compiler
14: available. If your machine does not have one (for example if you still use
15: \kbd{/bin/cc} in \kbd{SunOS 4.1.x}), we strongly suggest that you obtain the
16: \kbd{gcc/g++} compiler from the Free Software Foundation or by
17: anonymous~\kbd{ftp}. As for all GNU software mentioned afterwards, you can
18: find the most convenient site to fetch \kbd{gcc} at the address
19:
20: \kbd{http://www.gnu.ai.mit.edu/order/ftp.html}
21:
22: \noindent
23: You can certainly compile PARI with a different compiler, but the PARI
24: kernel takes advantage of some optimizations provided by \kbd{gcc} if it is
25: available. This results in about 20\% speedup on most architectures%
26: \footnote*{One notable exception is the native AIX C compiler on IBM
27: RS/6000 workstations, which generates fast code even without any special
28: help from the PARI kernel sources.}.
29:
30: \subsec{Optional packages:} The following programs and libraries are useful
31: in conjunction with GP, but not mandatory. They're probably already installed
32: somewhere on your system (with the possible exception of \kbd{readline},
33: which we think is really worth a try). In any case, get them before
34: proceeding if you want the functionalities they provide. All of them are free
35: (though you ought to make a small donation to the FSF if you use (and like)
36: GNU wares).
37:
38: $\bullet$ GNU \kbd{readline} library. This provides line editing under GP,
39: an automatic context-dependent completion, and an editable history of
40: commands. Note that it is incompatible with SUN commandtools (yet another
41: reason to dump Suntools for X Windows). A recent readline (version number at
42: least 2.2) is preferred, but older versions should be usable.
43:
44: $\bullet$ GNU \kbd{gzip/gunzip/gzcat} package enables GP to read
45: compressed data.
46:
47: $\bullet$ GNU \kbd{emacs}. GP can be run in an Emacs buffer, with all the
48: obvious advantages if you are familiar with this editor. Note that
49: \kbd{readline} is still useful in this case since it provides a much better
50: automatic completion than is provided by Emacs GP-mode.
51:
52: $\bullet$ \kbd{perl} provides extended online help (full text from this
53: manual) about functions and concepts, which can be used under GP or
54: independently (\kbd{http://www.perl.com} will direct you to the nearest
55: \kbd{CPAN} archive site).
56:
57: $\bullet$ A colour-capable \kbd{xterm}, which enables GP to use different
58: (user configurable) colours for its output. All \kbd{xterm} programs which come
59: with current X11R6.3 distributions will satisfy this requirement. Under X11R6,
60: you can for instance use \kbd{color\_xterm} (get the latest version at
61: \kbd{http://www.clark.net/pub/dickey/xterm}).
62:
63: \vfill\eject
64: \section{Compiling the library and the GP calculator}
65:
66: \subsec{Basic configuration:} First, have a look at the \kbd{MACHINES} file
67: to see if anything funny applies to your architecture or operating system.
68: Then, type
69:
70: \kbd{./Configure}
71:
72: \noindent in the toplevel directory. This will attempt to configure GP/PARI
73: without outside help. Note that if you want to install the end product in
74: some nonstandard place, you can use the \kbd{--prefix} option, as in
75:
76: \kbd{./Configure --prefix=/an/exotic/directory}
77:
78: \noindent (the default prefix is \kbd{/usr/local}). This phase extracts some
79: files and creates a directory \kbd{O$xxx$} where the object files and
80: executables will be built. The $xxx$ part depends on your architecture and
81: operating system, thus you can build GP for several different machines from
82: the same source tree (the builds are completely independent, so can be done
83: simultaneously).
84:
85: \misctitle{Technical note:} The precise default destinations are as follows:
86: the \kbd{gp} binary, the scripts \kbd{gphelp} and \kbd{tex2mail} go to
87: \kbd{\$prefix/bin}. The pari library goes to \kbd{\$prefix/lib} and include
88: files to \kbd{\$prefix/include/pari}. As for architecture independant files,
89: the man pages go into \kbd{\$prefix/man} and the rest in various
90: subdirectories of \kbd{\$prefix/lib/pari}.
91:
92: \noindent You can also supply a \kbd{--share-prefix} argument in which case
93: architecture independant files go to different directories than in the above
94: scheme: \kbd{\$share/pari} (galdata package), \kbd{\$share/man} (man pages)
95: and \kbd{\$share/doc/pari/} (everything else: sample GP scripts and C code,
96: documentation, emacs macros). For instance, to build a package for a Linux
97: distribution, you will want to use
98:
99: \kbd{./Configure --prefix=/usr --share-prefix=/usr/share}
100:
101: \noindent \kbd{Configure} will let the following environment variable
102: override the defaults if set:
103:
104: \kbd{AS}: Assembler.
105:
106: \kbd{CC}: C compiler.
107:
108: \kbd{CFLAGS}: Flags for the C compiler.
109:
110: \kbd{DLLD}: Dynamic library linker.
111:
112: \noindent For instance, \kbd{Configure} avoids \kbd{gcc} on some
113: architectures due to various problems which may have been fixed in your
114: version of the compiler. You can try
115:
116: \kbd{env CC=gcc Configure}
117:
118: \noindent and compare the benches. Also, if you insist on using a \kbd{C++}
119: compiler and run into trouble with a recent \kbd{g++}, try to use
120: \kbd{g++ -fpermissive}.
121:
122: \subsec{Troubleshooting and fine tuning:} Decide whether you agree with what
123: \kbd{Configure} printed on your screen (in particular the architecture,
1.2 ! noro 124: compiler and optimization flags). Look for messages prepended by
! 125: \kbd{\#\#\#}, which probably report genuine problems. If anything should have
! 126: been found and was not, consider that \kbd{Configure} failed and follow the
! 127: instructions below. Look especially for the \kbd{readline} and \kbd{X11}
! 128: libraries, and the \kbd{perl} and \kbd{gunzip} (or \kbd{zcat}) binaries.
1.1 noro 129:
130: In case the default \kbd{Configure} run fails miserably, try
131:
132: \kbd{./Configure -a}
133:
134: \noindent (interactive mode) and answer all the questions (there aren't that
135: many). Of course, \kbd{Configure} will still provide defaults for each answer
136: but if you accept them all, it will fail just the same, so be wary. In any
137: case, we would appreciate a bug report including the complete output from
138: \kbd{Configure} and the file \kbd{O$xxx$/dft.Config.in} that was produced in
139: the process.
140:
1.2 ! noro 141: \subsec{Problems related to readline:}
! 142: Even in interactive mode, you cannot directly tell \kbd{Configure}
1.1 noro 143: where the \kbd{readline} library and include files are. If they are not in a
144: standard place, it won't find them. Nonetheless, it first searches the
145: distribution toplevel for a \kbd{readline} directory. Thus, if you just want
146: to give \kbd{readline} a try (as you probably should), you can get the source
147: and compile it there (you don't need to install it). You can also use this
148: feature together with a symbolic link, named \kbd{readline}, in the PARI
149: toplevel directory if you have compiled the readline library somewhere else,
150: without installing it to one of its standard locations.
151:
1.2 ! noro 152: \misctitle{Linux:} Linux distributions have separate \kbd{readline} and
! 153: \kbd{readline-devel} packages. You need both of them installed to compile gp
! 154: with readline support. If only \kbd{readline} is installed, \kbd{Configure}
! 155: will complain. \kbd{Configure} may also complain about a missing
! 156: libncurses.so, in which case, you will have to install the
! 157: \kbd{ncurses-devel} package (some distributions let you install
! 158: \kbd{readline-devel} without \kbd{ncurses-devel}, which is a bug in their
! 159: package dependency handling).
! 160:
1.1 noro 161: \misctitle{Technical note:} Configure can build GP on different architectures
162: simultaneously from the same toplevel sources. Instead of the \kbd{readline}
163: link alluded above, you can create \kbd{readline-{\sl osname}-{\sl arch}},
164: using the same naming conventions as for the \kbd{O$xxx$} directory,
165: e.g \kbd{readline-linux-i686}.
166:
167: \subsec{Debugging/profiling}: If you also want to debug the PARI library,
168:
169: \kbd{Configure -g}
170:
171: \noindent will create a directory \kbd{O$xxx$.dbg} containing a special
172: \kbd{Makefile} ensuring that the GP and PARI library built there will be
173: suitable for debugging (if your compiler doesn't use standard flags,
174: e.g.~\kbd{-g} you may have to tweak that \kbd{Makefile}). If you want to
175: profile GP or the library (using \kbd{gprof} for instance),
176:
177: \kbd{Configure -pg}
178:
179: \noindent will create an \kbd{O$xxx$.prf} directory where a suitable version
180: of PARI can be built.
181:
182: \subsec{Compilation and tests:} To compile the GP binary, simply type
183:
184: \kbd{make gp}
185:
186: \noindent in the distribution directory. If your \kbd{make} program supports
187: parallel make, you can speed up the process by going to the \kbd{O$xxx$}
188: directory that \kbd{Configure} created and doing a parallel make here (for
1.2 ! noro 189: instance \kbd{make -j4} with GNU make). It may even work from the toplevel
! 190: directory.
! 191:
! 192: The GP binary built above is optimized. If you have run \kbd{Configure -g} or
! 193: \kbd{-pg} and want to build a special purpose binary, you can \kbd{cd} to the
! 194: \kbd{.dbg} or \kbd{.prf} directory and type \kbd{make gp} there. You can also
! 195: invoke \kbd{make gp.dbg} or \kbd{make gp.prf} directly from the toplevel.
1.1 noro 196:
197: \subsubsec{Testing}
198:
199: To test the binary, type \kbd{make bench}. This will build a static
200: executable (the default, built by \kbd{make gp} is probably dynamic) and
201: run a series of comparative tests on those two. To test only the default
202: binary, use \kbd{make dobench} which starts the bench immediately.
203:
204: The static binary should be slightly faster. In any case, this should not
1.2 ! noro 205: take more than a few seconds (user time) on modern machines. See the file
! 206: \kbd{MACHINES} to get an idea of how much time comparable systems need. (We
1.1 noro 207: would appreciate a short note in the same format in case your system is not
1.2 ! noro 208: listed and you nevertheless have a working GP executable.)
1.1 noro 209:
210: If a \kbd{[BUG]} message shows up, something went wrong. Probably with the
211: installation procedure, but it may be a bug in the Pari system, in which
212: case we would appreciate a report (including the relevant \kbd{*.dif} file
213: in the \kbd{O$xxx$} directory and the file \kbd{dft.Config.in}).
214:
215: \misctitle{Known problems:}
216:
217: $\bullet$ \kbd{elliptic}: the test \kbd{cmcurve=ellinit([0,-3/4,0,-2,-1])}
218: may give results which differ slightly from the template (last decimal in a
219: few entries). This ultimately depends on the output of
220:
221: \kbd{polroots(x\pow 3-3/4*x\pow 2-2*x-1)[1]}
222:
223: \noindent at \kbd{\b{p}38}, which may be $2.0$ or $1.999\dots$ depending on
224: your hardware, libraries, compiler\dots Intel Pentiums running Linux often
225: trigger this \kbd{BUG} (unrelated to the infamous \kbd{fdiv} bug), which
226: can safely be ignored in any case: both results are correct given the
227: requested precision.
228:
229: $\bullet$ \kbd{program}: the GP function \kbd{install} may not be available on
230: your platform, triggering an error message (``not yet available for this
231: architecture''). Have a look at the \kbd{MACHINES} files (the \kbd{dl}
232: column) to check if your system is known not to support it, or has never
233: been tested yet.
234:
235: $\bullet$ If when running \kbd{gp-dyn}, you get a message of the form
236:
237: \kbd{ld.so: warning: libpari.so.$xxx$ has older revision than expected $xxx$}
238:
239: \noindent (possibly followed by more errors), you already have a dynamic PARI
240: library installed {\it and\/} a broken local configuration. Either remove the
241: old library or unset the \kbd{LD\_LIBRARY\_PATH} environment variable. Try to
242: disable this variable in any case if anything {\it very} wrong occurs with
243: the \kbd{gp-dyn} binary (e.g Illegal Instruction on startup). It doesn't
244: affect \kbd{gp-sta}.
245:
246: \subsubsec{Some more testing} [{\sl Optional\/}]
247:
248: You can test GP in compatibility mode with \kbd{make test-compat}. If you
249: want to test the graphic routines, use \kbd{make test-graphic}. You will
250: have to click on the mouse button after seeing each image (under X11).
251: There will be eight of them, probably shown twice (under X11, try to resize
252: at least one of them as a further test).
253:
254: The \kbd{make bench} and \kbd{make test-compat} runs produce a Postscript
255: file \kbd{pari.ps} in \kbd{O$xxx$} which you can send to a Postscript
256: printer. The output should bear some similarity to the screen images.
257:
258: \section{Installation} When everything looks fine, type
259:
260: \kbd{make install}
261:
1.2 ! noro 262: \noindent You may have to do this with superuser privileges, depending on
! 263: the target directories. (Tip for MacOS X beginners: use
! 264: \kbd{sudo make install}.) Beware that, if you chose the same installation
1.1 noro 265: directory as before in the \kbd{Configure} process, this will wipe out any
266: files from version 1.39.15 and below that might already be there. Libraries
267: and executable files from newer versions (starting with version 1.900) are
268: not removed since they are only links to files bearing the version number
269: (beware of that as well: if you're an avid GP fan, don't forget to delete the
270: old pari libraries once in a while).
271:
272: This installs in the directories chosen at \kbd{Configure} time the default
273: GP executable (probably \kbd{gp-dyn}) under the name \kbd{gp}, the default
274: PARI library (probably \kbd{libpari.so}), the necessary include files, the
275: manual pages, the documentation and help scripts and emacs macros.
276:
1.2 ! noro 277: To save on disk space, you can manually \kbd{gzip} some of the documentation
! 278: files if you wish~: \kbd{usersch*.tex} and all \kbd{dvi} files (assuming your
! 279: \kbd{xdvi} knows how to deal with compressed files); the online-help system
! 280: will handle it.
! 281:
1.1 noro 282: By default, if a dynamic library \kbd{libpari.so} could be built, the static
283: library \kbd{libpari.a} will not be created. If you want it as well, you can
284: use the target \kbd{make install-lib-sta}. You can install a statically
285: linked \kbd{gp} with the target \kbd{make install-bin-sta}. As a rule,
286: programs linked statically (with \kbd{libpari.a}) may be slightly faster
287: (about 5\% gain), but use much more disk space and take more time to compile.
288: They are also harder to upgrade: you will have to recompile them all instead
289: of just installing the new dynamic library. On the other hand, there's no
290: risk of breaking them by installing a new pari library.
291:
292: \subsec{The Galois package:} The default \kbd{polgalois} function can only
293: compute Galois groups of polynomials of degree less or equal to 7. If you
294: want to handle polynomials of degree bigger than 7 (and less than 11), you
295: need to fetch a separate archive: \kbd{galdata.tgz} which can probably be
296: found at the same place where you got the main PARI archive, and on the
297: \kbd{megrez} ftp server in any case. Untar the archive in the \kbd{datadir}
298: directory which was chosen at \kbd{Configure} time (it's one of the last
299: messages on the screen if you did not run \kbd{Configure -a}). You can then
300: test the \kbd{polgalois} function with your favourite polynomials.
301:
302: \subsec{The \kbd{GPRC} file:} Copy the file \kbd{misc/gprc.dft} (or
303: \kbd{gprc.dos} if you're using \kbd{GP.EXE}) to \kbd{\$HOME/.gprc}. Modify
304: it to your liking. For instance, if you're not using an ANSI terminal,
305: remove control characters from the \kbd{prompt} variable. You can also
306: enable colors.
307:
308: If desired, also copy/modify \kbd{misc/gpalias} somewhere and call it from
309: the \kbd{gprc} file (this provides some common shortcuts to lengthy names).
310: Finally, if you have superuser privileges and want to provide system-wide
311: defaults, you can copy your customized \kbd{.gprc} file to \kbd{/etc/gprc}.
312:
313: In older versions, \kbd{gphelp} was hidden in pari lib directory and wasn't
314: meant to be used from the shell prompt, but not anymore. If gp complains it
315: can't find \kbd{gphelp}, check whether your \kbd{.gprc} (or the system-wide
316: \kbd{gprc}) does contain explicit paths. If so, correct them according to the
317: current \kbd{misc/gprc.dft}.
318:
319: \section{Getting Started}
320:
321: \subsec{Printable Documentation:} To print the user's guide, for which you'll
1.2 ! noro 322: need a working (plain) \TeX\ installation, type
1.1 noro 323:
324: \kbd{make doc}
325:
326: \noindent This will create, in two passes, a file \kbd{doc/users.dvi}
327: containing the manual with a table of contents and an index. You must then
328: send the \kbd{users.dvi} file to your favourite printer in the usual way,
329: probably via \kbd{dvips}. Also included are a short tutorial
330: (\kbd{doc/tutorial.dvi}) and a reference card (\kbd{doc/refcard.dvi}
331: and \kbd{doc/refcard.ps}) for GP.
332:
333: \noindent If the \kbd{pdftex} package is part of your \TeX\ setup, you can
334: produce these documents in PDF format, which may be more convenient for
335: online browsing (the manual is complete with hyperlinks); type
336:
337: \kbd{make docpdf}
338:
339: \noindent All these documents are available online from PARI home page and on
340: the \kbd{megrez} ftp server.
341:
342: \subsec{C programming:} Once all libraries and include files are installed,
343: you can link your C programs to the PARI library. A sample makefile
344: \kbd{examples/Makefile} is provided to illustrate the use of the various
345: libraries. Type \kbd{make all} in the \kbd{examples} directory to see how
346: they perform on the \kbd{mattrans.c} program, which is commented in the
347: manual.
348:
349: \subsec{GP scripts:} Several complete sample GP programs are also given in
350: the \kbd{examples} directory, for example Shanks's SQUFOF factoring method,
351: the Pollard rho factoring method, the Lucas-Lehmer primality test for
352: Mersenne numbers and a simple general class group and fundamental unit
353: algorithm (much worse than the built-in \kbd{bnfinit}!). See the file
354: \kbd{examples/EXPLAIN} for some explanations.
355:
356: \subsec{EMACS:} If you want to use \kbd{gp} under GNU Emacs, read the file
357: \kbd{emacs/pariemacs.txt}. If you are familiar with Emacs, we suggest that
358: you do~so.
359:
360: \subsec{The PARI Community:} There are three mailing lists devoted to the
361: PARI/GP package (run courtesy of Dan Bernstein), and most feedback should be
362: directed to those. They are:
363:
364: $\bullet$ \kbd{pari-announce}: to announce major version changes.
365: You can't write to this one, but you should probably subscribe.
366:
367: $\bullet$ \kbd{pari-dev}: for everything related to the development
368: of PARI, including suggestions, technical questions, bug reports or patch
369: submissions.
370:
371: $\bullet$ \kbd{pari-users}: for everything else.
372:
373: \noindent To subscribe, send empty messages respectively to
374:
375: \centerline{\kbd{pari-announce-subscribe@list.cr.yp.to}}
376:
377: \centerline{\kbd{pari-users-subscribe@list.cr.yp.to}}
378:
379: \centerline{\kbd{pari-dev-subscribe@list.cr.yp.to}}
380:
381: \noindent The PARI home page (maintained by Gerhard Niklasch) at the address
382:
383: \centerline{\wwwsite}
384:
385: \noindent maintains an archive of all discussions as well as a download area.
386: If don't want to subscribe to those lists, you can write to us at the address
387:
388: \centerline{\kbd{pari@math.u-bordeaux.fr}}
389:
390: \noindent At the very least, we will forward you mail to the lists above and
391: correct faulty behaviour, if necessary. But we cannot promise you will get an
392: individual answer.
393:
394: If you have used PARI in the preparation of a paper, please cite it in the
395: following form (BibTeX format):
396:
397: \def\@{@}
398: \bprog
399: @@manual{PARI2,
400: organization = "{The PARI~Group}",
401: title = "{PARI/GP, Version @vers}",
1.2 ! noro 402: year = 2002,
1.1 noro 403: address = "Bordeaux",
404: note = "available from {\tt @wwwsite}"
405: }
406: @eprog
407: \smallskip
408:
409: \noindent In any case, if you like this software, we would be indebted if you
410: could send us an email message giving us some information about yourself and
411: what you use PARI for.
412:
413: \medskip
414: {\bf Good luck and enjoy!}
415: \vfill\eject
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>