Bug 88421 - compat C headers break building GCC with GCC
Summary: compat C headers break building GCC with GCC
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-09 14:09 UTC by coypu
Modified: 2018-12-31 01:44 UTC (History)
2 users (show)

See Also:
Host: shle--netbsdelf
Target: shle--netbsdelf
Build: x86_64
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description coypu 2018-12-09 14:09:00 UTC
I built GCC #1 (x86_64->sh3)
Now I'm trying to build GCC #2 (sh3->sh3) using GCC #1

during the build process,

libtool: compile:  shle--netbsdelf-c++ --sysroot=/home/fly/sh3/destdir.evbsh3/ -I/current/gcc/libstdc++-v3/../libgcc -I/tmp/build/shle--netbsdelf/libstdc++-v3/include/shle--netbsdelf -I/tmp/build/shle--netbsdelf/libstdc++-v3/include -I/current/gcc/libstdc++-v3/libsupc++ -std=gnu++98 -D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=c++locale.lo -g -O2 -fimplicit-templates -c c++locale.cc  -fPIC -DPIC -D_GLIBCXX_SHARED -o c++locale.o
mv -f .deps/list_read.Tpo .deps/list_read.Plo
In file included from /home/fly/sh3/destdir.evbsh3/usr/include/evbsh3/ieeefp.h:3,
                 from /home/fly/sh3/destdir.evbsh3/usr/include/ieeefp.h:12,
                 from c++locale.cc:40:
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h: In function 'fp_except __FPE(int)':
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:62:13: error: 'FE_DIVBYZERO' was not declared in this scope
   62 |  if (__fe & FE_DIVBYZERO)
      |             ^~~~~~~~~~~~
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:64:13: error: 'FE_INEXACT' was not declared in this scope
   64 |  if (__fe & FE_INEXACT)
      |             ^~~~~~~~~~
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:66:13: error: 'FE_INVALID' was not declared in this scope; did you mean 'EINVAL'?
   66 |  if (__fe & FE_INVALID)
      |             ^~~~~~~~~~
      |             EINVAL
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:68:13: error: 'FE_OVERFLOW' was not declared in this scope; did you mean 'EOVERFLOW'?
   68 |  if (__fe & FE_OVERFLOW)
      |             ^~~~~~~~~~~
      |             EOVERFLOW
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:70:13: error: 'FE_UNDERFLOW' was not declared in this scope; did you mean 'UNDERFLOW'?
   70 |  if (__fe & FE_UNDERFLOW)
      |             ^~~~~~~~~~~~
      |             UNDERFLOW
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h: In function 'int __FEE(fp_except)':
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:81:11: error: 'FE_DIVBYZERO' was not declared in this scope
   81 |   __fe |= FE_DIVBYZERO;
      |           ^~~~~~~~~~~~
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:83:11: error: 'FE_INEXACT' was not declared in this scope
   83 |   __fe |= FE_INEXACT;
      |           ^~~~~~~~~~
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:85:11: error: 'FE_INVALID' was not declared in this scope; did you mean 'EINVAL'?
   85 |   __fe |= FE_INVALID;
      |           ^~~~~~~~~~
      |           EINVAL
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:87:11: error: 'FE_OVERFLOW' was not declared in this scope; did you mean 'EOVERFLOW'?
   87 |   __fe |= FE_OVERFLOW;
      |           ^~~~~~~~~~~
      |           EOVERFLOW
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:89:11: error: 'FE_UNDERFLOW' was not declared in this scope; did you mean 'UNDERFLOW'?
   89 |   __fe |= FE_UNDERFLOW;
      |           ^~~~~~~~~~~~
      |           UNDERFLOW
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h: In function 'fp_rnd __FPR(int)':
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:98:7: error: 'FE_TONEAREST' was not declared in this scope
   98 |  case FE_TONEAREST:
      |       ^~~~~~~~~~~~
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:100:7: error: 'FE_DOWNWARD' was not declared in this scope
  100 |  case FE_DOWNWARD:
      |       ^~~~~~~~~~~
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:102:7: error: 'FE_UPWARD' was not declared in this scope
  102 |  case FE_UPWARD:
      |       ^~~~~~~~~
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:104:7: error: 'FE_TOWARDZERO' was not declared in this scope
  104 |  case FE_TOWARDZERO:
      |       ^~~~~~~~~~~~~
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h: In function 'int __FER(fp_rnd)':
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:117:10: error: 'FE_TONEAREST' was not declared in this scope
  117 |   return FE_TONEAREST;
      |          ^~~~~~~~~~~~
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:119:10: error: 'FE_DOWNWARD' was not declared in this scope
  119 |   return FE_DOWNWARD;
      |          ^~~~~~~~~~~
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:121:10: error: 'FE_UPWARD' was not declared in this scope
  121 |   return FE_UPWARD;
      |          ^~~~~~~~~
/home/fly/sh3/destdir.evbsh3/usr/include/sh3/ieeefp.h:123:10: error: 'FE_TOWARDZERO' was not declared in this scope
  123 |   return FE_TOWARDZERO;
      |          ^~~~~~~~~~~~~


if everything was working well, this would be the chain of includes.
ieeefp.h
#include fenv.h ->
                   libstdc++ #2 fenv.h
                   #include_next fenv.h ->
                                           libstdc++ #1 fenv.h
                                           #include_next fenv.h ->
                                                                   system fenv.h


But instead, we get:
ieeefp.h
#include fenv.h ->
                   libstdc++ #2 fenv.h
                   #include_next fenv.h ->
                                           libstdc++ #1 fenv.h
                                           nothing
                                           (because it shares include guards with libstdc++ #2)


so system fenv.h is never reached.
Comment 1 coypu 2018-12-09 14:10:18 UTC
suggested change: put #include_next outside of include guards?
Comment 2 Jakub Jelinek 2018-12-10 10:57:03 UTC
What two fenv.h libstdc++ headers you mean (in what paths they are)?  While there is
include/tr1/fenv.h
include/c_compatibility/fenv.h
the former should be included only with <tr1/fenv.h>, not <fenv.h>.
Comment 3 coypu 2018-12-10 11:03:11 UTC
include/c_compatibility/fenv.h
Comment 4 Jakub Jelinek 2018-12-10 11:05:24 UTC
That is one header, not two, so why should that fenv.h's #include_next include that same header or some copy of that header in a different path?
Comment 5 coypu 2018-12-10 11:35:06 UTC
(In reply to Jakub Jelinek from comment #4)
> That is one header, not two, so why should that fenv.h's #include_next
> include that same header or some copy of that header in a different path?

I am in the process of building libstdc++.

-I/tmp/build/shle--netbsdelf/libstdc++-v3/include

there's a libstdc++ fenv.h there
Comment 6 Jonathan Wakely 2018-12-10 11:50:40 UTC
(In reply to coypu from comment #1)
> suggested change: put #include_next outside of include guards?

We did something similar for PR 69581
Comment 7 Andrew Pinski 2018-12-31 01:44:35 UTC
Normally after building the cross, I don't rebuild the target libraries as they were already built once before so I don't run into this issue.