Build error using pre-packaged GMP

Philip Höbler philip at hoebler.com
Mon May 24 17:10:06 UTC 2021


Dear GMP people,

first of all, thank you for building this awesome project! I have an 
issue using it however, and I am mostly clueless why. Some information 
on that:

- I'm using GMP as part of the RELIC library (that is, configuring RELIC 
to use gmp), in a C++ project

- System: Fedora 34, x86_64, pre-packaged versions of gmp and gmp-devel 
(both 6.2.0: gmp-6.2.0-6.fc34.src.rpm) used

- The library is correctly linked as far as I can tell, and no special 
build parameters are used by the RELIC Makefiles


The error I'm encountering seems to be conflicting declarations within 
the gmp-x86_64.h header (which is what stuns me, as it is from my view 
pretty much guaranteed to be coherent internally...). The gcc error 
output is:

In file included from /usr/include/gmp.h:59,
                  from [project]/relic/include/relic_types.h:40,
                  from [project]/relic/include/relic_arch.h:39,
                  from [project]/relic/include/relic.h:81,
                  from [project headers...]
/usr/include/gmp-x86_64.h:2286:33: error: conflicting declaration of C 
function 'std::ostream& operator<<(std::ostream&, mpq_srcptr)'
  2286 | __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, 
mpq_srcptr);
       |                                 ^~~~~~~~
/usr/include/gmp-x86_64.h:2285:33: note: previous declaration 
'std::ostream& operator<<(std::ostream&, mpz_srcptr)'
  2285 | __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, 
mpz_srcptr);
       |                                 ^~~~~~~~
/usr/include/gmp-x86_64.h:2287:33: error: conflicting declaration of C 
function 'std::ostream& operator<<(std::ostream&, mpf_srcptr)'
  2287 | __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, 
mpf_srcptr);
       |                                 ^~~~~~~~
/usr/include/gmp-x86_64.h:2285:33: note: previous declaration 
'std::ostream& operator<<(std::ostream&, mpz_srcptr)'
  2285 | __GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, 
mpz_srcptr);
       |                                 ^~~~~~~~
/usr/include/gmp-x86_64.h:2289:33: error: conflicting declaration of C 
function 'std::istream& operator>>(std::istream&, mpq_ptr)'
  2289 | __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, 
mpq_ptr);
       |                                 ^~~~~~~~
/usr/include/gmp-x86_64.h:2288:33: note: previous declaration 
'std::istream& operator>>(std::istream&, mpz_ptr)'
  2288 | __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, 
mpz_ptr);
       |                                 ^~~~~~~~
/usr/include/gmp-x86_64.h:2290:33: error: conflicting declaration of C 
function 'std::istream& operator>>(std::istream&, mpf_ptr)'
  2290 | __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, 
mpf_ptr);
       |                                 ^~~~~~~~
/usr/include/gmp-x86_64.h:2288:33: note: previous declaration 
'std::istream& operator>>(std::istream&, mpz_ptr)'
  2288 | __GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, 
mpz_ptr);

I tried building a minimal example replicating this issue, but couldn't 
achieve that. My hope is that someone of you has encountered this before 
or can tell by pure experience where the issue may be...

If anyone of you had an idea what the issue may be, I'd be very grateful 
to hear that! In case I can assist you with any more information, please 
let me know.

Thank you very much in advance.

Kind regards,

Philip Höbler



More information about the gmp-bugs mailing list