|
Packit |
fbef6a |
Copyright 1999-2017 Free Software Foundation, Inc.
|
|
Packit |
fbef6a |
Contributed by the AriC and Caramba projects, INRIA.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
This file is part of the GNU MPFR Library.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
The GNU MPFR Library is free software; you can redistribute it and/or modify
|
|
Packit |
fbef6a |
it under the terms of the GNU Lesser General Public License as published by
|
|
Packit |
fbef6a |
the Free Software Foundation; either version 3 of the License, or (at your
|
|
Packit |
fbef6a |
option) any later version.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
The GNU MPFR Library is distributed in the hope that it will be useful, but
|
|
Packit |
fbef6a |
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit |
fbef6a |
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
Packit |
fbef6a |
License for more details.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
You should have received a copy of the GNU Lesser General Public License
|
|
Packit |
fbef6a |
along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
|
|
Packit |
fbef6a |
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
|
|
Packit |
fbef6a |
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Installing GNU MPFR
|
|
Packit |
fbef6a |
===================
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Note: In case of problem, please read this INSTALL file carefully before
|
|
Packit |
fbef6a |
reporting a bug, in particular Section "In case of problem" below. Some
|
|
Packit |
fbef6a |
problems are due to bad configuration on the user side (not specific to
|
|
Packit |
fbef6a |
MPFR).
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
0. You first need to install GMP. See <http://www.gnu.org/software/gmp/>.
|
|
Packit |
fbef6a |
MPFR requires GMP version 4.1 or later.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
1. Extract the files from the archive.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
2. It is strongly advised to apply the latest patches if this has
|
|
Packit |
fbef6a |
not been done yet and if patches are available. You can check
|
|
Packit |
fbef6a |
on the release page:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
http://www.mpfr.org/mpfr-3.1.6/
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
which may have additional information. The patches can be applied
|
|
Packit |
fbef6a |
with commands like:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
wget http://www.mpfr.org/mpfr-3.1.6/allpatches
|
|
Packit |
fbef6a |
patch -N -Z -p1 < allpatches
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
or
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
curl http://www.mpfr.org/mpfr-3.1.6/allpatches | patch -N -Z -p1
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
(Those instructions are for the GNU patch command, for example
|
|
Packit |
fbef6a |
/usr/bin/gpatch on Solaris.)
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
3. In the MPFR directory, to detect your system, type:
|
|
Packit |
fbef6a |
./configure
|
|
Packit |
fbef6a |
possibly with options (see below, in particular if this step or
|
|
Packit |
fbef6a |
one of the following fails). You should also check whether WARNING
|
|
Packit |
fbef6a |
lines have been output (such a problem may cause a failure in one
|
|
Packit |
fbef6a |
of the following steps).
|
|
Packit |
fbef6a |
Note: paths provided in configure options must always be absolute
|
|
Packit |
fbef6a |
(relative paths are not supported).
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
4. To build the library, type:
|
|
Packit |
fbef6a |
make
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
[optional] if you want to tune MPFR for your specific architecture, see
|
|
Packit |
fbef6a |
the section "Tuning MPFR" below. Note that for most common architectures,
|
|
Packit |
fbef6a |
MPFR includes some default tuning parameters which should be near from
|
|
Packit |
fbef6a |
optimal.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
5. To check the built library (runs the test files), type:
|
|
Packit |
fbef6a |
make check
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Note: If any test fails, information about this failure can be found in
|
|
Packit |
fbef6a |
the tests/test-suite.log file; you should provide this file in your bug
|
|
Packit |
fbef6a |
reports (in addition to other useful information, as mentioned later).
|
|
Packit |
fbef6a |
If you want the contents of this file to be automatically output in case
|
|
Packit |
fbef6a |
of failure, you can set the VERBOSE environment variable to 1 before
|
|
Packit |
fbef6a |
running "make check", for instance by typing:
|
|
Packit |
fbef6a |
VERBOSE=1 make check
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
6. To install it (default "/usr/local" | see "--prefix" option), type:
|
|
Packit |
fbef6a |
make install
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
If you installed MPFR (header and library) in directories that are
|
|
Packit |
fbef6a |
not searched by default by the compiler and/or linking tools, then,
|
|
Packit |
fbef6a |
like with other libraries, you may need to set up some environment
|
|
Packit |
fbef6a |
variables such as C_INCLUDE_PATH (to find the header mpfr.h),
|
|
Packit |
fbef6a |
LIBRARY_PATH (to find the library), and if the shared library has
|
|
Packit |
fbef6a |
been installed, LD_LIBRARY_PATH (before execution) or LD_RUN_PATH
|
|
Packit |
fbef6a |
(before linking); this list is not exhaustive and some environment
|
|
Packit |
fbef6a |
variables may be specific to your system. "make install" gives some
|
|
Packit |
fbef6a |
instructions; please read them. You can also find more information
|
|
Packit |
fbef6a |
in the manuals of your compiler and linker. The MPFR FAQ may also
|
|
Packit |
fbef6a |
give some information.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Remember that if you have several MPFR (or GMP) versions installed
|
|
Packit |
fbef6a |
(e.g., one with the system, and one, newer, by you), you will not
|
|
Packit |
fbef6a |
necessarily get a compilation/linking error if a wrong library is
|
|
Packit |
fbef6a |
used (e.g., because LD_LIBRARY_PATH has not been set correctly).
|
|
Packit |
fbef6a |
But unexpected results may occur.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Under Mac OS X, if the shared library was not installed and you use
|
|
Packit |
fbef6a |
Apple's linker (this is the default), you will also need to provide
|
|
Packit |
fbef6a |
the -search_paths_first linker flag ("-Wl,-search_paths_first" when
|
|
Packit |
fbef6a |
you link via gcc) to make sure that the right library is selected,
|
|
Packit |
fbef6a |
as by default, Apple's linker selects a shared library preferably,
|
|
Packit |
fbef6a |
even when it is farther in the library paths. We recall that if a
|
|
Packit |
fbef6a |
wrong library is selected due to this behavior, unexpected results
|
|
Packit |
fbef6a |
may occur.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Building the documentation
|
|
Packit |
fbef6a |
==========================
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
To build the documentation in various formats, you may first need to
|
|
Packit |
fbef6a |
install recent versions of some utilities such as texinfo.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
* Type "make info" to produce the documentation in the info format.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
* Type "make pdf" to produce the documentation in the PDF format.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
* Type "make dvi" to produce the documentation in the DVI format.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
* Type "make ps" to produce the documentation in the Postscript format.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
* Type "make html" to produce the documentation in the HTML format
|
|
Packit |
fbef6a |
(in several pages); if you want only one output HTML file, then
|
|
Packit |
fbef6a |
type "makeinfo --html --no-split mpfr.texi" from the doc directory
|
|
Packit |
fbef6a |
instead.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Building MPFR with internal GMP header files
|
|
Packit |
fbef6a |
============================================
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
MPFR built with internal GMP header files is a bit faster, so you may want
|
|
Packit |
fbef6a |
to build it with them. Just do this in step 1:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
./configure --with-gmp-build=GMPBUILD
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
where GMPBUILD is the GMP build directory. The needed header files are:
|
|
Packit |
fbef6a |
gmp-impl.h, longlong.h and all the necessary headers to use them, which
|
|
Packit |
fbef6a |
may be located either in the GMP source directory or in the GMP build
|
|
Packit |
fbef6a |
directory, in case they are different (MPFR takes care of that, as of
|
|
Packit |
fbef6a |
MPFR 3.1.0).
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Warning: the library obtained in this way may use some internal GMP
|
|
Packit |
fbef6a |
symbols, and thus dynamically linking your software with a different
|
|
Packit |
fbef6a |
version of GMP might fail, even though it is declared as compatible
|
|
Packit |
fbef6a |
by Libtool's versioning system.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Tuning MPFR
|
|
Packit |
fbef6a |
===========
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
For this, you need to build MPFR with a GMP build directory (see above).
|
|
Packit |
fbef6a |
In the GMP build directory, you also need to go into the "tune" subdirectory
|
|
Packit |
fbef6a |
and type "make speed". This will build the GMP speed library, which is used
|
|
Packit |
fbef6a |
by the MPFR tuning mechanism.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Then go back to the MPFR build directory, go into the "tune" subdirectory and
|
|
Packit |
fbef6a |
type "make tune". This will build an optimized file "mparam.h" for your
|
|
Packit |
fbef6a |
specific architecture.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
./configure options
|
|
Packit |
fbef6a |
===================
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
--prefix=DIR installs MPFR headers and library in DIR/include and
|
|
Packit |
fbef6a |
DIR/lib respectively (the default is "/usr/local").
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
--with-gmp-include=DIR assumes that DIR contains gmp.h
|
|
Packit |
fbef6a |
--with-gmp-lib=DIR assumes that DIR contains the GMP library
|
|
Packit |
fbef6a |
--with-gmp=DIR assumes that DIR is where you have installed GMP.
|
|
Packit |
fbef6a |
same as --with-gmp-lib=DIR/lib
|
|
Packit |
fbef6a |
and --with-gmp-include=DIR/include
|
|
Packit |
fbef6a |
(use either --with-gmp alone or one or both of
|
|
Packit |
fbef6a |
--with-gmp-lib/--with-gmp-include)
|
|
Packit |
fbef6a |
Warning! Do not use these options if you have
|
|
Packit |
fbef6a |
CPPFLAGS and/or LDFLAGS containing a -I or -L
|
|
Packit |
fbef6a |
option with a directory that contains a GMP
|
|
Packit |
fbef6a |
header or library file, as these options just
|
|
Packit |
fbef6a |
add -I and -L options to CPPFLAGS and LDFLAGS
|
|
Packit |
fbef6a |
*after* the ones that are currently declared,
|
|
Packit |
fbef6a |
so that DIR will have a lower precedence. Also,
|
|
Packit |
fbef6a |
this may not work if DIR is a system directory
|
|
Packit |
fbef6a |
(typically /usr or /usr/local); see below.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
--with-gmp-build=DIR assumes that DIR contains the GMP build directory,
|
|
Packit |
fbef6a |
and enables the use of GMP internals (see above).
|
|
Packit |
fbef6a |
Warning! This option and the group of options
|
|
Packit |
fbef6a |
--with-gmp are mutually exclusive.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
--enable-assert build MPFR with assertions.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
--enable-thread-safe build MPFR as thread safe, using compiler-level
|
|
Packit |
fbef6a |
Thread Local Storage (TLS). Note: TLS support is
|
|
Packit |
fbef6a |
roughly tested by configure. If configure detects
|
|
Packit |
fbef6a |
that TLS does not work (because of the compiler,
|
|
Packit |
fbef6a |
linker or system libraries), it will output an
|
|
Packit |
fbef6a |
error message, telling you to build MPFR without
|
|
Packit |
fbef6a |
thread safe. For instance, though Mac OS X uses
|
|
Packit |
fbef6a |
GCC, it may not currently support GCC's __thread
|
|
Packit |
fbef6a |
storage class.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
--disable-thread-safe build MPFR without TLS. By default, TLS support
|
|
Packit |
fbef6a |
is detected automatically, and MPFR is built as
|
|
Packit |
fbef6a |
thread safe if supported. However this detection
|
|
Packit |
fbef6a |
is only a heuristic: TLS can be detected as
|
|
Packit |
fbef6a |
supported while its support is incomplete or
|
|
Packit |
fbef6a |
buggy (MPFR tests may fail). In such a case,
|
|
Packit |
fbef6a |
this option is useful.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
--enable-gmp-internals allows the MPFR build to use GMP's undocumented
|
|
Packit |
fbef6a |
functions (not from the public API). Note that
|
|
Packit |
fbef6a |
library versioning is not guaranteed to work if
|
|
Packit |
fbef6a |
this option is used. Thus it must not be used in
|
|
Packit |
fbef6a |
binary distributions.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Note: By default, the configure script tries to set CC/CFLAGS to GMP's
|
|
Packit |
fbef6a |
ones (this feature needs GMP 4.3.0 or later, or the --with-gmp-build
|
|
Packit |
fbef6a |
option). However this is not guaranteed to work as the configure script
|
|
Packit |
fbef6a |
does some compiler tests earlier, and the change may be too late. Also,
|
|
Packit |
fbef6a |
the values obtained from GMP may be incorrect if GMP has been built
|
|
Packit |
fbef6a |
on a different machine. In such a case, the user may need to specify
|
|
Packit |
fbef6a |
CC/CFLAGS as explained below.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Run "./configure --help" to see the other options (autoconf default options).
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
If 'gmp.h' and 'libgmp' do not match
|
|
Packit |
fbef6a |
====================================
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Under some circumstances, the configure script may output a message
|
|
Packit |
fbef6a |
saying:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
'gmp.h' and 'libgmp' seem to have different versions or
|
|
Packit |
fbef6a |
we cannot run a program linked with GMP (if you cannot
|
|
Packit |
fbef6a |
see the version numbers above). [...]
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Even though the configure script does not fail in such a case, this
|
|
Packit |
fbef6a |
message most often indicates a real error, which needs to be avoided.
|
|
Packit |
fbef6a |
Possible causes are:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
* The wanted GMP library does not have the same ABI as the one chosen
|
|
Packit |
fbef6a |
to build MPFR. The consequences may be:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
- A different GMP library (with the correct ABI) has been found,
|
|
Packit |
fbef6a |
but does not have the same version as 'gmp.h'.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
- No other GMP libraries have been found (in this case, no version
|
|
Packit |
fbef6a |
numbers should be printed above the warning message).
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
This is incorrect and one of the following steps (make, make check)
|
|
Packit |
fbef6a |
will probably fail. GMP (actually gmp.h) now provides CC and CFLAGS
|
|
Packit |
fbef6a |
information to select the correct ABI, so that this problem should
|
|
Packit |
fbef6a |
no longer occur; but if GMP was provided by a binary package, such
|
|
Packit |
fbef6a |
information may not be valid. See the
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
checking for CC and CFLAGS in gmp.h...
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
line in the configure output (about the 11th line) and the following
|
|
Packit |
fbef6a |
few ones for more information. You may need to reinstall GMP or to
|
|
Packit |
fbef6a |
provide your own CC and/or CFLAGS. See also the remaining of this
|
|
Packit |
fbef6a |
INSTALL file.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
* A configure option like --with-gmp or --with-gmp-include was used
|
|
Packit |
fbef6a |
with a system include directory, e.g. one of the following:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
--with-gmp=/usr
|
|
Packit |
fbef6a |
--with-gmp=/usr/local
|
|
Packit |
fbef6a |
--with-gmp-include=/usr/include
|
|
Packit |
fbef6a |
--with-gmp-include=/usr/local/include
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
GCC (and possibly other compilers) will ignore such a directive for
|
|
Packit |
fbef6a |
include directories (but this rule is not applied for the library
|
|
Packit |
fbef6a |
itself!). This means that the library search paths will be reordered
|
|
Packit |
fbef6a |
as declared, but the specified include directory will still be near
|
|
Packit |
fbef6a |
the end of the include search paths (thus with a low precedence).
|
|
Packit |
fbef6a |
This is not a problem if only one GMP version is installed, but
|
|
Packit |
fbef6a |
otherwise, a wrong gmp.h may be chosen, so that the versions of
|
|
Packit |
fbef6a |
gmp.h and libgmp may not match. The suggestions are the following:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
- If you want to use the GMP version under /usr, then you should
|
|
Packit |
fbef6a |
uninstall all the other GMP versions (header and library files)
|
|
Packit |
fbef6a |
that may be seen in the search paths, in particular those under
|
|
Packit |
fbef6a |
/usr/local.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
- If you want to use the GMP version under /usr/local, then you
|
|
Packit |
fbef6a |
should uninstall all the other GMP versions (header and library
|
|
Packit |
fbef6a |
files) that may be seen in the search paths, but *NOT* the one
|
|
Packit |
fbef6a |
under /usr (the version under /usr is provided by the OS vendor,
|
|
Packit |
fbef6a |
and changing/removing anything related to it may break your
|
|
Packit |
fbef6a |
system, and /usr should have a lower precedence than /usr/local
|
|
Packit |
fbef6a |
anyway).
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
To find where GMP versions have been installed:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
$ locate libgmp (if you have a locate database)
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
and if the compiler is GCC:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
$ gcc -print-file-name=libgmp.so (under most systems)
|
|
Packit |
fbef6a |
$ gcc -print-file-name=libgmp.dylib (under Mac OS X)
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
and if this does not work, you may try:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
$ gcc -print-search-dirs
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
* An official GCC version was used under Debian GNU/Linux. Problems
|
|
Packit |
fbef6a |
may come from the fact that Debian chose a different convention
|
|
Packit |
fbef6a |
for library search paths concerning 32-bit and 64-bit libraries.
|
|
Packit |
fbef6a |
A possible problem can be, for instance:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
[Debian's GCC, correct library path]
|
|
Packit |
fbef6a |
$ gcc -print-file-name=libgmp.so
|
|
Packit |
fbef6a |
/home/vlefevre/gmp/athlon64/lib/../lib/libgmp.so
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
[Official GCC, incorrect library path]
|
|
Packit |
fbef6a |
$ gcc-4.3.1 -print-file-name=libgmp.so
|
|
Packit |
fbef6a |
/usr/lib/../lib64/libgmp.so
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
The solution: use a GCC provided by Debian or add symbolic links
|
|
Packit |
fbef6a |
such as lib64 -> lib (on 64-bit machines) for your library paths.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
* The problem may also be temporary and only due to the fact that
|
|
Packit |
fbef6a |
libtool could not be used at this time. This is unlikely, though.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
In case of problem
|
|
Packit |
fbef6a |
==================
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
First, look for any warning message in the configure output.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Several documents may help you to solve the problem:
|
|
Packit |
fbef6a |
* this INSTALL file, in particular information given below;
|
|
Packit |
fbef6a |
* the FAQ (either the FAQ.html file distributed with MPFR, or the
|
|
Packit |
fbef6a |
on-line version <http://www.mpfr.org/faq.html>, which may be more
|
|
Packit |
fbef6a |
up-to-date);
|
|
Packit |
fbef6a |
* the MPFR web page for this version <http://www.mpfr.org/mpfr-3.1.6/>,
|
|
Packit |
fbef6a |
which lists bugs found in this version and provides some patches.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
If the "configure" fails, please check that the C compiler and its
|
|
Packit |
fbef6a |
options are the same as those for the GMP build (specially the ABI).
|
|
Packit |
fbef6a |
You can see the latter with the following command:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
grep "^CC\|^CFLAGS" GMPBUILD/Makefile
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
if the GMP build directory is available. Then type:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
./configure <configure options> CC=<C compiler> CFLAGS="<compiler options>"
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
(quotes are needed when there are spaces or other special characters
|
|
Packit |
fbef6a |
in the CC/CFLAGS value) and continue the install. On some platforms,
|
|
Packit |
fbef6a |
you should provide further options to match those used by GMP, or set
|
|
Packit |
fbef6a |
some environment variables. For instance, see the "Notes on AIX/PowerPC"
|
|
Packit |
fbef6a |
section below.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Warning! Do NOT use optimization options that can change the semantics
|
|
Packit |
fbef6a |
of math operations, such as GCC's -ffast-math or Sun CC's -fast.
|
|
Packit |
fbef6a |
Otherwise conversions from/to double's may be incorrect on infinities,
|
|
Packit |
fbef6a |
NaN's and signed zeros. Since native FP arithmetic is used in a few
|
|
Packit |
fbef6a |
places only, such options would not make MPFR faster anyway.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
If some "make check" tests fail, you can try the --disable-thread-safe
|
|
Packit |
fbef6a |
configure option (see the configure options above): it has been reported
|
|
Packit |
fbef6a |
that some platforms have buggy TLS support. Before trying this option,
|
|
Packit |
fbef6a |
you may want to check in the configure output whether MPFR was built
|
|
Packit |
fbef6a |
with TLS support; if yes, you will have a line:
|
|
Packit |
fbef6a |
checking for TLS support... yes
|
|
Packit |
fbef6a |
Alternatively "grep MPFR_USE_THREAD_SAFE config.log" will show that
|
|
Packit |
fbef6a |
MPFR_USE_THREAD_SAFE is defined to 1. If it is "no" (or the variable
|
|
Packit |
fbef6a |
is not defined), the --disable-thread-safe option would be useless.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Some tests failure may be due to other compiler bugs, in particular
|
|
Packit |
fbef6a |
in optimization code. You can try to build MPFR without compiler
|
|
Packit |
fbef6a |
optimizations by giving -O0 (letter O, digit 0) in CFLAGS. If the
|
|
Packit |
fbef6a |
MPFR tests no longer fail, this was probably due to a compiler bug,
|
|
Packit |
fbef6a |
though we cannot exclude a bug in MPFR. You may want to contact us
|
|
Packit |
fbef6a |
(see below), possibly after looking at:
|
|
Packit |
fbef6a |
http://www.loria.fr/~zimmerma/software/compilerbugs.html
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
On some platforms, try with "gmake" (GNU make) instead of "make".
|
|
Packit |
fbef6a |
Problems have been reported with the Tru64 make.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
If the configure script reports that gmp.h version and libgmp version
|
|
Packit |
fbef6a |
are different, or if the build was OK, but the tests failed to link
|
|
Packit |
fbef6a |
with GMP or gave an error like
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
undefined reference to `__gmp_get_memory_functions'
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
meaning that the GMP library was not found or a wrong GMP library was
|
|
Packit |
fbef6a |
selected by the linker, then your library search paths are probably
|
|
Packit |
fbef6a |
not correctly set (some paths are missing or they are specified in an
|
|
Packit |
fbef6a |
incorrect order).
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Such problems commonly occur under some GNU/Linux machines, where the
|
|
Packit |
fbef6a |
default header and library search paths may be inconsistent: GCC is
|
|
Packit |
fbef6a |
configured to search /usr/local/include and /usr/local/lib by default,
|
|
Packit |
fbef6a |
while the dynamic linker ignores /usr/local/lib. If you have a GMP
|
|
Packit |
fbef6a |
version installed in /usr (provided by the OS vendor) and a new one
|
|
Packit |
fbef6a |
installed in /usr/local, then the header of the new GMP version and
|
|
Packit |
fbef6a |
the library of the old GMP version will be used! The best solution
|
|
Packit |
fbef6a |
is to make sure that the dynamic linker configuration is consistent
|
|
Packit |
fbef6a |
with GCC's behavior, for instance by having /usr/local/lib in
|
|
Packit |
fbef6a |
/etc/ld.so.conf or in some file from /etc/ld.so.conf.d (as Debian
|
|
Packit |
fbef6a |
did: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=395177). See
|
|
Packit |
fbef6a |
also https://gcc.gnu.org/ml/gcc-help/2010-01/msg00171.html for more
|
|
Packit |
fbef6a |
information. Alternatively you can use:
|
|
Packit |
fbef6a |
* environment variables. This may sometimes be necessary. If DIR
|
|
Packit |
fbef6a |
is the installation directory of GMP, add DIR/include to your
|
|
Packit |
fbef6a |
CPATH or C_INCLUDE_PATH (for compilers other than GCC, please
|
|
Packit |
fbef6a |
check the manual of your compiler), and add DIR/lib to your
|
|
Packit |
fbef6a |
LIBRARY_PATH and LD_LIBRARY_PATH (and/or LD_RUN_PATH);
|
|
Packit |
fbef6a |
* --with-gmp* configure options (described above), e.g.
|
|
Packit |
fbef6a |
--with-gmp=/opt/local (to use /opt/local/include for headers and
|
|
Packit |
fbef6a |
/opt/local/lib for libraries), but other software that uses GMP
|
|
Packit |
fbef6a |
and/or MPFR will need correct paths too, and environment variables
|
|
Packit |
fbef6a |
allow one to set such search paths in a global way.
|
|
Packit |
fbef6a |
Note about "--with-gmp=/usr/local". This option may appear to
|
|
Packit |
fbef6a |
solve the above inconsistency problem, but does not work as you
|
|
Packit |
fbef6a |
expect. Indeed it affects the library search path, in particular,
|
|
Packit |
fbef6a |
the one used by the dynamic linker (thus adding the missing
|
|
Packit |
fbef6a |
/usr/local/lib directory as wanted), but since /usr/local/include
|
|
Packit |
fbef6a |
is a "standard system include directory" for GCC, the include
|
|
Packit |
fbef6a |
search patch is not changed; this is often not a problem in this
|
|
Packit |
fbef6a |
particular case because usually, /usr/local/include is already
|
|
Packit |
fbef6a |
last in the include search patch, but this may fail under some
|
|
Packit |
fbef6a |
occasions and may trigger obscure errors.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
For instance, under Unix, where paths are separated by a colon:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
* With POSIX sh-compatible shells (e.g. sh, ksh, bash, zsh):
|
|
Packit |
fbef6a |
export C_INCLUDE_PATH="/usr/local/include:/other/path/include"
|
|
Packit |
fbef6a |
export LIBRARY_PATH="/usr/local/lib:/other/path/lib"
|
|
Packit |
fbef6a |
export LD_LIBRARY_PATH="$LIBRARY_PATH"
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
* With csh or tcsh:
|
|
Packit |
fbef6a |
setenv C_INCLUDE_PATH "/usr/local/include:/other/path/include"
|
|
Packit |
fbef6a |
setenv LIBRARY_PATH "/usr/local/lib:/other/path/lib"
|
|
Packit |
fbef6a |
setenv LD_LIBRARY_PATH "$LIBRARY_PATH"
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
If you can't solve your problem, you should contact us via the MPFR
|
|
Packit |
fbef6a |
mailing-list <mpfr@inria.fr>, indicating the machine and operating system
|
|
Packit |
fbef6a |
used (uname -a), the compiler and version used (gcc -v if you use gcc),
|
|
Packit |
fbef6a |
the configure options used if any (including variables such as CC and
|
|
Packit |
fbef6a |
CFLAGS), the version of GMP and MPFR used, and a description of the
|
|
Packit |
fbef6a |
problem encountered, in particular the tests/test-suite.log file if
|
|
Packit |
fbef6a |
"make check" failed. Please send us also the log of the "configure"
|
|
Packit |
fbef6a |
(config.log).
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Note that even if you can build MPFR with a C++ compiler, you can't run
|
|
Packit |
fbef6a |
the test suite: C and C++ are not the same language! You should use a C
|
|
Packit |
fbef6a |
compiler instead.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Notes about ABI
|
|
Packit |
fbef6a |
===============
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
On 64-bit computers, it may happen that the default ABI (Application Binary
|
|
Packit |
fbef6a |
Interface) chosen by MPFR does not correspond to the default one chosen by
|
|
Packit |
fbef6a |
the compiler.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
In particular, this kind of message may indicate the problem:
|
|
Packit |
fbef6a |
/usr/bin/ld: skipping incompatible mpfr/src/.libs/libmpfr.a when searching for -lmpfr
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
In fact, since MPFR relies on GMP, it uses the same ABI as GMP.
|
|
Packit |
fbef6a |
To be sure that your program compiles and links correctly, use the same
|
|
Packit |
fbef6a |
compiler flags as MPFR does (look for CFLAGS in config.log).
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
You might also recompile GMP with a different ABI, with for example
|
|
Packit |
fbef6a |
./configure ABI=32.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Notes on Mac OS X
|
|
Packit |
fbef6a |
=================
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
If you get an error of the form
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
ld: pointer in read-only segment not allowed in slidable image...
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
this can mean that the link is done against a static (GMP) library.
|
|
Packit |
fbef6a |
In such a case, you should configure MPFR with --disable-shared to
|
|
Packit |
fbef6a |
disable the build of the shared library.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Notes on FreeBSD 4.3
|
|
Packit |
fbef6a |
====================
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
FreeBSD 4.3 is provided with an incorrect <float.h> header file, and
|
|
Packit |
fbef6a |
MPFR tests related to long double's may fail. If you cannot upgrade
|
|
Packit |
fbef6a |
the system, you can still use MPFR with FreeBSD 4.3, but you should
|
|
Packit |
fbef6a |
not use conversions with the long double type.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Notes on AIX/PowerPC
|
|
Packit |
fbef6a |
====================
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
The following has been tested on AIX 7.1.3 (gcc111.fsffrance.org)
|
|
Packit |
fbef6a |
with gcc 4.8.1 and GMP 6.1.0.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
If GMP was built with the 64-bit ABI, before building and testing MPFR,
|
|
Packit |
fbef6a |
you should set the OBJECT_MODE environment variable to 64, e.g., with:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
export OBJECT_MODE=64
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
(in a sh-compatible shell). Alternatively add the following to the configure
|
|
Packit |
fbef6a |
line: AR="ar -X64" NM="nm -B -X64".
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
MPFR for use with Windows Applications
|
|
Packit |
fbef6a |
======================================
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
There are several ways of building MPFR on Windows, the most appropriate
|
|
Packit |
fbef6a |
approach depending on how you intend to use the resulting libraries.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
a. Using MinGW
|
|
Packit |
fbef6a |
==============
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
1 - We advise to use MinGW (http://www.mingw.org/ for 32-bit, and
|
|
Packit |
fbef6a |
https://sourceforge.net/projects/mingw-w64/ for 32- and 64-bit),
|
|
Packit |
fbef6a |
which is simpler and less demanding than Cygwin. Contrary to Cygwin,
|
|
Packit |
fbef6a |
it also provides native Windows code.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
2 - If you just want to make a binary with gcc, there is nothing to do:
|
|
Packit |
fbef6a |
GMP, MPFR and the program compile exactly as under Linux.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
3 - To avoid using the Microsoft runtime (which might not be conform to ISO C),
|
|
Packit |
fbef6a |
you can use the MinGW runtime package (which is an integral part of MinGW).
|
|
Packit |
fbef6a |
For example, with MinGW versions 3.15 and later you can get an
|
|
Packit |
fbef6a |
ISO-compliant printf() if you compile your application with either
|
|
Packit |
fbef6a |
'-ansi', '-posix' or '-D__USE_MINGW_ANSI_STDIO'. In order to have the
|
|
Packit |
fbef6a |
MPFR formatted output functions based on ISO-compliant printf(), you
|
|
Packit |
fbef6a |
need to compile GMP (not MPFR) with CC="gcc -D__USE_MINGW_ANSI_STDIO"
|
|
Packit |
fbef6a |
(since the standard printf modifiers %Ld and %td are passed to GMP).
|
|
Packit |
fbef6a |
Building MPFR with -D__USE_MINGW_ANSI_STDIO is useless except for some
|
|
Packit |
fbef6a |
error messages in the test suite.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
b. Using Cygwin
|
|
Packit |
fbef6a |
===============
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
This build should be similar to that for MinGW except that the resulting
|
|
Packit |
fbef6a |
library depends on the Cygwin DLL and cannot therefore be used with
|
|
Packit |
fbef6a |
Visual Studio as with MinGW. Indeed, the binaries compiled with Cygwin
|
|
Packit |
fbef6a |
require a dynamic library (cygwin.dll) to work; there is a Cygwin option
|
|
Packit |
fbef6a |
-mno-cygwin to build native code, but it may require some non-portable tricks.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
In case of failure, you may need to pass LDFLAGS='-shared-libgcc' at the
|
|
Packit |
fbef6a |
end of the configure line due to a bug in GCC. Otherwise, if threading
|
|
Packit |
fbef6a |
support is not needed, you can configure MPFR with --disable-thread-safe.
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
c. Using Microsoft Visual C++ and Intel C++ Compilers
|
|
Packit |
fbef6a |
=====================================================
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
Static and dynamic MPFR libraries for the 32- and 64-bit versions of
|
|
Packit |
fbef6a |
Windows can be built with Microsoft Visual Studio 2015 using the
|
|
Packit |
fbef6a |
Microsoft Visual C++ compiler, see:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
https://www.visualstudio.com/
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
The Intel C++ compiler provided as a part of Intel Parallel Studio XE
|
|
Packit |
fbef6a |
can also be used:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
https://software.intel.com/en-us/intel-parallel-studio-xe
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
The relevant build projects are available here:
|
|
Packit |
fbef6a |
|
|
Packit |
fbef6a |
https://github.com/BrianGladman
|