gmp with enable-cxx
Marc Glisse
marc.glisse at normalesup.org
Fri Jan 16 02:13:53 CET 2009
On Thu, 15 Jan 2009, Janardhan Molumuri wrote:
> I am trying out gmp v4.2.4 with C++ support after applying the patches
> for v4.2.4 (http://gmplib.org/) but the compilation fails. I am using the
> studio-12 cc compiler.
>
> Are there any known issues when c++ is enabled with gmp? (P.S. I am
> trying out gmp for the gcc build). Any suggestions before look into the
> code?
>
> "../gmp-impl.h", line 851: Warning: Attribute name expected instead of
> const..
> "../gmp-impl.h", line 851: Warning: attribute is unsupported and will be
> skipped..
> "../gmp-impl.h", line 851: Error: ")" expected instead of "const".
> "../gmp-impl.h", line 851: Error: The function
> "__gmpn_jacobi_base(unsigned long, unsigned long, int) const" cannot be
> declared const.
> "../gmp-impl.h", line 851: Error: "{" expected instead of ")".
> "../gmp-impl.h", line 851: Error: Unexpected ")" -- Check for matching
> parenthesis.
> "../gmp-impl.h", line 851: Error: Operand expected instead of ")".
Apparently, support for __attribute__((const)) was added to Sun's C
compiler but not yet to their C++ compiler. Now gmp's configuration system
tests for support of various functionalities on the C compiler and assumes
that the same are available in the C++ compiler, which obviously is wrong,
but works well enough in most cases. Usually, Sun's compiler will simply
ignore unknown attributes (and it does so with __const__) but because of
what looks like a bug, it fails miserably with const.
I am very surprised I haven't read any report of this before, I wonder
whether this is specific to some patch level of the compiler or something.
You could try adding -D__GMP_NO_ATTRIBUTE_CONST_PURE to your CXXFLAGS to
work around it.
--
Marc Glisse
More information about the gmp-discuss
mailing list