Chapter 2: Installing MPIR 11
For full GMP compatibility, including deprecated functionality, the ‘--enable-gmpcompat’ con-
figuration option must be used.
An auxiliary mechanism may also be needed to express that libmpirxx.la (from --enable-cxx,
see Section 2.1 [Build Options], page 3) requires libmpir.la from the same MPIR version, since
this is not done by the libtool versioning, nor otherwise. A mismatch will result in unresolved
symbols from the linker, or perhaps the loader.
When building a package for a CPU family, care should be taken to use ‘--host’ (or ‘--build’)
to choose the least common denominator among the CPUs which might use the package. For
example this might mean plain ‘sparc’ (meaning V7) for SPARCs.
For x86s, --enable-fat sets things up for a fat binary build, making a runtime selection of
optimized low level routines. This is a good choice for packaging to run on a range of x86 chips.
Users who care about speed will want MPIR built for their exact CPU type, to make best use
of the available optimizations. Providing a way to suitably rebuild a package may be useful.
This could be as simple as making it possible for a user to omit ‘--build’ (and ‘--host’) so
‘./config.guess’ will detect the CPU. But a way to manually specify a ‘--build’ will be
wanted for systems where ‘./config.guess’ is inexact.
On systems with multiple ABIs, a packaged build will need to decide which among the choices
is to be provided, see Section 2.2 [ABI and ISA], page 8. A given run of ‘./configure’ etc will
only build one ABI. If a second ABI is also required then a second run of ‘./configure’ etc
must be made, starting from a clean directory tree (‘make distclean’).
As noted under “ABI and ISA”, currently no attempt is made to follow system conventions
for install locations that vary with ABI, such as /usr/lib/sparcv9 for ‘ABI=64’ as opposed to
/usr/lib for ‘ABI=32’. A package build can override ‘libdir’ and other standard variables as
necessary.
Note that mpir.h is a generated file, and will be architecture and ABI dependent. When
attempting to install two ABIs simultaneously it will be important that an application compile
gets the correct mpir.h for its desired ABI. If compiler include paths don’t vary with ABI
options then it might be necessary to create a /usr/include/mpir.h which tests preprocessor
symbols and chooses the correct actual mpir.h.
2.4 Building with Microsoft Visual Studio
MPIR can be built with the professional and higher versions of Microsoft Visual Studio 2010,
2012 and 2013. It can also be built with Visual Studio Express 2013 for Windows Desktop. In
addition to one of these versions of Visual Studio, Python 3 and the YASM assembler will need
to be installed if the assembler optimised versions are required. if installed, MPIR can also be
built with the Intel compiler that can be integrated into tne full versions of Visual Studio.
Python can be obtained from:
https://www.python.org/
and the YASM assembler is available here:
http://yasm.tortall.net/Download.html
This assembler (vsyasm.exe, NOT yasm.exe) should be placed in the binary directory used by
the Visual Studio version in use, which should be one of:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin