Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build on GCC 13 #6

Merged
merged 1 commit into from
Feb 4, 2024
Merged

Conversation

mfrischknecht
Copy link
Contributor

GCC 13 stopped transitively including cstdint in a couple of scenarios 1, which leads to build failures akin to:

[ 25%] Building CXX object src/general/CMakeFiles/General.dir/file.cpp.o
In file included from /build/source/src/general/file.cpp:1:
/build/source/src/general/file.h:10:27: error: 'uint8_t' was not declared in this scope
   10 | void readFile(std::vector<uint8_t> &res, const char *fname,
      |                           ^~~~~~~
/build/source/src/general/file.h:8:1: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
    7 | #include "error.h"
  +++ |+#include <cstdint>
    8 |

As an example of this issue in the wild, see this Nixpkgs CI failure:
Build: https://hydra.nixos.org/build/246246828
Build log: https://hydra.nixos.org/build/246246828/nixlog/1

This change includes cstdint in general/file.h and general/filelist.h, fixing the build on current GCC versions.

Footnotes

  1. https://www.gnu.org/software/gcc/gcc-13/porting_to.html#header-dep-changes

GCC 13 stopped transitively including `cstdint` in a couple of
scenarios [1], which leads to build failures akin to:

```
[ 25%] Building CXX object src/general/CMakeFiles/General.dir/file.cpp.o
In file included from /build/source/src/general/file.cpp:1:
/build/source/src/general/file.h:10:27: error: 'uint8_t' was not declared in this scope
   10 | void readFile(std::vector<uint8_t> &res, const char *fname,
      |                           ^~~~~~~
/build/source/src/general/file.h:8:1: note: 'uint8_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
    7 | #include "error.h"
  +++ |+#include <cstdint>
    8 |
```

[1]: https://www.gnu.org/software/gcc/gcc-13/porting_to.html#header-dep-changes
mfrischknecht added a commit to mfrischknecht/nixpkgs that referenced this pull request Jan 25, 2024
`grip-search` stopped building on GCC13 due to the standard
`cstdint` header not getting transitively included through
other standard headers anymore.

This change pulls in a patch from an open upstream PR [1]
that adds the necessary includes.

Since the current `substituteInPlace` patch that to the
built-in version string was overriding the `patches`
phase (preventing a simple declarative listing of patches
to be applied), I moved it to the `postPatch` hook instead.

[1]: sc0ty/grip#6
@sc0ty sc0ty merged commit 2d392a2 into sc0ty:master Feb 4, 2024
@sc0ty
Copy link
Owner

sc0ty commented Feb 4, 2024

Thanks for the fix

kylechui pushed a commit to kylechui/nixpkgs that referenced this pull request Feb 10, 2024
`grip-search` stopped building on GCC13 due to the standard
`cstdint` header not getting transitively included through
other standard headers anymore.

This change pulls in a patch from an open upstream PR [1]
that adds the necessary includes.

Since the current `substituteInPlace` patch that to the
built-in version string was overriding the `patches`
phase (preventing a simple declarative listing of patches
to be applied), I moved it to the `postPatch` hook instead.

[1]: sc0ty/grip#6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants