|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81130 implicit declaration of function 'fdatasync' is invalid in C99
Submitted: 2021-06-12 14:37 UTC Modified: 2021-06-12 14:42 UTC
From: php-bugs-2021 at ryandesign dot com Assigned: krakjoe (profile)
Status: Closed Package: Compile Failure
PHP Version: 8.1.0alpha1 OS: macOS 10.13.6
Private report: No CVE-ID: None
 [2021-06-12 14:37 UTC] php-bugs-2021 at ryandesign dot com
Hi, I'm the maintainer of php in MacPorts, trying out php 8.1.0alpha1, and it does not compile for me on macOS 10.13.6 with Apple LLVM version 9.1.0 (clang-902.0.39.2) from Xcode 9.4.1.

./configure output includes:

checking for fdatasync... yes

However the build fails with:

main/streams/plain_wrapper.c:559:11: error: implicit declaration of function 'fdatasync' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                        return fdatasync(fd);
main/streams/plain_wrapper.c:559:11: warning: this function declaration is not a prototype [-Wstrict-prototypes]
1 warning and 1 error generated.
make: *** [main/streams/plain_wrapper.lo] Error 1
make: *** Waiting for unfinished jobs....

n.b. I am using CFLAGS=-Werror=implicit-function-declaration to mimic the default behavior of Xcode 12 and later.

I can't find a macOS manpage for fdatasync. Searching around, some people think macOS does have fdatasync (it is mentioned in for example) but just doesn't have a prototype of it in any system header, which would be a bit odd. Others suggest not trying to use fdatasync on macOS. I'm not sure what to recommend.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-12 14:42 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2021-06-12 14:42 UTC]
The fix for this bug has been committed.
If you are still experiencing this bug, try to check out latest source from and re-test.
Thank you for the report, and for helping us make PHP better.

This was fixed in e69729f2ba02ddc26c70b4bd88ef86c0a2277bdc

This just missed alpha 1, will be included in alpha 2 and is in master.
 [2021-06-13 10:15 UTC] php-bugs-2021 at ryandesign dot com
Confirmed! Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 13:01:28 2024 UTC