From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Templeton Subject: bug#32767: glibc shadows gcc's C++ headers Date: Tue, 18 Sep 2018 20:32:17 -0400 Message-ID: <87efdquy26.fsf@terpri.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2RHi-0003GY-DL for bug-guix@gnu.org; Tue, 18 Sep 2018 21:28:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2RHf-0000yo-7O for bug-guix@gnu.org; Tue, 18 Sep 2018 21:28:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:40653) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g2RHe-0000yN-TN for bug-guix@gnu.org; Tue, 18 Sep 2018 21:28:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g2RHe-0002oM-L8 for bug-guix@gnu.org; Tue, 18 Sep 2018 21:28:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: 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 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 List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 32767@debbugs.gnu.org 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)))))))