From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 18 21:28:00 2018 Received: (at submit) by debbugs.gnu.org; 19 Sep 2018 01:28:00 +0000 Received: from localhost ([127.0.0.1]:44911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g2RHb-0002o4-TV for submit@debbugs.gnu.org; Tue, 18 Sep 2018 21:28:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g2QSS-0001Y7-0n for submit@debbugs.gnu.org; Tue, 18 Sep 2018 20:35:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2QSL-0008D2-W9 for submit@debbugs.gnu.org; Tue, 18 Sep 2018 20:35:02 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:36658) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g2QSL-0008BM-Sh for submit@debbugs.gnu.org; Tue, 18 Sep 2018 20:35:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2QSL-0002eP-39 for bug-guix@gnu.org; Tue, 18 Sep 2018 20:35:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2QSH-0007uU-Sq for bug-guix@gnu.org; Tue, 18 Sep 2018 20:35:01 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:40413) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g2QSH-0007Oc-G9 for bug-guix@gnu.org; Tue, 18 Sep 2018 20:34:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=64+AdsZcAVwBgP4sX8Cyea2qkElx5AWN7zxjG9tU6Us=; b=mCJKyoj1WOzl6A3xcEBovtvkiESGEqsYspQkvF+xSffX0LCp8bKM3bmzJappZu1Vfv5YmYEi3aSaiK61z22kGyEndGJKMwFURI9wby+QPJbElp5jz7bUQ9i0LD8F8xoKaxVfatxLXvt9VoaNvotNkzlc9P95v4aMijV1CmBEGApcRS4eGjlnVprh4IoB6u+8WLgMJdlwDhNxuOadXamOn/Biy3NU1KpVGlXYUSezYkC6mC1Qn6FCJSc0z/0Y+/bdjapT+KEgTZgI8v4RSICcBD9rmsSTnYeCq1CjZDAyLdcpmnDc3o40xSiPvsxJJOeY45C6HWfZUDEv1082uhtOLA==; Received: from cpe-98-27-52-219.nc.res.rr.com ([98.27.52.219] helo=cervus) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1g2QRd-0008WD-3K for ; Wed, 19 Sep 2018 02:34:17 +0200 From: Robin Templeton To: bug-guix@gnu.org Subject: glibc shadows gcc's C++ headers Date: Tue, 18 Sep 2018 20:32:17 -0400 Message-ID: <87efdquy26.fsf@terpri.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Tue, 18 Sep 2018 21:27:59 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.3 (-----) When compiling C++ programs, glibc's include directory takes precedence over gcc's for standard C headers like math.h, but glibc's headers aren't completely compatible with C++. For example, isnan from math.h is supposed to be a function, but glibc defines it as a macro. This program demonstrates the problem: #include int main(void) { int isnan(0); return isnan; } It works as expected when gcc's built-in C++ headers are used, but not if glibc is installed: % guix environment --pure --ad-hoc gcc -- g++ -E isnan.cpp | tail -n1 int main (void) { int isnan (0); return isnan; } % guix environment --pure --ad-hoc gcc glibc -- g++ -E isnan.cpp | tail -n1 int main (void) { int __builtin_isnan (0); return isnan; } As a temporary workaround, I'm using the following package as a replacement for glibc, to keep the glibc headers out of $CPATH. If it's installed along with gcc, ld-wrapper and binutils, the test program compiles without errors. (use-modules (guix) (gnu)) (use-package-modules base) (package (inherit glibc) (name "my-glibc") (arguments (substitute-keyword-arguments (package-arguments glibc) ((#:phases phases) `(modify-phases ,phases (add-after 'install 'move-include (lambda _ (rename-file (string-append %output "/include") (string-append %output "/include-glibc")) #t))))))) From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 09 16:35:28 2021 Received: (at 32767-done) by debbugs.gnu.org; 9 Mar 2021 21:35:28 +0000 Received: from localhost ([127.0.0.1]:48133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJk0m-0008T9-CU for submit@debbugs.gnu.org; Tue, 09 Mar 2021 16:35:28 -0500 Received: from mail-qt1-f178.google.com ([209.85.160.178]:42643) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lJk0k-0008Sw-Q9 for 32767-done@debbugs.gnu.org; Tue, 09 Mar 2021 16:35:27 -0500 Received: by mail-qt1-f178.google.com with SMTP id d11so11424257qtx.9 for <32767-done@debbugs.gnu.org>; Tue, 09 Mar 2021 13:35:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=3y17KXTnlzbUQDbtDd5I4KARZ5g8fMIu8hhGAf18D60=; b=XY37aDNYqITlf1ycAjBVwjofPTwXRBjjJ9MLqIdL/vsOwSmwPiMQYuQaeMMpUE3/3s QpOskR3WtaacMhqXcBe+KjMOLWjltYt0lzu/4d2lsX1EVSfsK6sm352NRIKEJIl76+dc WqZdgeWrTjHB8e+TGz1zCwrkmCEwKyE2iSRjdnyJMeUAhT/Wm38Ud9cDW4n3XPKGzT6H Ftpd6hjlTCacQuFOFjgmOyUnzBF2yAMeVjmJDi2hwcgr8DDdq3mMXKtS/p9NKIyxzKEC rm+ZBEcyGsLfbgnywy4kcIED1IzYLEHvf7ogZRAGKcEAyaTqnyzYO4KrhR3wN3LlJWoU W0Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=3y17KXTnlzbUQDbtDd5I4KARZ5g8fMIu8hhGAf18D60=; b=qHnYazU4i3lpaXhlpu699o89NPgxNbjXedEAHpkmPnpiBzGAYvtKqSDAKUtvOqZwV4 D8oXdgu9f8fyONHGOjWWF3+CbUCcHAmnWA3k6dY5cQ0Is+K5R41qI5gkVChnKoUx84n4 Dn+lcm8/fIZ07HAJmJCTe1fr+E4+poaohp/YaBiRDOvD+n3MWR581Q2d/YzbA4kuwkeb oci+8vOOx5DcUlIVkgyIq//EKLx6iAlNym7HQszmGeFZJHjKjMTDrburhdJBEUypiH9D IM6nNMGzP3B+mmW8Y2GOrl0oqhxHdle8fD2Hc/iNJ0erTNjCIF7OkoKdmC/XL/EHRLVB IsoQ== X-Gm-Message-State: AOAM533Vt278Us8l6tn2O/gDhgini3oddX8lkPFbsWZlPxG4EL0yv72E KjRxK4vdiba+QXlFI7qryZeIu6a46tFNjg== X-Google-Smtp-Source: ABdhPJyQ5YVwC7d6aETiz1/V2ygEn7IWgkPPWWT3k6aOZCIjkHYZnfPhayKrRzL28ujAkedWnTv+DQ== X-Received: by 2002:ac8:5912:: with SMTP id 18mr50928qty.18.1615325720962; Tue, 09 Mar 2021 13:35:20 -0800 (PST) Received: from hurd (dsl-205-233-125-67.b2b2c.ca. [205.233.125.67]) by smtp.gmail.com with ESMTPSA id c5sm11230126qkl.21.2021.03.09.13.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Mar 2021 13:35:20 -0800 (PST) From: Maxim Cournoyer To: Robin Templeton Subject: Re: bug#32767: glibc shadows gcc's C++ headers References: <87efdquy26.fsf@terpri.org> Date: Tue, 09 Mar 2021 16:35:19 -0500 In-Reply-To: <87efdquy26.fsf@terpri.org> (Robin Templeton's message of "Tue, 18 Sep 2018 20:32:17 -0400") Message-ID: <87h7lkui20.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 32767-done Cc: 32767-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Robin Templeton writes: > When compiling C++ programs, glibc's include directory takes precedence > over gcc's for standard C headers like math.h, but glibc's headers > aren't completely compatible with C++. For example, isnan from math.h is > supposed to be a function, but glibc defines it as a macro. > > This program demonstrates the problem: > > #include > int main(void) { int isnan(0); return isnan; } > > It works as expected when gcc's built-in C++ headers are used, but not > if glibc is installed: > > % guix environment --pure --ad-hoc gcc -- g++ -E isnan.cpp | tail -n1 > int main (void) { int isnan (0); return isnan; } > % guix environment --pure --ad-hoc gcc glibc -- g++ -E isnan.cpp | tail -n1 > int main (void) { int __builtin_isnan (0); return isnan; } > > As a temporary workaround, I'm using the following package as a > replacement for glibc, to keep the glibc headers out of $CPATH. If it's > installed along with gcc, ld-wrapper and binutils, the test program > compiles without errors. > > (use-modules (guix) (gnu)) > (use-package-modules base) > (package > (inherit glibc) > (name "my-glibc") > (arguments > (substitute-keyword-arguments (package-arguments glibc) > ((#:phases phases) > `(modify-phases ,phases > (add-after 'install 'move-include > (lambda _ > (rename-file (string-append %output "/include") > (string-append %output "/include-glibc")) > #t))))))) Thanks for the report. Nowadays the recommended way to install the GCC-based toolchain is to use the 'gcc-toolchain' package. The 'gcc' package is now even made hidden in Guix, which doesn't seem to have this particular issue: $ guix environment --pure --ad-hoc gcc-toolchain -- g++ -E /tmp/isnan.cpp | tail -n1 int main(void) { int isnan(0); return isnan; } $ guix environment --pure --ad-hoc gcc-toolchain glibc -- g++ -E /tmp/isnan.cpp | tail -n1 int main(void) { int isnan(0); return isnan; } I'm closing this issue, but feel free to open a fresh one if you still encounter problems. Thank you, Maxim From unknown Sat Jun 21 10:27:53 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 07 Apr 2021 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator