[compiler-rt] error: member access into incomplete type 'struct stat64' (LFS, 32bit musl)
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Compiling on 32-bit `musl` fails with errors:
```shell
[1816/3173] Building CXX object compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.arm.dir/sanitizer_linux.cpp.o
FAILED: [code=1] compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.arm.dir/sanitizer_linux.cpp.o
/home/pepper/dev/ghrepos/llvm-project/build/bin/clang++ --target=armv7a-unknown-linux-musleabihf --sysroot=/ -DHAVE_RPC_XDR_H=0 -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_GLIBCXX_ASSERTIONS -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/.. -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Xclang -fno-pch-timestamp -Wall -Wno-unused-parameter -O3 -DNDEBUG -std=c++17 -march=armv7-a -mfloat-abi=soft -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -ftrivial-auto-var-init=pattern -nostdinc++ -Wno-format -fno-rtti -Wframe-larger-than=570 -Wglobal-constructors -MD -MT compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.arm.dir/sanitizer_linux.cpp.o -MF compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.arm.dir/sanitizer_linux.cpp.o.d -o compiler-rt/lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.arm.dir/sanitizer_linux.cpp.o -c /home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:364:19: error: member access into incomplete type 'struct stat64'
364 | out->st_dev = in->st_dev;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:365:19: error: member access into incomplete type 'struct stat64'
365 | out->st_ino = in->st_ino;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:366:20: error: member access into incomplete type 'struct stat64'
366 | out->st_mode = in->st_mode;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:367:21: error: member access into incomplete type 'struct stat64'
367 | out->st_nlink = in->st_nlink;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:368:19: error: member access into incomplete type 'struct stat64'
368 | out->st_uid = in->st_uid;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:369:19: error: member access into incomplete type 'struct stat64'
369 | out->st_gid = in->st_gid;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:370:20: error: member access into incomplete type 'struct stat64'
370 | out->st_rdev = in->st_rdev;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:371:20: error: member access into incomplete type 'struct stat64'
371 | out->st_size = in->st_size;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:372:23: error: member access into incomplete type 'struct stat64'
372 | out->st_blksize = in->st_blksize;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:373:22: error: member access into incomplete type 'struct stat64'
373 | out->st_blocks = in->st_blocks;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:374:21: error: member access into incomplete type 'struct stat64'
374 | out->st_atime = in->st_atime;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:375:21: error: member access into incomplete type 'struct stat64'
375 | out->st_mtime = in->st_mtime;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:376:21: error: member access into incomplete type 'struct stat64'
376 | out->st_ctime = in->st_ctime;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:480:17: error: variable has incomplete type 'struct stat64'
480 | struct stat64 buf64;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:519:17: error: variable has incomplete type 'struct stat64'
519 | struct stat64 buf64;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:564:17: error: variable has incomplete type 'struct stat64'
564 | struct stat64 buf64;
| ^
/home/pepper/dev/ghrepos/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:362:35: note: forward declaration of '__sanitizer::stat64'
362 | static void stat64_to_stat(struct stat64 *in, struct stat *out) {
| ^
16 errors generated.
```
Contributor guide
Research direction
Start in compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp, especially stat64_to_stat and the failing uses around lines 362-564. Reproduce the 32-bit musl build shown in the report, then inspect how stat64 is declared and used there; done means compiler-rt builds successfully for the reported target without incomplete-type errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- compilers, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100