Dear all,
------------
Problem
------------
This is a problem I faced when building prerequisite libraries(gmp, mpfr, mpc, ppl, cloog)
before building gcc-4.7.2 from source today.
I found a mismatch between GMP and PPL when trying to compile the PPL library from source code.
(Building GMP alone is fine.)
-------------------------------
Source Code Version
-------------------------------
The source code that I downloaded from are
a. GMP
Site:
Download link:
b. PPL(Parma Polyhedra Library)
Site:
Download link:
-----------------------
Problem Details
-----------------------
1. < Redefinition of numeric_limits >
ppl-1.0/src/mp_std_bits.defs.hh:47 and
gmp-5.1.0/gmpxx.h:3269
both define
numeric_limits<mpz_class> and
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
numeric_limits<mpq_class>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Problem:
It would lead to a redefinition error when trying to compile PPL source code to object code.
It seems that the newer GMP library(5.1.0) has included the definition of numeric_limits but
for PPL library, the definitions are not removed.
I googled this problem. There are also some reports to this problem.
Fix:
I commented out the numeric_limits defined in ppl-1.0/src/mp_std_bits.defs.hh.
2. < Static data member name mismatches >
ppl-1.0/src/mp_std_bits.defs.hh:72 and ppl-1.0/src/mp_std_bits.defs.hh:133 defines
static const bool tininess_before = false;
^^^^^^^^^^^^^^^^^
However, in
gmp-5.1.0/gmpxx.h:3302 and gmp-5.1.0/gmpxx.h:3339, there are
static const bool tinyness_before = false;
^^^^^^^^^^^^^^^^^^
Problem:
I am not sure if the two data member are the same. Since I commented out the whole block of
numeric_limits in ppl-1.0/src/mp_std_bits.defs.hh in the last step, the member `tininess_before'
cannot be resolved.
Fix:
Finally, I add
static const bool tininess_before = false;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in gmp-5.1.0/gmpxx.h:3303 and gmp-5.1.0/gmpxx.h:3341
and add member initialization
const bool numeric_limits<T>::tininess_before; \
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in gmp-5.1.0/cxx/limits.cc:47
and rebuild the gmp library.
So, for PPL library, even if the code for numeric_limits is commented out, the declarations and object
code can be found from GMP library.
----------------
Conclusion
----------------
GMP and PPL libraries can be compiled. I am running the PPL 'make check' test now.
I am not sure whether it is a bug so I decided to report the issue to both sides. Hope that
the mismatch can be fixed, thanks!
---------------------
Attached Files
---------------------
The mismatches are not related to configuration, so I skipped 'config.log'. If needed, please reply to me.
gcc-v.log : GCC version
uname-a.log : Info of environment
diff_gmpxx.h.txt : Modification of gmp-5.1.0/gmpxx.h
diff_mp_std_bits.defs.hh : Modification of ppl-1.0/src/mp_std_bits.defs.hh
diff_limits.cc.txt : Modification of gmp-5.1.0/cxx/limits.cc
Best Regards
-- chiahsun