Build broken: stubdom/gmp-x86_64 fails to compile

stubdom/gmp-x86_64 fails to compile This was not occurring a week ago, a package update has changed things.

In the configure checking size of types, ferror() returns 1 after fprintf().

During build of Xen, configure of stubdom/gmp-x86_64 fails. The error shown is:

checking size of unsigned short... configure: error: cannot compute sizeof (unsigned short)
See `config.log' for more details.
Makefile:170: recipe for target 'gmp-x86_64' failed
make[1]: *** [gmp-x86_64] Error 77

The C configure test program (line 31745) builds and runs, but ferror(f) returns 1 after fprintf (f, "%lu\n", i); when built in the Xen build environment. This causes the program to return 1, which indicates to configure that there was an error. The program still appears to function as intended, and outputs the unsigned short size to conftest.val. This does not occur when built out of the Xen build environment. The C configure test program

/* confdefs.h.  */
#define PACKAGE_NAME "GNU MP"
#define PACKAGE_TARNAME "gmp"
#define PACKAGE_VERSION "4.3.2"
#define PACKAGE_STRING "GNU MP 4.3.2"
#define PACKAGE_BUGREPORT "gmp-bugs@gmplib.org"
#define PACKAGE "gmp"
#define VERSION "4.3.2"
#define HAVE_HOST_CPU_x86_64 1
#define HAVE_SPEED_CYCLECOUNTER 2
#define HAVE_CALLING_CONVENTIONS 1
#define PROTOTYPES 1
#define __PROTOTYPES 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_STRING_H 1
#define TIME_WITH_SYS_TIME 1
#define HAVE_FCNTL_H 1
#define HAVE_FLOAT_H 1
#define HAVE_LANGINFO_H 1
#define HAVE_LOCALE_H 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TIMES_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_DECL_FGETC 1
#define HAVE_DECL_FSCANF 1
#define HAVE_DECL_OPTARG 1
#define HAVE_DECL_UNGETC 1
#define HAVE_DECL_VFPRINTF 1
#define HAVE_DECL_SYS_ERRLIST 0
#define HAVE_DECL_SYS_NERR 0
#define RETSIGTYPE void
#define HAVE_INTMAX_T 1
#define HAVE_LONG_DOUBLE 1
#define HAVE_LONG_LONG 1
#define HAVE_PTRDIFF_T 1
#define HAVE_UINT_LEAST32_T 1
#define HAVE_STRINGIZE 1
#define HAVE_STDARG 1
#define HAVE_ATTRIBUTE_CONST 1
#define HAVE_ATTRIBUTE_MALLOC 1
#define HAVE_ATTRIBUTE_MODE 1
#define HAVE_ATTRIBUTE_NORETURN 1
#define HAVE_ALLOCA_H 1
#define HAVE_ALLOCA 1
#define WANT_TMP_ALLOCA 1
#define HAVE_LIMB_LITTLE_ENDIAN 1
#define HAVE_DOUBLE_IEEE_LITTLE_ENDIAN 1
#define HAVE_ALARM 1
#define HAVE_CLOCK 1
#define HAVE_CLOCK_GETTIME 1
#define HAVE_GETPAGESIZE 1
#define HAVE_GETRUSAGE 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_LOCALECONV 1
#define HAVE_MEMSET 1
#define HAVE_MMAP 1
#define HAVE_MPROTECT 1
#define HAVE_NL_LANGINFO 1
#define HAVE_OBSTACK_VPRINTF 1
#define HAVE_POPEN 1
#define HAVE_RAISE 1
#define HAVE_SIGACTION 1
#define HAVE_SIGALTSTACK 1
#define HAVE_SIGSTACK 1
#define HAVE_STRCHR 1
#define HAVE_STRERROR 1
#define HAVE_STRNLEN 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_SYSCONF 1
#define HAVE_SYSCTL 1
#define HAVE_TIMES 1
#define HAVE_VSNPRINTF 1
#define HAVE_NATIVE_mpn_add_n 1
#define HAVE_NATIVE_mpn_add_nc 1
#define HAVE_NATIVE_mpn_sub_n 1
#define HAVE_NATIVE_mpn_sub_nc 1
#define HAVE_NATIVE_func_nc 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_add_n 1
#define HAVE_NATIVE_mpn_add_nc 1
#define HAVE_NATIVE_mpn_sub_n 1
#define HAVE_NATIVE_mpn_sub_nc 1
#define HAVE_NATIVE_func_nc 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_mul_1c 1
#define HAVE_NATIVE_mpn_mul_1 1
#define HAVE_NATIVE_mpn_addmul_1 1
#define HAVE_NATIVE_mpn_submul_1 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_addmul_1 1
#define HAVE_NATIVE_mpn_submul_1 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_lshift 1
#define HAVE_NATIVE_mpn_rshift 1
#define HAVE_NATIVE_mpn_divexact_1 1
#define HAVE_NATIVE_mpn_preinv_divrem_1 1
#define HAVE_NATIVE_mpn_divrem_1 1
#define HAVE_NATIVE_mpn_divrem_2 1
#define HAVE_NATIVE_mpn_mod_34lsub1 1
#define HAVE_NATIVE_mpn_modexact_1_odd 1
#define HAVE_NATIVE_mpn_modexact_1c_odd 1
#define HAVE_NATIVE_mpn_mul_basecase 1
#define HAVE_NATIVE_mpn_sqr_basecase 1
#define HAVE_NATIVE_mpn_popcount 1
#define HAVE_NATIVE_mpn_hamdist 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_popcount 1
#define HAVE_NATIVE_mpn_hamdist 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_bdiv_dbm1c 1
#define HAVE_NATIVE_mpn_redc_1 1
#define HAVE_NATIVE_mpn_copyi 1
#define HAVE_NATIVE_mpn_copyd 1
#define HAVE_NATIVE_mpn_com_n 1
#define HAVE_NATIVE_mpn_and_n 1
#define HAVE_NATIVE_mpn_andn_n 1
#define HAVE_NATIVE_mpn_nand_n 1
#define HAVE_NATIVE_mpn_ior_n 1
#define HAVE_NATIVE_mpn_iorn_n 1
#define HAVE_NATIVE_mpn_nior_n 1
#define HAVE_NATIVE_mpn_xor_n 1
#define HAVE_NATIVE_mpn_xnor_n 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_and_n 1
#define HAVE_NATIVE_mpn_andn_n 1
#define HAVE_NATIVE_mpn_nand_n 1
#define HAVE_NATIVE_mpn_ior_n 1
#define HAVE_NATIVE_mpn_iorn_n 1
#define HAVE_NATIVE_mpn_nior_n 1
#define HAVE_NATIVE_mpn_xor_n 1
#define HAVE_NATIVE_mpn_xnor_n 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_and_n 1
#define HAVE_NATIVE_mpn_andn_n 1
#define HAVE_NATIVE_mpn_nand_n 1
#define HAVE_NATIVE_mpn_ior_n 1
#define HAVE_NATIVE_mpn_iorn_n 1
#define HAVE_NATIVE_mpn_nior_n 1
#define HAVE_NATIVE_mpn_xor_n 1
#define HAVE_NATIVE_mpn_xnor_n 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_and_n 1
#define HAVE_NATIVE_mpn_andn_n 1
#define HAVE_NATIVE_mpn_nand_n 1
#define HAVE_NATIVE_mpn_ior_n 1
#define HAVE_NATIVE_mpn_iorn_n 1
#define HAVE_NATIVE_mpn_nior_n 1
#define HAVE_NATIVE_mpn_xor_n 1
#define HAVE_NATIVE_mpn_xnor_n 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_and_n 1
#define HAVE_NATIVE_mpn_andn_n 1
#define HAVE_NATIVE_mpn_nand_n 1
#define HAVE_NATIVE_mpn_ior_n 1
#define HAVE_NATIVE_mpn_iorn_n 1
#define HAVE_NATIVE_mpn_nior_n 1
#define HAVE_NATIVE_mpn_xor_n 1
#define HAVE_NATIVE_mpn_xnor_n 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_and_n 1
#define HAVE_NATIVE_mpn_andn_n 1
#define HAVE_NATIVE_mpn_nand_n 1
#define HAVE_NATIVE_mpn_ior_n 1
#define HAVE_NATIVE_mpn_iorn_n 1
#define HAVE_NATIVE_mpn_nior_n 1
#define HAVE_NATIVE_mpn_xor_n 1
#define HAVE_NATIVE_mpn_xnor_n 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_and_n 1
#define HAVE_NATIVE_mpn_andn_n 1
#define HAVE_NATIVE_mpn_nand_n 1
#define HAVE_NATIVE_mpn_ior_n 1
#define HAVE_NATIVE_mpn_iorn_n 1
#define HAVE_NATIVE_mpn_nior_n 1
#define HAVE_NATIVE_mpn_xor_n 1
#define HAVE_NATIVE_mpn_xnor_n 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_and_n 1
#define HAVE_NATIVE_mpn_andn_n 1
#define HAVE_NATIVE_mpn_nand_n 1
#define HAVE_NATIVE_mpn_ior_n 1
#define HAVE_NATIVE_mpn_iorn_n 1
#define HAVE_NATIVE_mpn_nior_n 1
#define HAVE_NATIVE_mpn_xor_n 1
#define HAVE_NATIVE_mpn_xnor_n 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_func 1
#define HAVE_NATIVE_mpn_invert_limb 1
#define HAVE_NATIVE_mpn_mul_2 1
#define HAVE_NATIVE_mpn_addmul_2 1
#define HAVE_NATIVE_mpn_addlsh1_n 1
#define HAVE_NATIVE_mpn_sublsh1_n 1
#define HAVE_NATIVE_mpn_rsh1add_n 1
#define HAVE_NATIVE_mpn_rsh1sub_n 1
#define HAVE_NATIVE_mpn_addaddmul_1msb0 1
#define LSYM_PREFIX ".L"
#define GMP_MPARAM_H_SUGGEST "./mpn/x86_64/gmp-mparam.h"
/* end confdefs.h.  */
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
#  include <stdlib.h>
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
#  include <memory.h>
# endif
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
   typedef unsigned short ac__type_sizeof_;
static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
#include <stdio.h>
#include <stdlib.h>
int
main ()
{

  FILE *f = fopen ("conftest.val", "w");
  if (! f)
    return 1;
  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
    {
      long int i = longval ();
      if (i != ((long int) (sizeof (ac__type_sizeof_))))
    return 1;
      fprintf (f, "%ld\n", i);
    }
  else
    {
      unsigned long int i = ulongval ();
      if (i != ((long int) (sizeof (ac__type_sizeof_))))
    return 1;
      fprintf (f, "%lu\n", i);
    }
  return ferror (f) || fclose (f) != 0;

  ;
  return 0;
}

The Xen gcc call. To use this, build Xen until it fails, then:

cd xen-4.6.1/stubdom/gmp-x86_64

Will need to adjust include paths to suit your system.

gcc -o conftest -mno-red-zone -fno-caller-saves -O2 -fomit-frame-pointer -m64 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs   -O1 -fno-omit-frame-pointer  -m64 -mno-red-zone -fno-reorder-blocks -fno-asynchronous-unwind-tables -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs   -fno-stack-protector -fno-exceptions -isystem /mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/cross-root-x86_64/x86_64-xen-elf/include -isystem /mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/../extras/mini-os/include -D__MINIOS__ -DHAVE_LIBC -isystem /mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/../extras/mini-os/include/posix -isystem /mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/../tools/xenstore/include  -isystem /mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/../extras/mini-os/include/x86 -isystem /mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/../extras/mini-os/include/x86/x86_64 -U __linux__ -U __FreeBSD__ -U __sun__ -nostdinc -isystem /mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/../extras/mini-os/include/posix -isystem /mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/cross-root-x86_64/x86_64-xen-elf/include -isystem /usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/include -isystem /mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/lwip-x86_64/src/include -isystem /mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/lwip-x86_64/src/include/ipv4 -I/mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/include -I/mnt/sdb2/aur-xen/src/xen-4.6.1/stubdom/../xen/include  conftest.c  >&5