The prototype of scandir changed in the 10.8 SDK. Use the old prototype on old SDKs. https://gitlab.com/pdfgrep/pdfgrep/-/merge_requests/14 --- src/cache.cc.orig 2024-03-15 12:58:00.000000000 +0000 +++ src/cache.cc 2024-11-27 18:10:44.792593267 +0000 @@ -35,6 +35,15 @@ #include #include +#ifdef __APPLE__ +#include +#endif + +#define HAVE_NEW_SCANDIR +#if (defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED < 1080) +#undef HAVE_NEW_SCANDIR +#endif + using namespace std; const char *CACHE_VERSION = "1"; @@ -115,9 +124,13 @@ // I feel so bad... static const char *cache_directory; -static int agesort(const struct dirent ** a, const struct dirent **b) { - std::string A = string(cache_directory) + "/" + (*a)->d_name; - std::string B = string(cache_directory) + "/" + (*b)->d_name; +#ifdef HAVE_NEW_SCANDIR +static int agesort(const struct dirent **a, const struct dirent **b) { +#else +static int agesort(const void *a, const void *b) { +#endif + std::string A = string(cache_directory) + "/" + (*(const struct dirent **)a)->d_name; + std::string B = string(cache_directory) + "/" + (*(const struct dirent **)b)->d_name; struct stat bufa, bufb; if (stat(A.c_str(), &bufa) != 0) { @@ -130,7 +143,11 @@ return bufb.st_mtime - bufa.st_mtime; } -static int agefilter(const struct dirent * a) { +#ifdef HAVE_NEW_SCANDIR +static int agefilter(const struct dirent *a) { +#else +static int agefilter(struct dirent *a) { +#endif if (a->d_name[0] == '.') { return 0; }