Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Cannot build with flavour +werror and glibc 2.43
## Summary I'm currently unable to build with `+werror`. That's for various reasons, mostly fixed by !15746. But even on that branch, I get this error: ``` In file included from rts/sm/Storage.c:26:0: error: rts/include/rts/PosixSource.h:36:9: error: error: ‘_POSIX_C_SOURCE’ redefined [-Werror] 36 | #define _POSIX_C_SOURCE 200809L | ^~~~~~~~~~~~~~~ | 36 | #define _POSIX_C_SOURCE 200809L | ^ In file included from /usr/include/sys/mman.h:22, from rts/sm/Storage.c:23:0: error: /usr/include/features.h:319:10: error: note: this is the location of the previous definition 319 | # define _POSIX_C_SOURCE 202405L | ^~~~~~~~~~~~~~~ | 319 | # define _POSIX_C_SOURCE 202405L | ^ rts/include/rts/PosixSource.h:37:9: error: error: ‘_XOPEN_SOURCE’ redefined [-Werror] 37 | #define _XOPEN_SOURCE 700 | ^~~~~~~~~~~~~ | 37 | #define _XOPEN_SOURCE 700 | ^ /usr/include/features.h:234:10: error: note: this is the location of the previous definition 234 | # define _XOPEN_SOURCE 800 | ^~~~~~~~~~~~~ | 234 | # define _XOPEN_SOURCE 800 | ^ cc1: all warnings being treated as errors ``` /usr/include/features.h is provided by glibc, and the timing matches with "this started when I upgraded to glibc 2.43". It was released Jan 23, and I upgraded from 2.42 on Feb 19. In glibc 2.42, `_POSIX_C_SOURCE` and `_XOPEN_SOURCE` [are defined](https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=include/features.h;hb=refs/heads/release/2.42/master) with the same values as PosixSource.h gives them. In 2.43, they're [defined](https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=include/features.h;hb=refs/heads/release/2.43/master) with updated values. The gcc manual [confirms](https://gcc.gnu.org/onlinedocs/gcc-8.3.0/cpp/Undefining-and-Redefining-Macros.html) that we'd expect to get this warning iff PosixSource.h defines them with different values than glibc. I can fix the issue for myself by simply removing the definitions (the lines above are gated by `#if defined(solaris2_HOST_OS)`): ```diff diff --git a/rts/include/rts/PosixSource.h b/rts/include/rts/PosixSource.h index be6c8ecca1..1a89ac1c60 100644 --- a/rts/include/rts/PosixSource.h +++ b/rts/include/rts/PosixSource.h @@ -33,8 +33,6 @@ #define _POSIX_C_SOURCE 200112L #define _XOPEN_SOURCE 600 #else -#define _POSIX_C_SOURCE 200809L -#define _XOPEN_SOURCE 700 #endif #if defined(mingw32_HOST_OS) ``` But that's presumably not the right thing to do in general. I've opened !15763 which fixes it by adding `#undef`s, but I'm not sure if that's right either. ## Steps to reproduce With glibc 2.43, run ``` hadrian/build -j --flavour=default+werror ``` ## Expected behavior This should succeed. ## Environment * GHC version used: 9.10.1 * Operating System: Arch linux, kernel 6.18.9 * Glibc version 2.43
issue