#5999·FEX

Build: error: no matching function for call to 'getdents' (musl)

Author: peppergrayxyzCreated Sep 30, 2026Updated Sep 30, 2026

building on musl fails with error:

c
ninja: job failed: /usr/bin/ccache sloppiness=time_macros /usr/bin/clang++ -DARCHITECTURE_arm64=1 -DASSERTIONS_ENABLED=1 -DFEXCORE_HAS_PRESERVE_ALL_ATTR=1 -DFEXCORE_PRESERVE_ALL_ATTR="__attribute__((preserve_all))" -DFEX_HAS_PRESERVE_ALL_ATTR=1 -DFEX_PRESERVE_ALL_ATTR="__attribute__((preserve_all))" -DFMT_SHARED -DGLOBAL_DATA_DIRECTORY=\"FEX/build/install/share/fex-emu/\" -DHAS_PROGRAM_INVOCATION_NAME=1 -DHAS_SYSCALL_GETTID=1 -DHAS_SYSCALL_RENAMEAT2=1 -DHAS_SYSCALL_STATX=1 -DINLINE="static inline" -DINLINE_LEVEL=4 -DJIT_ARM64 -DSOFTFLOAT_BUILTIN_CLZ=1 -DSOFTFLOAT_FAST_DIV32TO16=1 -DSOFTFLOAT_FAST_DIV64TO32=1 -DSOFTFLOAT_FAST_INT64=1 -D_LARGEFILE64_SOURCE -IFEX/build_alpine/FEXCore/Source -IFEX/FEXCore/Source -IFEX/Source -IFEX/build_alpine/Source -IFEX/build_alpine/generated -IFEX/FEXCore/Source/IncludePrivate -IFEX/FEXCore/include -IFEX/build_alpine/include -IFEX/FEXHeaderUtils/. -IFEX/CodeEmitter/. -IFEX/External/cephes/include -IFEX/External/SoftFloat-3e/include -IFEX/External/SoftFloat-3e/include/SoftFloat-3e -IFEX/External/unordered_dense/include -O3 -DNDEBUG -fomit-frame-pointer -std=gnu++20 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wno-trigraphs -fdiagnostics-color=always -fcolor-diagnostics -Wno-deprecated-enum-enum-conversion -Wall -fno-strict-aliasing -fno-exceptions -Werror=cast-qual -Werror=ignored-qualifiers -Werror=implicit-fallthrough -ffunction-sections -fwrapv -MD -MT FEXCore/Source/CMakeFiles/FEXCore_Base.dir/Utils/FileUtils.cpp.o -MF FEXCore/Source/CMakeFiles/FEXCore_Base.dir/Utils/FileUtils.cpp.o.d -o FEXCore/Source/CMakeFiles/FEXCore_Base.dir/Utils/FileUtils.cpp.o -c FEX/FEXCore/Source/Utils/FileUtils.cpp
FEX/FEXCore/Source/Utils/FileUtils.cpp:61:20: error: no matching function for call to 'getdents'
   61 |     ssize_t read = getdents64(dir_fd, dirent_buffer, dirent_size);
      |                    ^~~~~~~~~~
/usr/include/dirent.h:80:20: note: expanded from macro 'getdents64'
   80 | #define getdents64 getdents
      |                    ^~~~~~~~
/usr/include/dirent.h:64:5: note: candidate function not viable: no known conversion from 'uint8_t *' (aka 'unsigned char *') to 'struct dirent *' for 2nd argument
   64 | int getdents(int, struct dirent *, size_t);
      |     ^             ~~~~~~~~~~~~~~~
FEX/FEXCore/Source/Utils/FileUtils.cpp:154:20: error: no matching function for call to 'getdents'
  154 |     ssize_t read = getdents64(dir_fd, dirent_buffer, dirent_size);
      |                    ^~~~~~~~~~
/usr/include/dirent.h:80:20: note: expanded from macro 'getdents64'
   80 | #define getdents64 getdents
      |                    ^~~~~~~~
/usr/include/dirent.h:64:5: note: candidate function not viable: no known conversion from 'uint8_t *' (aka 'unsigned char *') to 'struct dirent *' for 2nd argument
   64 | int getdents(int, struct dirent *, size_t);
      |     ^             ~~~~~~~~~~~~~~~
2 errors generated.

due to dirent_buffer being cased to uint8_t *, which works with glibc

c
ssize_t __getdents64 (int fd, void *buf, size_t nbytes)

but not with musl

c
int getdents(int, struct dirent *, size_t);