Bug 69413 - [6 Regression] r232327 prevents libstdc++ working after upgrading glibc to 2.23
Summary: [6 Regression] r232327 prevents libstdc++ working after upgrading glibc to 2.23
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-21 13:00 UTC by Jonathan Wakely
Modified: 2016-01-22 14:28 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
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 Jonathan Wakely 2016-01-21 13:00:09 UTC
The fixes for PR 48891 require libstdc++ to be rebuilt after upgrading glibc to current trunk (which will be 2.23), because the configure-time checks for isinf and isnan give the wrong answer for the new glibc.

There needs to be a compile-time check so that rebuilding gcc isn't needed (or glibc needs to define a macro telling us the isinf and isnan declarations have been suppressed).
Comment 1 Jonathan Wakely 2016-01-22 12:47:58 UTC
Author: redi
Date: Fri Jan 22 12:47:26 2016
New Revision: 232726

URL: https://gcc.gnu.org/viewcvs?rev=232726&root=gcc&view=rev
Log:
Allow _GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN to be overridden

	PR libstdc++/69413
	* config/os/gnu-linux/os_defines.h: Define
	_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC.
	* include/c_global/cmath (isinf, isnan): Check it.
	* doc/xml/manual/internals.xml: Document it.
	* doc/html/*: Regenerate.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/config/os/gnu-linux/os_defines.h
    trunk/libstdc++-v3/doc/html/manual/internals.html
    trunk/libstdc++-v3/doc/xml/manual/internals.xml
    trunk/libstdc++-v3/include/c_global/cmath
Comment 2 Jonathan Wakely 2016-01-22 12:56:16 UTC
GCC 6 will now work if it is built against glibc <= 2.22 and then glibc is upgraded to >= 2.23

Using recent glibc 2.22 snapshots from git still requires rebuilding libstdc++.

Specifically, if you build GCC against glibc before https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d9b965fa56350d6eea9f7f438a0714c7ffbb183f and then update glibc to a snapshot of 2.22 from git master after that commit, libstdc++ will not work. In that case glibc still reports itself as 2.22 and libstdc++ won't detect that the isinf and isnan declarations are gone, so must be reconfigured and rebuilt against the new glibc headers.

When glibc releases 2.23 it weill be possible to upgrade to that without rebuilding libstdc++, because the version bump will tell libstdc++ the functions are gone.
Comment 3 Dominik Vogt 2016-01-22 13:53:54 UTC
So, what is the proper way to compile

  -- snip --
  #include <math.h>
  -- snip --

using a current Gcc compiled with an old system Glibc so that the program uses a new (not installed) Glibc?  The hack I tried earlier still does not work:

$ g++ -std=c++11 x.C -v \
  --sysroot ~/src/git/glibc/install \
  -idirafter ~/src/git/glibc/install/usr/include \
  -idirafter /usr/local/include \
  -idirafter /usr/include

...
ignoring nonexistent directory "~/src/git/glibc/install/usr/local/include"
ignoring nonexistent directory "~/src/git/gcc/install/lib/gcc/s390x-ibm-linux-gnu/6.0.0/../../../../s390x-ibm-linux-gnu/include"
ignoring duplicate directory "~/src/git/glibc/install/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 ~/src/git/gcc/install/lib/gcc/s390x-ibm-linux-gnu/6.0.0/../../../../include/c++/6.0.0
 ~/src/git/gcc/install/lib/gcc/s390x-ibm-linux-gnu/6.0.0/../../../../include/c++/6.0.0/s390x-ibm-linux-gnu
 ~/src/git/gcc/install/lib/gcc/s390x-ibm-linux-gnu/6.0.0/../../../../include/c++/6.0.0/backward
 ~/src/git/gcc/install/lib/gcc/s390x-ibm-linux-gnu/6.0.0/include
 ~/src/git/gcc/install/include
 ~/src/git/gcc/install/lib/gcc/s390x-ibm-linux-gnu/6.0.0/include-fixed
 ~/src/git/glibc/install/usr/include
 /usr/local/include
 /usr/include
End of search list.
 of search list.
...
Comment 4 Jonathan Wakely 2016-01-22 14:28:16 UTC
(In reply to Dominik Vogt from comment #3)
> So, what is the proper way to compile
> 
>   -- snip --
>   #include <math.h>
>   -- snip --
> 
> using a current Gcc compiled with an old system Glibc so that the program
> uses a new (not installed) Glibc? 

You can't, that's not supported.

As I said, if you want to use glibc 2.22 headers from after the mentioned commit, libstdc++ must be built with those same headers.

I thought this was fairly explicit:

(In reply to Jonathan Wakely from comment #2)
> Specifically, if you build GCC against glibc before
> https://sourceware.org/git/gitweb.cgi?p=glibc.git;
> h=d9b965fa56350d6eea9f7f438a0714c7ffbb183f and then update glibc to a
> snapshot of 2.22 from git master after that commit, libstdc++ will not work.
> In that case glibc still reports itself as 2.22 and libstdc++ won't detect
> that the isinf and isnan declarations are gone, so must be reconfigured and
> rebuilt against the new glibc headers.


As a quick hack you can bump the value of __GLIBC_MINOR__ in ~/src/git/glibc/install/usr/include/features.h to make it appear to be glibc 2.23, but obviously that isn't supported either.