2024-05-24 21:04 BST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002862NetSurf[All Projects] Generalpublic2024-01-15 22:28
ReporterRyan Carsten Schmidt 
Assigned To 
Platformx86_64OSOS XOS Version10.9
Product Version3.11 
Target VersionFixed in Version 
Summary0002862: error: use of undeclared identifier 'AT_SYMLINK_NOFOLLOW'
DescriptionNetSurf 3.11 fails to build on an old version of macOS, OS X 10.9:

utils/file.c:349:7: warning: implicit declaration of function 'fstatat' is invalid in C99 [-Wimplicit-function-declaration]
                if (fstatat(dirfd(parent), entry->d_name, &ent_stat,
utils/file.c:350:5: error: use of undeclared identifier 'AT_SYMLINK_NOFOLLOW'
                                AT_SYMLINK_NOFOLLOW) != 0) {
utils/file.c:365:8: warning: implicit declaration of function 'unlinkat' is invalid in C99 [-Wimplicit-function-declaration]
                        if (unlinkat(dirfd(parent), entry->d_name, 0) != 0) {
2 warnings and 1 error generated.

This problem does not occur on OS X 10.10 or later. This isn't surprising since fstatat was introduced in OS X 10.10.

What is surprising is that the code in file.c and filename.c—the only places where fstatat is used—is guarded by "#if (defined(HAVE_DIRFD) && defined(HAVE_FSTATAT))". So somehow HAVE_FSTATAT is defined even though the system doesn't have it.

I initially assumed there was a problem with your configure test for fstatat when I was reminded that NetSurf doesn't use a configure script. HAVE_FSTATAT is defined unconditionally in netsurf/utils/config.h and is then undefined on a few systems. I guess if you don't use something like a configure script to see what's actually available, you'll have to hardcode a decision into config.h not to use fstatat when building *for* those older OS X versions that don't have it. (I say *for*, not *on*; *for* means looking at the deployment target (the MAC_OS_X_VERSION_MIN_REQUIRED preprocessor macro), not the SDK version (the MAC_OS_X_VERSION_MAX_ALLOWED preprocessor macro)). I don't see any existing occurrences of either of these macros in any of your source code so perhaps you're using another method to deal with this problem as it has arisen for other functions, or perhaps you haven't had to deal with this problem yet. Using either of these macros requires including <AvailabilityMacros.h> first, which you should only do when __APPLE__ is defined.
Steps To ReproduceBuild NetSurf 3.11 on OS X 10.9.
TagsNo tags attached.
Fixed in CI build #
Reported in CI build #
URL of problem page
Attached Files
  • log file icon build.log (1,258,841 bytes) 2024-01-15 22:28


There are no notes attached to this issue.

-Issue History
Date Modified Username Field Change
2024-01-15 22:28 Ryan Carsten Schmidt New Issue
2024-01-15 22:28 Ryan Carsten Schmidt File Added: build.log
+Issue History