From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WI34EpwJF1+5DwAA0tVLHw (envelope-from ) for ; Tue, 21 Jul 2020 15:28:28 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id uP+nDpwJF1/yFQAAbx9fmQ (envelope-from ) for ; Tue, 21 Jul 2020 15:28:28 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9A88F9403A0 for ; Tue, 21 Jul 2020 15:28:27 +0000 (UTC) Received: from localhost ([::1]:36604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jxuBt-0000hh-0Z for larch@yhetil.org; Tue, 21 Jul 2020 11:28:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jxuBW-0000gj-SL for bug-guix@gnu.org; Tue, 21 Jul 2020 11:28:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56752) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jxuBW-00069x-HH for bug-guix@gnu.org; Tue, 21 Jul 2020 11:28:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jxuBW-00012f-EB for bug-guix@gnu.org; Tue, 21 Jul 2020 11:28:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#42392: GCC includes ordering issue? g++: error: 'round' is not a member of 'std' Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 21 Jul 2020 15:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42392 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: maxim.cournoyer@gmail.com Received: via spool by 42392-submit@debbugs.gnu.org id=B42392.15953452583973 (code B ref 42392); Tue, 21 Jul 2020 15:28:02 +0000 Received: (at 42392) by debbugs.gnu.org; 21 Jul 2020 15:27:38 +0000 Received: from localhost ([127.0.0.1]:40065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jxuB7-000121-T7 for submit@debbugs.gnu.org; Tue, 21 Jul 2020 11:27:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59164) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jxuB2-00011k-R4 for 42392@debbugs.gnu.org; Tue, 21 Jul 2020 11:27:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58330) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jxuAx-00068q-J8; Tue, 21 Jul 2020 11:27:27 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=36700 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jxuAw-00074A-8M; Tue, 21 Jul 2020 11:27:26 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87imenk1ps.fsf@hurd.i-did-not-set--mail-host-address--so-tickle-me> Date: Tue, 21 Jul 2020 17:27:22 +0200 In-Reply-To: <87imenk1ps.fsf@hurd.i-did-not-set--mail-host-address--so-tickle-me> (maxim cournoyer's message of "Thu, 16 Jul 2020 09:51:11 -0400") Message-ID: <87imegoplx.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 42392@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 0.49 X-TUID: h/PskhglD4vR --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, maxim.cournoyer@gmail.com skribis: > The following C++ snippet file reproduces it: > > // file: test.cpp > > #include > #include > > > int main() { > float x =3D 9.999; > > std::cout << "rounding value: " << x << " --> " << std::round(x); > > return 0; > } > > // build with: > // g++ -o test.o -std=3Dc++17 test.cpp > > > It affects only GCC 8 and newer, GCC 7 is fine. The available "round" > seems to be the one originating from tgmath.h (implementation detail of > math.h AFAICT). > > The std::round function is conditionally defined in the C++ standard > (since C++11) in the cmath header. It is supposed to also #undef the > global "round" macro, but it doesn't, or perhaps the ordering of the > includes is wrong and math.h gets included following cmath. > > In cmath, macros such as 'round' are undefined based on some > conditions. These conditions appear to be: > > __cplusplus >=3D 201103L and _GLIBCXX_USE_C99_MATH_TR1 and not _GLIBCXX_N= O_C99_ROUNDING_FUNCS See also , which suggests rather a misconfiguration issue. Comparing =E2=80=98c++config.h=E2=80=99 from GCC=C2=A07 (which works) and G= CC=C2=A08 (the first one that exhibits this problem), we see: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff -ubBr --show-c-function /gnu/store/93z2pmmpla1n47q3xivqyic4mwvy0r5q-gcc-toolchain-8.4.0/include/c\+\+/x86_64-unknown-linux-gnu/bits/c\+\+config.h /gnu/store/xa45bzcbib4zqa7gk70nb35dzzwyr376-gcc-toolchain-7.5.0/include/c\+\+/x86_64-unknown-linux-gnu/bits/c\+\+config.h --- /gnu/store/xa45bzcbib4zqa7gk70nb35dzzwyr376-gcc-toolchain-7.5.0/include/c++/x86_64-unknown-linux-gnu/bits/c++config.h 1970-01-01 01:00:01.000000000 +0100 +++ /gnu/store/93z2pmmpla1n47q3xivqyic4mwvy0r5q-gcc-toolchain-8.4.0/include/c++/x86_64-unknown-linux-gnu/bits/c++config.h 1970-01-01 01:00:01.000000000 +0100 [...] @@ -644,61 +619,61 @@ /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `acosf' function. */ -#define _GLIBCXX_HAVE_ACOSF 1 +/* #undef _GLIBCXX_HAVE_ACOSF */ /* Define to 1 if you have the `acosl' function. */ -#define _GLIBCXX_HAVE_ACOSL 1 +/* #undef _GLIBCXX_HAVE_ACOSL */ /* Define to 1 if you have the `aligned_alloc' function. */ #define _GLIBCXX_HAVE_ALIGNED_ALLOC 1 /* Define to 1 if you have the `asinf' function. */ -#define _GLIBCXX_HAVE_ASINF 1 +/* #undef _GLIBCXX_HAVE_ASINF */ /* Define to 1 if you have the `asinl' function. */ -#define _GLIBCXX_HAVE_ASINL 1 +/* #undef _GLIBCXX_HAVE_ASINL */ /* Define to 1 if the target assembler supports .symver directive. */ #define _GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE 1 /* Define to 1 if you have the `atan2f' function. */ -#define _GLIBCXX_HAVE_ATAN2F 1 +/* #undef _GLIBCXX_HAVE_ATAN2F */ /* Define to 1 if you have the `atan2l' function. */ -#define _GLIBCXX_HAVE_ATAN2L 1 +/* #undef _GLIBCXX_HAVE_ATAN2L */ /* Define to 1 if you have the `atanf' function. */ -#define _GLIBCXX_HAVE_ATANF 1 +/* #undef _GLIBCXX_HAVE_ATANF */ /* Define to 1 if you have the `atanl' function. */ -#define _GLIBCXX_HAVE_ATANL 1 +/* #undef _GLIBCXX_HAVE_ATANL */ /* Define to 1 if you have the `at_quick_exit' function. */ -#define _GLIBCXX_HAVE_AT_QUICK_EXIT 1 +/* #undef _GLIBCXX_HAVE_AT_QUICK_EXIT */ /* Define to 1 if the target assembler supports thread-local storage. */ /* #undef _GLIBCXX_HAVE_CC_TLS */ /* Define to 1 if you have the `ceilf' function. */ -#define _GLIBCXX_HAVE_CEILF 1 +/* #undef _GLIBCXX_HAVE_CEILF */ /* Define to 1 if you have the `ceill' function. */ -#define _GLIBCXX_HAVE_CEILL 1 +/* #undef _GLIBCXX_HAVE_CEILL */ /* Define to 1 if you have the header file. */ -#define _GLIBCXX_HAVE_COMPLEX_H 1 +/* #undef _GLIBCXX_HAVE_COMPLEX_H */ /* Define to 1 if you have the `cosf' function. */ -#define _GLIBCXX_HAVE_COSF 1 +/* #undef _GLIBCXX_HAVE_COSF */ /* Define to 1 if you have the `coshf' function. */ -#define _GLIBCXX_HAVE_COSHF 1 +/* #undef _GLIBCXX_HAVE_COSHF */ /* Define to 1 if you have the `coshl' function. */ -#define _GLIBCXX_HAVE_COSHL 1 +/* #undef _GLIBCXX_HAVE_COSHL */ /* Define to 1 if you have the `cosl' function. */ -#define _GLIBCXX_HAVE_COSL 1 +/* #undef _GLIBCXX_HAVE_COSL */ /* Define to 1 if you have the header file. */ #define _GLIBCXX_HAVE_DIRENT_H 1 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable /tmp/guix-build-gcc-10.1.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstd= c++-v3/config.log reads this: --8<---------------cut here---------------start------------->8--- configure:19924: checking for float trig functions configure:19948: /tmp/guix-build-gcc-10.1.0.drv-0/build/./gcc/xgcc -shared= -libgcc -B/tmp/guix-build-gcc-10.1.0.drv-0/build/./gcc -nostdinc++ -L/tmp/g= uix-build-gcc-10.1.0.drv-0/build/x86_64-unknown-linux-gnu/libstdc++-v3/src = -L/tmp/guix-build-gcc-10.1.0.drv-0/build/x86_64-unknown-linux-gnu/libstdc++= -v3/src/.libs -L/tmp/guix-build-gcc-10.1.0.drv-0/build/x86_64-unknown-linux= -gnu/libstdc++-v3/libsupc++/.libs -B/gnu/store/jrzxs91zhpf6yr5fxisn3jjj7xai= 8zlk-gcc-10.1.0/x86_64-unknown-linux-gnu/bin/ -B/gnu/store/jrzxs91zhpf6yr5f= xisn3jjj7xai8zlk-gcc-10.1.0/x86_64-unknown-linux-gnu/lib/ -isystem /gnu/sto= re/jrzxs91zhpf6yr5fxisn3jjj7xai8zlk-gcc-10.1.0/x86_64-unknown-linux-gnu/inc= lude -isystem /gnu/store/jrzxs91zhpf6yr5fxisn3jjj7xai8zlk-gcc-10.1.0/x86_64= -unknown-linux-gnu/sys-include -fno-checking -c -fno-builtin -D_GNU_SOURC= E conftest.cpp >&5 In file included from /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0= /include/c++/math.h:36, from conftest.cpp:122: /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/include/c++/cmath:41:= 10: fatal error: bits/c++config.h: No such file or directory 41 | #include | ^~~~~~~~~~~~~~~~~~ compilation terminated. configure:19948: $? =3D 1 configure: failed program was: [...] | /* end confdefs.h. */ | #include | int | main () | { | acosf (0); asinf (0); atanf (0); cosf (0); sinf (0); tanf (0); coshf (0);= sinhf (0); tanhf (0); | ; | return 0; | } configure:19962: result: no --8<---------------cut here---------------end--------------->8--- At this point, we have: --8<---------------cut here---------------start------------->8--- export CPLUS_INCLUDE_PATH=3D\ "/gnu/store/61pv34q6kad3cii1pngyairvxbxgdm1n-isl-0.22.1/include\ :/gnu/store/35afkywncrr5xsb4cxcljf6rpjcb7f61-gmp-6.2.0/include\ :/gnu/store/5jf395qa3v4amdi60850rz2a15zlsrza-mpfr-4.0.2/include\ :/gnu/store/lgrnkwh7w5yawgqaglwj1pls5vwz1nz7-mpc-1.1.0/include\ :/gnu/store/243algr6h60j46spn5dqhjc4mhkd0a0p-libelf-0.8.13/include\ :/gnu/store/rykm237xkmq7rl1p0nwass01p090p88x-zlib-1.2.11/include\ :/gnu/store/i8h2pcxqdq07ijm3ibkka8f4smn1w48v-bzip2-1.0.8/include\ :/gnu/store/9860f1abqj8wjjnwl8a9v54pdcc3bhgf-xz-5.2.4/include\ :/gnu/store/60g7r3l01fd7c58yjbm6krgcwj1jkpwg-file-5.38/include\ :/gnu/store/swqdvwri9dbv6zssg6v0by7l05hd6wxp-gawk-5.0.1/include\ :/gnu/store/hm40bxnv8jxmbc1lpb7zfimii4xm9m81-make-4.3/include\ :/gnu/store/m1z7cdbqsqyp9xnjw5cvlb4a7gkcg3m4-binutils-2.34/include\ :/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/include/c++\ :/gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/include\ :/gnu/store/fa6wj5bxkj5ll1d7292a70knmyl7a0cr-glibc-2.31/include\ :/gnu/store/gfapkk5c6hvl1d94m4sqnhn7f9l5gqyh-linux-libre-headers-5.4.20/inc= lude" --8<---------------cut here---------------end--------------->8--- but is in a directory not listed here: --8<---------------cut here---------------start------------->8--- $ find /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0 -name c++confi= g.h /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/include/c++/x86_64-un= known-linux-gnu/bits/c++config.h --8<---------------cut here---------------end--------------->8--- =E2=80=98gcc-final=E2=80=99 doesn=E2=80=99t have this problem because it de= pends on =E2=80=98libstdc++=E2=80=99 (separate package) where: --8<---------------cut here---------------start------------->8--- $ find /gnu/store/v507xkc5flnzqa49yp41w5y611p4lqbg-libstdc++-7.5.0 -name c+= +config.h /gnu/store/v507xkc5flnzqa49yp41w5y611p4lqbg-libstdc++-7.5.0/include/bits/c+= +config.h --8<---------------cut here---------------end--------------->8--- So somehow the problems seems to be that =E2=80=98xgcc=E2=80=99 doesn=E2=80= =99t search =E2=80=98gcc-7.5.0/include/c++/x86_64-unknown-linux-gnu=E2=80=99. We could= add it to CPLUS_INCLUDE_PATH manually, but it seems to me we=E2=80=99re missing somet= hing. Thoughts? Thanks, Ludo=E2=80=99. --=-=-=--