GNU bug report logs -
#32767
glibc shadows gcc's C++ headers
Previous Next
Reported by: Robin Templeton <robin <at> igalia.com>
Date: Wed, 19 Sep 2018 01:28:02 UTC
Severity: normal
Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32767 in the body.
You can then email your comments to 32767 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guix <at> gnu.org
:
bug#32767
; Package
guix
.
(Wed, 19 Sep 2018 01:28:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Robin Templeton <robin <at> igalia.com>
:
New bug report received and forwarded. Copy sent to
bug-guix <at> gnu.org
.
(Wed, 19 Sep 2018 01:28:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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 <math.h>
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)))))))
Reply sent
to
Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
:
You have taken responsibility.
(Tue, 09 Mar 2021 21:36:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Robin Templeton <robin <at> igalia.com>
:
bug acknowledged by developer.
(Tue, 09 Mar 2021 21:36:01 GMT)
Full text and
rfc822 format available.
Message #10 received at 32767-done <at> debbugs.gnu.org (full text, mbox):
Hello,
Robin Templeton <robin <at> igalia.com> 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 <math.h>
> 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
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 07 Apr 2021 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 356 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.