Error during building stage 2 gcc-9.2.0: "configure: error: cannot compute sizeof (long long)

Winston Smith Smith_Winston_6079@hotmail.com
Sat Jan 4 16:22:00 GMT 2020


Hi All,


I've trying to build gcc-9.2.0 on a host with gcc-4.5.1, matching 
versions of mpfr, gmp and mpc are symlinked into the top-level of the 
tree.


This is my configure:


$ mkdir build

$ cd build

$ ../configure --prefix=/tmp/chroot-gcc/usr/ --enable-bootstrap 
--with-glibc-version=2.12 --with-newlib --without-headers --disable-nls 
--disable-shared --disable-multilib --disable-decimal-float 
--disable-threads --disable-libatomic --disable-libgomp 
--disable-libquadmath
 --disable-libssp --disable-libvtv --disable-libstdcxx 
--enable-languages=c,c++

$ make


This fails with:

Configuring stage 2 in ./gcc
...
checking size of long long... configure: error: in `/tmp/sources/gcc-9.2.0/gcc-9.2.0/build/gcc':
configure: error: cannot compute sizeof (long long)
See `config.log' for more details
make[2]: *** [configure-stage2-gcc] Error 77
make[2]: Leaving directory `/tmp/sources/gcc-9.2.0/gcc-9.2.0/build'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/tmp/sources/gcc-9.2.0/gcc-9.2.0/build'
make: *** [all] Error 2


Looking at gcc/config.log (attached), the attempt to check the existence of type long long succeeds:

checking for long long... yes


config.log section:


configure:6188: checking for long long
configure:6188: g++ -std=gnu++98 -c -g -O2  conftest.cpp >&5
configure:6188: $? = 0


Then, the first attempt for sizeof( long long) fails with a compilation error:


configure:6188: g++ -std=gnu++98 -c -g -O2  conftest.cpp >&5
conftest.cpp: In function 'int main()':
conftest.cpp:63:14: error: expected primary-expression before 'long'
conftest.cpp:63:14: error: expected ')' before 'long'
conftest.cpp:64:14: error: expected ')' before ';' token
conftest.cpp:64:14: error: expected ')' before ';' token
configure:6188: $? = 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
| /* 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
| int
| main ()
| {
| if (sizeof ((long long)))
|    return 0;
|   ;
|   return 0;
| }
configure:6188: result: yes


I strace'd this make invocation a bit and found that it is using 
/usr/bin/g++ here (which I suspect is too old to know about sizeof( long
 long )?). Given that this is stage 2, shouldn't it use the g++ from 
stage 1?


The second attempt fails with a linker error:

configure:6199: checking size of long long
configure:6204: g++ -std=gnu++98 -o conftest -g -O2  -static-libstdc++ -static-libgcc  conftest.cpp  >&5
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
configure:6204: $? = 1


The tests for sizeof other data types had the same linker error, but 
configure continued (and printed 0 as sizeof for these data types). E.g.
 int:


checking size of int... 0


config.log section:

configure:6126: checking size of int
configure:6131: g++ -std=gnu++98 -o conftest -g -O2  -static-libstdc++ -static-libgcc  conftest.cpp  >&5
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
configure:6131: $? = 1


In summary, my questions are:

- Why does it use g++ from the host instead from stage 1 in stage 2 when I explicitly tell it to bootstrap?

- Is gcc 4.5.1 too old to build gcc-9.2.0? If so, what's the minimum 
version that can build gcc 9.2.0? Or, in reverse, that's the maximum 
version gcc-4.5.1 can build?

- Are these linker errors (and assumptions the data type size is 0) 
correct? configure continues, but it seems wrong. I have libstdc++ 4.5.1
 installed, but do I need to activate libstdcxx in the configure script?


Thanks in advance.


Regards,

Winston
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.log
Type: text/x-log
Size: 49464 bytes
Desc: config.log
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20200104/f46d8beb/attachment.bin>


More information about the Gcc-help mailing list