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 2018-11-19 05:44:28.000000000 -0600 +++ src/cache.cc 2021-12-02 18:31:06.000000000 -0600 @@ -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; Cache::Cache(string cache_file) @@ -86,9 +95,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) return 0; @@ -97,7 +110,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 false; std::string A = string(cache_directory) + "/" + a->d_name; struct stat bufa;