`checking size of mp_limb_t... 0` and `configure: error: Oops, mp_limb_t doesn't seem to work` when compiling the Microchip XC32 compiler from source
Niels Möller
nisse at lysator.liu.se
Tue Nov 7 17:56:49 CET 2023
Marc Glisse <marc.glisse at inria.fr> writes:
> From acinclude.m4:
>
>
> dnl GMP_INCLUDE_GMP_H
> dnl -----------------
> dnl Expand to the right way to #include gmp-h.in. This must be used
> dnl instead of gmp.h, since that file isn't generated until the end
> of the
> dnl configure.
> dnl
> dnl Dummy value for GMP_LIMB_BITS is enough
> dnl for all current configure-time uses of gmp.h.
>
> define(GMP_INCLUDE_GMP_H,
> [[#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
> #define GMP_NAIL_BITS $GMP_NAIL_BITS
> #define GMP_LIMB_BITS 123
> $DEFN_LONG_LONG_LIMB
> #include "$srcdir/gmp-h.in"]
> ])
Ah, I wasn't aware of that. Seems to be used for four tests, the
AC_CHECK_SIZEOF for mp_limb_t (that's the one failing in this bug
report), GMP_FUNC_ALLOCA, GMP_H_EXTERN_INLINE, and GMP_H_HAVE_FILE.
I wonder if it would be more robust to temporarily(?) add -I$srcdir to
CFLAGS?
I don't quite get how this part of the configure works, e.g., I'm
looking closer at
AC_CHECK_SIZEOF(mp_limb_t, , GMP_INCLUDE_GMP_H)
which is used for define GMP_LIMB_BITS,
AC_SUBST(GMP_LIMB_BITS, `expr 8 \* $ac_cv_sizeof_mp_limb_t`)
The definition of mp_limb_t in gmp-h.in depends on two preprocessor
symbols, __GMP_SHORT_LIMB (not defined by configure, so presumably set
by the user, like CFLAGS=-D__GMP_SHORT_LIMB?), and _LONG_LONG_LIMB.
But the latter depends on the substitution
@DEFN_LONG_LONG_LIMB@
which is skipped during the configure tests, but defined by configure
based on
case $limb_chosen in
longlong) DEFN_LONG_LONG_LIMB="#define _LONG_LONG_LIMB 1" ;;
*) DEFN_LONG_LONG_LIMB="/* #undef _LONG_LONG_LIMB */" ;;
esac
AC_SUBST(DEFN_LONG_LONG_LIMB)
So not clear to me if/how GMP_LIMB_BITS is set correctly in a long long
configuration?
Regards,
/Niels
--
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.
More information about the gmp-bugs
mailing list