Bug 97308 - OpenBSD bootstrap fails with error: C++ preprocessor "/lib/cpp" fails sanity check
Summary: OpenBSD bootstrap fails with error: C++ preprocessor "/lib/cpp" fails sanity ...
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 11.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: build
Depends on:
Blocks:
 
Reported: 2020-10-06 16:48 UTC by Thomas Koenig
Modified: 2020-10-07 05:12 UTC (History)
0 users

See Also:
Host:
Target: x86_64-unknown-openbsd6.7
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
config.log from failed attempt (6.00 KB, text/plain)
2020-10-06 16:48 UTC, Thomas Koenig
Details
config.log from gmp subdirectory (8.55 KB, text/plain)
2020-10-06 17:06 UTC, Thomas Koenig
Details
config.log from failing libgomp (3.35 KB, text/plain)
2020-10-06 19:23 UTC, Thomas Koenig
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Koenig 2020-10-06 16:48:35 UTC
Created attachment 49318 [details]
config.log from failed attempt

On gcc302.fsffrance.org, with

../trunk/configure --prefix=$HOME --enable-languages=c,c++,fortran,lto

and invoked with "gmake"

Last output:

checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/home/tkoenig/trunk-bin/gmp':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
gmake[2]: *** [Makefile:5484: configure-stage1-gmp] Error 1
gmake[2]: Leaving directory '/home/tkoenig/trunk-bin'
gmake[1]: *** [Makefile:27002: stage1-bubble] Error 2
gmake[1]: Leaving directory '/home/tkoenig/trunk-bin'
gmake: *** [Makefile:1004: all] Error 2
Comment 1 Andreas Schwab 2020-10-06 16:55:25 UTC
You need to attach the config.log file in `/home/tkoenig/trunk-bin/gmp'.
Comment 2 Thomas Koenig 2020-10-06 17:06:08 UTC
Created attachment 49319 [details]
config.log from gmp subdirectory

Here it is.

For what it is worth, I now tried bootstrapping with CC=cc and CXX=c++,
and things seem to be working (so far).
Comment 3 Jonathan Wakely 2020-10-06 17:41:34 UTC
The /lib/cpp error is a bit misleading, because that's the last thing it tries to find as a C++ compiler, after exhausting g++ -std=c++11 and various other options that fail with:

configure:19863: g++ -std=c++11 -E  conftest.cpp
cc1plus: error: unrecognized command line option "-std=c++11"

As stated in the install docs, you need a C++11 compiler, and the system GCC on OpenBSD probably doesn't recognise the -std=c++11 option. This is not a bug.
Comment 4 Thomas Koenig 2020-10-06 19:23:32 UTC
Created attachment 49320 [details]
config.log from failing libgomp

OK, so that one isn't a bug.

I hope you don't mind if I put in the next failure after
bootstrapping with the system compiler, clang 8 (setting CC to
cc and CXX to c++):

gmake[4]: Leaving directory '/home/tkoenig/trunk-clang/x86_64-unknown-openbsd6.7/libgcc'
gmake[3]: Leaving directory '/home/tkoenig/trunk-clang/x86_64-unknown-openbsd6.7/libgcc'
mkdir x86_64-unknown-openbsd6.7/libgomp
Checking multilib configuration for libgomp...
Configuring stage 1 in x86_64-unknown-openbsd6.7/libgomp
configure: creating cache ./config.cache
checking for --enable-version-specific-runtime-libs... no
checking for --enable-generated-files-in-srcdir... no
checking build system type... x86_64-unknown-openbsd6.7
checking host system type... x86_64-unknown-openbsd6.7
checking target system type... x86_64-unknown-openbsd6.7
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... awk
checking whether gmake sets $(MAKE)... yes
checking whether gmake supports nested variables... yes
checking for x86_64-unknown-openbsd6.7-gcc... /home/tkoenig/trunk-clang/./gcc/xgcc -B/home/tkoenig/trunk-clang/./gcc/ -B/home/tkoenig/x86_64-unknown-openbsd6.7/bin/ -B/home/tkoenig/x86_64-unknown-openbsd6.7/lib/ -isystem /home/tkoenig/x86_64-unknown-openbsd6.7/include -system /home/tkoenig/x86_64-unknown-openbsd6.7/sys-include   -fno-checking
checking whether the C compiler works... no
configure: error: in `/home/tkoenig/trunk-clang/x86_64-unknown-openbsd6.7/libgomp':
configure: error: C compiler cannot create executables
See `config.log' for more details
gmake[2]: *** [Makefile:24794: configure-stage1-target-libgomp] Error 77
gmake[2]: Leaving directory '/home/tkoenig/trunk-clang'
gmake[1]: *** [Makefile:27002: stage1-bubble] Error 2
gmake[1]: Leaving directory '/home/tkoenig/trunk-clang'
gmake: *** [Makefile:1004: all] Error 2
obsd$
Comment 5 Jonathan Wakely 2020-10-06 19:36:33 UTC
ld: error: unable to find library -lc

Huh, not sure what causes that one.
Comment 6 Thomas Koenig 2020-10-06 20:02:21 UTC
The failing config.log from libgomp contains

ld: error: unable to find library -lc

so this might be closely related to / a duplicate of
PR 97304, which has the identical error message for
a different BSD version with clang.
Comment 7 Thomas Koenig 2020-10-07 05:12:33 UTC
Not really a Fortran bug, I probably clicked on that out of habit.

Regarding the original issue:

I still think it is a bug to unconditionally use a gcc when that is too old,
when a new version of clang is available which should work in principle
(modulo the -lc issue).