You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

239 lines
10 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual documents how to install and use the Multiple Precision
Floating-Point Reliable Library, version 3.1.4.
Copyright 1991, 1993-2016 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under
the terms of the GNU Free Documentation License, Version 1.2 or any later
version published by the Free Software Foundation; with no Invariant Sections,
with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the
license is included in GNU Free Documentation License. -->
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Installing MPFR (GNU MPFR 3.1.4)</title>
<meta name="description" content="How to install and use GNU MPFR, a library for reliable multiple precision
floating-point arithmetic, version 3.1.4.">
<meta name="keywords" content="Installing MPFR (GNU MPFR 3.1.4)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#Top" rel="up" title="Top">
<link href="Reporting-Bugs.html#Reporting-Bugs" rel="next" title="Reporting Bugs">
<link href="Introduction-to-MPFR.html#Introduction-to-MPFR" rel="prev" title="Introduction to MPFR">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Installing-MPFR"></a>
<div class="header">
<p>
Next: <a href="Reporting-Bugs.html#Reporting-Bugs" accesskey="n" rel="next">Reporting Bugs</a>, Previous: <a href="Introduction-to-MPFR.html#Introduction-to-MPFR" accesskey="p" rel="prev">Introduction to MPFR</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Installing-MPFR-1"></a>
<h2 class="chapter">2 Installing MPFR</h2>
<a name="index-Installation"></a>
<p>The MPFR library is already installed on some GNU/Linux distributions,
but the development files necessary to the compilation such as
<samp>mpfr.h</samp> are not always present. To check that MPFR is fully
installed on your computer, you can check the presence of the file
<samp>mpfr.h</samp> in <samp>/usr/include</samp>, or try to compile a small program
having <code>#include &lt;mpfr.h&gt;</code> (since <samp>mpfr.h</samp> may be installed
somewhere else). For instance, you can try to compile:
</p>
<div class="example">
<pre class="example">#include &lt;stdio.h&gt;
#include &lt;mpfr.h&gt;
int main (void)
{
printf (&quot;MPFR library: %-12s\nMPFR header: %s (based on %d.%d.%d)\n&quot;,
mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR,
MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL);
return 0;
}
</pre></div>
<p>with
</p>
<div class="example">
<pre class="example">cc -o version version.c -lmpfr -lgmp
</pre></div>
<p>and if you get errors whose first line looks like
</p>
<div class="example">
<pre class="example">version.c:2:19: error: mpfr.h: No such file or directory
</pre></div>
<p>then MPFR is probably not installed. Running this program will give you
the MPFR version.
</p>
<p>If MPFR is not installed on your computer, or if you want to install a
different version, please follow the steps below.
</p>
<a name="How-to-Install"></a>
<h3 class="section">2.1 How to Install</h3>
<p>Here are the steps needed to install the library on Unix systems
(more details are provided in the <samp>INSTALL</samp> file):
</p>
<ol>
<li> To build MPFR, you first have to install GNU MP
(version 4.1 or higher) on your computer.
You need a C compiler, preferably GCC, but any reasonable compiler should
work. And you need the standard Unix &lsquo;<samp>make</samp>&rsquo; command, plus some other
standard Unix utility commands.
<p>Then, in the MPFR build directory, type the following commands.
</p>
</li><li> &lsquo;<samp>./configure</samp>&rsquo;
<p>This will prepare the build and setup the options according to your system.
You can give options to specify the install directories (instead of
the default <samp>/usr/local</samp>), threading support, and so on. See
the <samp>INSTALL</samp> file and/or the output of &lsquo;<samp>./configure --help</samp>&rsquo;
for more information, in particular if you get error messages.
</p>
</li><li> &lsquo;<samp>make</samp>&rsquo;
<p>This will compile MPFR, and create a library archive file <samp>libmpfr.a</samp>.
On most platforms, a dynamic library will be produced too.
</p>
</li><li> &lsquo;<samp>make check</samp>&rsquo;
<p>This will make sure that MPFR was built correctly.
If any test fails, information about this failure can be found in the
<samp>tests/test-suite.log</samp> file. If you want the contents of this file to
be automatically output in case of failure, you can set the &lsquo;<samp>VERBOSE</samp>&rsquo;
environment variable to 1 before running &lsquo;<samp>make check</samp>&rsquo;, for instance
by typing:
</p>
<p>&lsquo;<samp>VERBOSE=1 make check</samp>&rsquo;
</p>
<p>In case of failure, you may want to check whether the problem is already
known. If not, please report this failure to the MPFR mailing-list
&lsquo;<samp>mpfr@inria.fr</samp>&rsquo;. For details, See <a href="Reporting-Bugs.html#Reporting-Bugs">Reporting Bugs</a>.
</p>
</li><li> &lsquo;<samp>make install</samp>&rsquo;
<p>This will copy the files <samp>mpfr.h</samp> and <samp>mpf2mpfr.h</samp> to the directory
<samp>/usr/local/include</samp>, the library files (<samp>libmpfr.a</samp> and possibly
others) to the directory <samp>/usr/local/lib</samp>, the file <samp>mpfr.info</samp>
to the directory <samp>/usr/local/share/info</samp>, and some other documentation
files to the directory <samp>/usr/local/share/doc/mpfr</samp> (or if you passed the
&lsquo;<samp>--prefix</samp>&rsquo; option to <samp>configure</samp>, using the prefix directory given
as argument to &lsquo;<samp>--prefix</samp>&rsquo; instead of <samp>/usr/local</samp>).
</p></li></ol>
<a name="Other-_0060make_0027-Targets"></a>
<h3 class="section">2.2 Other &lsquo;make&rsquo; Targets</h3>
<p>There are some other useful make targets:
</p>
<ul>
<li> &lsquo;<samp>mpfr.info</samp>&rsquo; or &lsquo;<samp>info</samp>&rsquo;
<p>Create or update an info version of the manual, in <samp>mpfr.info</samp>.
</p>
<p>This file is already provided in the MPFR archives.
</p>
</li><li> &lsquo;<samp>mpfr.pdf</samp>&rsquo; or &lsquo;<samp>pdf</samp>&rsquo;
<p>Create a PDF version of the manual, in <samp>mpfr.pdf</samp>.
</p>
</li><li> &lsquo;<samp>mpfr.dvi</samp>&rsquo; or &lsquo;<samp>dvi</samp>&rsquo;
<p>Create a DVI version of the manual, in <samp>mpfr.dvi</samp>.
</p>
</li><li> &lsquo;<samp>mpfr.ps</samp>&rsquo; or &lsquo;<samp>ps</samp>&rsquo;
<p>Create a Postscript version of the manual, in <samp>mpfr.ps</samp>.
</p>
</li><li> &lsquo;<samp>mpfr.html</samp>&rsquo; or &lsquo;<samp>html</samp>&rsquo;
<p>Create a HTML version of the manual, in several pages in the directory
<samp>doc/mpfr.html</samp>; if you want only one output HTML file, then type
&lsquo;<samp>makeinfo --html --no-split mpfr.texi</samp>&rsquo; from the &lsquo;<samp>doc</samp>&rsquo; directory
instead.
</p>
</li><li> &lsquo;<samp>clean</samp>&rsquo;
<p>Delete all object files and archive files, but not the configuration files.
</p>
</li><li> &lsquo;<samp>distclean</samp>&rsquo;
<p>Delete all generated files not included in the distribution.
</p>
</li><li> &lsquo;<samp>uninstall</samp>&rsquo;
<p>Delete all files copied by &lsquo;<samp>make install</samp>&rsquo;.
</p>
</li></ul>
<a name="Build-Problems"></a>
<h3 class="section">2.3 Build Problems</h3>
<p>In case of problem, please read the <samp>INSTALL</samp> file carefully
before reporting a bug, in particular section &ldquo;In case of problem&rdquo;.
Some problems are due to bad configuration on the user side (not
specific to MPFR). Problems are also mentioned in the FAQ
<a href="http://www.mpfr.org/faq.html">http://www.mpfr.org/faq.html</a>.
</p>
<p>Please report problems to the MPFR mailing-list &lsquo;<samp>mpfr@inria.fr</samp>&rsquo;.
See <a href="Reporting-Bugs.html#Reporting-Bugs">Reporting Bugs</a>.
Some bug fixes are available on the
MPFR 3.1.4 web page <a href="http://www.mpfr.org/mpfr-3.1.4/">http://www.mpfr.org/mpfr-3.1.4/</a>.
</p>
<a name="Getting-the-Latest-Version-of-MPFR"></a>
<h3 class="section">2.4 Getting the Latest Version of MPFR</h3>
<p>The latest version of MPFR is available from
<a href="ftp://ftp.gnu.org/gnu/mpfr/">ftp://ftp.gnu.org/gnu/mpfr/</a> or <a href="http://www.mpfr.org/">http://www.mpfr.org/</a>.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Reporting-Bugs.html#Reporting-Bugs" accesskey="n" rel="next">Reporting Bugs</a>, Previous: <a href="Introduction-to-MPFR.html#Introduction-to-MPFR" accesskey="p" rel="prev">Introduction to MPFR</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>