Configure check for stat64 does not work on Apple silicon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I’m working on getting dash building on macOS for Apple silicon. On this platform, stat64 is not available:

  CC       cd.o
cd.c:99:16: error: variable has incomplete type 'struct stat64'
        struct stat64 statb;
                      ^
cd.c:99:9: note: forward declaration of 'struct stat64'
        struct stat64 statb;
               ^
cd.c:135:7: error: implicit declaration of function 'stat64' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                if (stat64(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) {
                    ^
cd.c:135:7: note: did you mean 'stat'?
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/sys/stat.h:386:9: note: 'stat' declared here
int     stat(const char *, struct stat *) __DARWIN_INODE64(stat);
        ^
2 errors generated.

(If you happen to have access to an Intel Mac, you can reproduce this by running configure as CC="xcrun clang -arch arm64" ./configure --build=arm64-apple-darwin --host=x86_64-apple-darwin.)

Even though stat64 is not in the public headers, AC_CHECK_FUNC will “find” it because the symbol exists at link time for the test, even though it is not meant to be used. What do you think would be the best way to fix this check on this platform? Would it be preferred to check if the headers contain a declaration of the function?

Thanks,
Saagar Jha




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux