Skip to content

Commit 7c47cca

Browse files
committed
Update notes for glibc include path ordering errors
1 parent 2812a31 commit 7c47cca

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Notes.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,33 @@ Looks like it's c++, then toolchain, then c headers...
6969
/usr/include/x86_64-linux-gnu
7070
/usr/include
7171
```
72+
73+
### glibc include path ordering errors
74+
75+
glibc really cares about the toolchain headers being above the glibc headers.
76+
otherwise, you'll get errors complaining about not finding `size_t`.
77+
note the incorrect include path ordering:
78+
79+
```
80+
#include <...> search starts here:
81+
external/toolchains_cc++_repo_rules+glibc-2.27-linux-x86_64/include
82+
external/toolchains_cc++_repo_rules+llvm-19.1.7-linux-x86_64/include
83+
End of search list.
84+
In file included from main.c:1:
85+
In file included from external/toolchains_cc++_repo_rules+glibc-2.27-linux-x86_64/include/stdio.h:41:
86+
external/toolchains_cc++_repo_rules+glibc-2.27-linux-x86_64/include/bits/libio.h:306:3: error: unknown type name 'size_t'
87+
306 | size_t __pad5;
88+
| ^
89+
external/toolchains_cc++_repo_rules+glibc-2.27-linux-x86_64/include/bits/libio.h:309:67: error: use of undeclared identifier 'size_t'; did you mean 'sizeof'?
90+
309 | char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
91+
| ^
92+
external/toolchains_cc++_repo_rules+glibc-2.27-linux-x86_64/include/bits/libio.h:309:66: error: reference to overloaded function could not be resolved; did you mean to call it?
93+
309 | char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
94+
| ^~~~~~~~
95+
external/toolchains_cc++_repo_rules+glibc-2.27-linux-x86_64/include/bits/libio.h:337:62: error: unknown type name 'size_t'
96+
337 | typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
97+
| ^
98+
external/toolchains_cc++_repo_rules+glibc-2.27-linux-x86_64/include/bits/libio.h:346:6: error: unknown type name 'size_t'
99+
346 | size_t __n);
100+
| ^
101+
```

0 commit comments

Comments
 (0)