Subject: powerpc64le: gcc-final: "configure: error: cannot compute sizeof (long long)"

From: Chris Marusich <[email-masked]>
Date: Tue, 02 Feb 2021 01:07:24 -0800

Hi,

On powerpc64le-linux, using commit
a1cdd9de3cffb5677fc1570d9a7992bf0cbd2f34 (which is on the wip-ppc64le
branch), gcc-final fails to build with the following error:

--8<---------------cut here---------------start------------->8---
checking size of long long... configure: error: in `/tmp/guix-build-gcc-7.5.0.drv-0/build/gcc':
configure: error: cannot compute sizeof (long long)
See `config.log' for more details.
--8<---------------cut here---------------end--------------->8---

The file /tmp/guix-build-gcc-7.5.0.drv-0/build/gcc/config.log contains a
little more info.  It says:

--8<---------------cut here---------------start------------->8---
configure:6087: checking size of long long
configure:6092: g++ -std=gnu++98 -o conftest -g    -Wl,-rpath=/gnu/store/mzdwhzgk63ys7ypadfxgk1v2nh83gvwi-glibc-2.31/lib -Wl,-dynamic-linker -Wl,/gnu/store/mzdwhzgk63ys7ypadfxgk1v2nh83gvwi-glibc-2.31/lib/ld64.so.2 -L/gnu/store/4ya8f2bqqvaa0lw06zqskby6x8djcac7-libstdc++-7.5.0/lib -L/gnu/store/1lwsfgsv6ka9dljwczvjrp4rg7s150v5-zlib-1.2.11/lib -Wl,-rpath=/gnu/store/1lwsfgsv6ka9dljwczvjrp4rg7s150v5-zlib-1.2.11/lib conftest.cpp  >&5
powerpc64le-guix-linux-gnu-ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
configure:6092: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define SIZEOF_VOID_P 0
| #define SIZEOF_SHORT 0
| #define SIZEOF_INT 0
| #define SIZEOF_LONG 0
| #define HAVE_LONG_LONG 1
| /* 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
| static long int longval () { return (long int) (sizeof (long long)); }
| static unsigned long int ulongval () { return (long int) (sizeof (long long)); }
| #include <stdio.h>
| #include <stdlib.h>
| int
| main ()
| {
| 
|   FILE *f = fopen ("conftest.val", "w");
|   if (! f)
|     return 1;
|   if (((long int) (sizeof (long long))) < 0)
|     {
|       long int i = longval ();
|       if (i != ((long int) (sizeof (long long))))
| 	return 1;
|       fprintf (f, "%ld", i);
|     }
|   else
|     {
|       unsigned long int i = ulongval ();
|       if (i != ((long int) (sizeof (long long))))
| 	return 1;
|       fprintf (f, "%lu", i);
|     }
|   /* Do not output a trailing newline, as this causes \r\n confusion
|      on some platforms.  */
|   return ferror (f) || fclose (f) != 0;
| 
|   ;
|   return 0;
| }
configure:6096: error: in `/tmp/guix-build-gcc-7.5.0.drv-0/build/gcc':
configure:6100: error: cannot compute sizeof (long long)
--8<---------------cut here---------------end--------------->8---

Any ideas?  Perhaps we need to configure gcc in a special way for
powerpc64le-linux?

-- 
Chris