2.4 Notes for Particular Systems

AIX 3 and 4

On systems ‘*-*-aix[34]*’ shared libraries are disabled by default, since some versions of the native ar fail on the convenience libraries used. A shared build can be attempted with

./configure --enable-shared --disable-static

Note that the ‘--disable-static’ is necessary because in a shared build libtool makes libgmp.a a symlink to libgmp.so, apparently for the benefit of old versions of ld which only recognise .a, but unfortunately this is done even if a fully functional ld is available.

ARM

On systems ‘arm*-*-*’, versions of GCC up to and including 2.95.3 have a bug in unsigned division, giving wrong results for some operands. GMP ‘./configure’ will demand GCC 2.95.4 or later.

Compaq C++

Compaq C++ on OSF 5.1 has two flavours of iostream, a standard one and an old pre-standard one (see ‘man iostream_intro’). GMP can only use the standard one, which unfortunately is not the default but must be selected by defining __USE_STD_IOSTREAM. Configure with for instance

./configure --enable-cxx CPPFLAGS=-D__USE_STD_IOSTREAM
Floating Point Mode

On some systems, the hardware floating point has a control mode which can set all operations to be done in a particular precision, for instance single, double or extended on x86 systems (x87 floating point). The GMP functions involving a double cannot be expected to operate to their full precision when the hardware is in single precision mode. Of course this affects all code, including application code, not just GMP.

FreeBSD 7.x, 8.x, 9.0, 9.1, 9.2

m4 in these releases of FreeBSD has an eval function which ignores its 2nd and 3rd arguments, which makes it unsuitable for .asm file processing. ‘./configure’ will detect the problem and either abort or choose another m4 in the PATH. The bug is fixed in FreeBSD 9.3 and 10.0, so either upgrade or use GNU m4. Note that the FreeBSD package system installs GNU m4 under the name ‘gm4’, which GMP cannot guess.

FreeBSD 7.x, 8.x, 9.x

GMP releases starting with 6.0 do not support ‘ABI=32’ on FreeBSD/amd64 prior to release 10.0 of the system. The cause is a broken limits.h, which GMP no longer works around.

MS-DOS and MS Windows

On an MS-DOS system DJGPP can be used to build GMP, and on an MS Windows system Cygwin, DJGPP and MINGW can be used. All three are excellent ports of GCC and the various GNU tools.

Microsoft also publishes an Interix “Services for Unix” which can be used to build GMP on Windows (with a normal ‘./configure’), but it’s not free software.

MS Windows DLLs

On systems ‘*-*-cygwin*’, ‘*-*-mingw*’ and ‘*-*-pw32*’ by default GMP builds only a static library, but a DLL can be built instead using

./configure --disable-static --enable-shared

Static and DLL libraries can’t both be built, since certain export directives in gmp.h must be different.

A MINGW DLL build of GMP can be used with Microsoft C. Libtool doesn’t install a .lib format import library, but it can be created with MS lib as follows, and copied to the install directory. Similarly for libmp and libgmpxx.

cd .libs
lib /def:libgmp-3.dll.def /out:libgmp-3.lib

MINGW uses the C runtime library ‘msvcrt.dll’ for I/O, so applications wanting to use the GMP I/O routines must be compiled with ‘cl /MD’ to do the same. If one of the other C runtime library choices provided by MS C is desired then the suggestion is to use the GMP string functions and confine I/O to the application.

Motorola 68k CPU Types

m68k’ is taken to mean 68000. ‘m68020’ or higher will give a performance boost on applicable CPUs. ‘m68360’ can be used for CPU32 series chips. ‘m68302’ can be used for “Dragonball” series chips, though this is merely a synonym for ‘m68000’.

NetBSD 5.x

m4 in these releases of NetBSD has an eval function which ignores its 2nd and 3rd arguments, which makes it unsuitable for .asm file processing. ‘./configure’ will detect the problem and either abort or choose another m4 in the PATH. The bug is fixed in NetBSD 6, so either upgrade or use GNU m4. Note that the NetBSD package system installs GNU m4 under the name ‘gm4’, which GMP cannot guess.

OpenBSD 2.6

m4 in this release of OpenBSD has a bug in eval that makes it unsuitable for .asm file processing. ‘./configure’ will detect the problem and either abort or choose another m4 in the PATH. The bug is fixed in OpenBSD 2.7, so either upgrade or use GNU m4.

Power CPU Types

In GMP, CPU types ‘power*’ and ‘powerpc*’ will each use instructions not available on the other, so it’s important to choose the right one for the CPU that will be used. Currently GMP has no assembly code support for using just the common instruction subset. To get executables that run on both, the current suggestion is to use the generic C code (--disable-assembly), possibly with appropriate compiler options (like ‘-mcpu=common’ for gcc). CPU ‘rs6000’ (which is not a CPU but a family of workstations) is accepted by config.sub, but is currently equivalent to --disable-assembly.

Sparc CPU Types

sparcv8’ or ‘supersparc’ on relevant systems will give a significant performance increase over the V7 code selected by plain ‘sparc’.

Sparc App Regs

The GMP assembly code for both 32-bit and 64-bit Sparc clobbers the “application registers” g2, g3 and g4, the same way that the GCC default ‘-mapp-regs’ does (see SPARC Options in Using the GNU Compiler Collection (GCC)).

This makes that code unsuitable for use with the special V9 ‘-mcmodel=embmedany’ (which uses g4 as a data segment pointer), and for applications wanting to use those registers for special purposes. In these cases the only suggestion currently is to build GMP with --disable-assembly to avoid the assembly code.

SunOS 4

/usr/bin/m4 lacks various features needed to process .asm files, and instead ‘./configure’ will automatically use /usr/5bin/m4, which we believe is always available (if not then use GNU m4).

x86 CPU Types

i586’, ‘pentium’ or ‘pentiummmx’ code is good for its intended P5 Pentium chips, but quite slow when run on Intel P6 class chips (PPro, P-II, P-III). ‘i386’ is a better choice when making binaries that must run on both.

x86 MMX and SSE2 Code

If the CPU selected has MMX code but the assembler doesn’t support it, a warning is given and non-MMX code is used instead. This will be an inferior build, since the MMX code that’s present is there because it’s faster than the corresponding plain integer code. The same applies to SSE2.

Old versions of ‘gas’ don’t support MMX instructions, in particular version 1.92.3 that comes with FreeBSD 2.2.8 or the more recent OpenBSD 3.1 doesn’t.

Solaris 2.6 and 2.7 as generate incorrect object code for register to register movq instructions, and so can’t be used for MMX code. Install a recent gas if MMX code is wanted on these systems.