GMP 5.1.1 make check fail on Solaris 11

Marc Glisse marc.glisse at
Sun Feb 17 10:27:44 CET 2013

On Sun, 17 Feb 2013, Torbjorn Granlund wrote:

> Marc Glisse <marc.glisse at> writes:
>  > FAIL: t-ops2 <-- 'trunc' symbol issue
>  By that you mean we are missing the -lm flag when linking?
>  Torbjorn, would it be ok if I appended -lm to LDADD in
>  tests/cxx/, or are there better ways?
> I am always curious why something is needed.  The file makes several
> references to symbols that are in libm, not just trunc but floor and
> ceil.

I wondered about that too.

> Why does it work for the other symbls and on so many machines?
> Is there perhaps some automagic handling of linking to libraries with
> g++?

libstdc++ depends on libm, so g++ probably always links with libm. Other 
compilers may not.

> (I don't see problems with libm dependencies from the test suite or GMP
> utility programs, but we should really avoid them in the library
> itself.)

I think they are only used in this test program to check that 
double->mpf->round gives the same result as the libm rounding functions.

Marc Glisse

More information about the gmp-bugs mailing list