Bug 63509

Summary: Misleading error message when building gcc without C++ compiler installed
Product: gcc Reporter: Steve Jarvis <sajarvis>
Component: otherAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: normal CC: rjones, wilson
Priority: P3    
Version: unknown   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2019-05-02 00:00:00
Attachments: Full output during make.

Description Steve Jarvis 2014-10-11 01:05:38 UTC
Created attachment 33685 [details]
Full output during make.

When building gcc with no C++ compiler installed, configuration succeeds, then make fails with error message: 

configure: error: error verifying int64_t uses long long

Steps to cause:
1) Don't install a C++ compiler
2) $ ./configure --prefix=$HOME/dev/gcc/bld --enable-multilib
3) $ make

I think the error should be more specific to the issue (no C++ compiler found) and probably caught earlier.

System:
Fedora 20, Linux 3.16
building gcc trunk, version r216105
 

More of the log (full log attached):
[...]
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for long long int... yes
checking for intmax_t... yes
checking for intptr_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for unsigned long long int... yes
checking for uintmax_t... yes
checking for uintptr_t... yes
checking for int64_t underlying type... long long
configure: error: error verifying int64_t uses long long
make[2]: *** [configure-stage1-gcc] Error 1
make[2]: Leaving directory `/home/sjarvis/dev/gcc/srcdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/sjarvis/dev/gcc/srcdir'
make: *** [all] Error 2
Comment 1 Manuel López-Ibáñez 2014-10-12 20:02:12 UTC
*** Bug 63516 has been marked as a duplicate of this bug. ***
Comment 2 Rafael Sene 2015-01-09 17:54:17 UTC
Just got the same issue, solved installing c++. I was building gcc on Fedora 21.
Comment 3 Richard W.M. Jones 2015-02-26 12:37:50 UTC
Can confirm this happens also on Fedora 23.
Installing gcc-c++ fixes it.
Comment 4 Chenry 2015-05-03 02:51:10 UTC
Also occurred on CentOS 7, solved by installing gcc-c++.
Comment 5 greenpau 2015-05-29 18:25:12 UTC
The issue is likely that CXX environment variable is set to a non-existent location.

Verify where it point to:

```
echo $CXX
```
Comment 6 TzachiNoy 2015-10-18 20:34:14 UTC
same on Debian 3.16

`apt-get install g++` fixed the problem.

before installing: CXX was undefined
Comment 7 Jim Wilson 2019-05-02 03:31:59 UTC
Confirmed.  Except that current sources now say
configure: error: uint64_t or int64_t not found

We have a configure check to verify that the C compiler works.  We are missing one for the C++ compiler.  In configure we have
$as_echo_n "checking whether the C compiler works... " >&6; }
and there is no equivalent for the C++ compiler.
Comment 8 Jim Wilson 2019-05-04 19:50:53 UTC
I filed an autoconf bug
    http://savannah.gnu.org/support/index.php?109676

The problem here is that autoconf only verifies that the first AC_PROG_X compiler is working.  And since we include AC_PROG_CC before AC_PROG_CXX, only the C compiler is tested to see if it works.  But since we are using the C++ compiler for all of the configure checks, and for the build, we really should be verifying that the C++ compiler works.

We can work around the autoconf problem by putting AC_PROG_CXX before AC_PROG_CC.  This will verify that the C++ compiler works, but will stop verifying that the C compiler works, which is probably OK.