Missing basename in util/test-path.c on musl-based systems
NHO <[email protected]> Sun, 23 Feb 2025 20:43:11 +0400
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
In systems using musl as libc, eg. certain Gentoo profiles, tests of ell fail to build, with error: clang -DHAVE_CONFIG_H -I. -fvisibility=hidden -DUNITDIR=\""./unit/"\" -DCERTDIR=\""./unit/"\" -O2 -pipe -fsigned-char -Wno-unknown-warning-option -Wno-unknown-pragmas -c -o unit/test-path.o unit/test-path.c unit/test-path.c:65:9: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 65 | base = basename(tmp_path); | ^ unit/test-path.c:65:9: note: did you mean 'l_basename'? ./ell/path.h:20:13: note: 'l_basename' declared here 20 | const char *l_basename(const char *path); | ^ unit/test-path.c:65:7: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion] 65 | base = basename(tmp_path); | ^ ~~~~~~~~~~~~~~~~~~ 2 errors generated. Musl doesn't have GNU basename() in the string.h, only POSIX in libgen.h See also: Gentoo bug https://bugs.gentoo.org/942788 second error appears to be a false positive.