Skip to content

Conversation

@corngood
Copy link
Contributor

@corngood corngood commented Dec 5, 2025

This fixes errors such as:

error: unknown type name ‘wint_t’

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@corngood corngood requested a review from Ericson2314 December 5, 2025 19:41
@corngood corngood mentioned this pull request Dec 5, 2025
13 tasks
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Dec 5, 2025
@Ericson2314
Copy link
Member

This feels to me like the wrong place to put this? At at least it exposes the absurdity of our GNU-autools-specific stdenv is.

@corngood
Copy link
Contributor Author

corngood commented Dec 5, 2025

Yeah, it's a hack. I can try to figure out where a real fix would go.

@Ericson2314
Copy link
Member

Perhaps in mkDerivation itself.

@corngood
Copy link
Contributor Author

corngood commented Dec 8, 2025

For reference, here is the failure in gnugrep configure:

configure:21635: checking for clean definition of __STDC_VERSION_STDDEF_H__
configure:21652: x86_64-pc-cygwin-gcc -std=gnu23 -E  conftest.c
conftest.c:148:20: warning: undefining "__STDC_VERSION_STDDEF_H__"
  148 |             #undef __STDC_VERSION_STDDEF_H__
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~
conftest.c:151:15: error: #error "<time.h> defines __STDC_VERSION_STDDEF_H__"
  151 |             # error "<time.h> defines __STDC_VERSION_STDDEF_H__"
      |               ^~~~~
configure:21652: $? = 1
configure: failed program was:
| /* confdefs.h */
[...]
| /* end confdefs.h.  */
| /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870 */
|             #include <stddef.h>
|             #undef __STDC_VERSION_STDDEF_H__
|             #include <time.h>
|             #ifdef __STDC_VERSION_STDDEF_H__
|             # error "<time.h> defines __STDC_VERSION_STDDEF_H__"
|             #endif
|
configure:21662: result: no

Edit: actually this happens on linux as well. I guess the stddef wrapper just doesn't work on cygwin. Investigating that now.

@corngood
Copy link
Contributor Author

corngood commented Dec 8, 2025

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870

In file included from /nix/store/06rxvqbpl4hzc5fnpjz8507raldygnbh-x86_64-pc-cygwin-gcc-14.3.0/x86_64-pc-cygwin/sys-include/sys/reent.h:16,
                 from /nix/store/06rxvqbpl4hzc5fnpjz8507raldygnbh-x86_64-pc-cygwin-gcc-14.3.0/x86_64-pc-cygwin/sys-include/stdio.h:60,
                 from ./stdio.h:55,
                 from argmatch.h:32,
                 from argmatch.c:25:
/nix/store/06rxvqbpl4hzc5fnpjz8507raldygnbh-x86_64-pc-cygwin-gcc-14.3.0/x86_64-pc-cygwin/sys-include/sys/_types.h:167:5: error: unknown type name ‘wint_t’
  167 |     wint_t __wch;
      |     ^~~~~~

I guess what happens is that the gnulib stddef.h wrapper disables __need_wint_t This happens on linux as well, so that if you add this to the end of a file:

#define __need_wint_t
#include <stddef.h>
wint_t foo;

The definition can't be found. The compile error above is because on cygwin sys/_types.h does something like this.

So I guess the <time.h> test was not a great way of detecting the original bug. It's actually been removed in latest gnulib in preparation for GCC 15, however it's been replaced with a check for GCC 13 or 14, so it wouldn't help here.

@corngood corngood marked this pull request as draft December 8, 2025 15:22
@corngood
Copy link
Contributor Author

corngood commented Dec 8, 2025

I made a PR to fix this in gnugrep: #469010

It may also be required in other projects, but I was able to rebuild nix without fixing anything else. Since it's dependent on the gnulib version, and likely to go away with GCC 15, I suppose we don't really need a global fix.

@corngood corngood marked this pull request as ready for review January 2, 2026 14:58
@corngood
Copy link
Contributor Author

corngood commented Jan 2, 2026

Since GCC 15 this problem now affects a lot of core gnu projects (iconv, gnupatch, gnugrep, etc).

It's fixed upstream in https://gitweb.git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=e529f4fbd08fa9e60c7092ba0f8cc976a735077c

Once that change rolls out, gl_cv_clean_version_stddef will no longer be used.

This feels to me like the wrong place to put this? At at least it exposes the absurdity of our GNU-autools-specific stdenv is.

I thought about this. It's really a libc problem with newlib-cygwin, but cc-wrapper is the place where libc is abstracted in terms of setup hooks.

@corngood corngood mentioned this pull request Jan 2, 2026
13 tasks
@corngood
Copy link
Contributor Author

@Ericson2314 This is one of the last things required for #475998. Any thoughts on my last comment?

Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This a hack, but it is also a temporary one. So I can live it with. Cygwin must ship! (And other platforms are not affected.

@Ericson2314 Ericson2314 added this pull request to the merge queue Jan 13, 2026
Merged via the queue into NixOS:master with commit 7578391 Jan 13, 2026
54 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants