Opened 4 years ago

Last modified 3 years ago

#62838 assigned defect

policykit @0.116_1+universal: error: implicit declaration of function 'fdatasync' is invalid in C99

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version: 2.6.99
Keywords: highsierra Cc:
Port: policykit

Description

I am not able to upgrade policykit on my machine:

polkitagenthelperprivate.c:138:3: error: implicit declaration of function 'fdatasync' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  fdatasync (fileno(stdout));
  ^
1 error generated.
make[4]: *** [polkit_agent_helper_1-polkitagenthelperprivate.o] Error 1

This is with the +universal variant.

Attachments (1)

main.log.bz2 (15.5 KB) - added by ryandesign (Ryan Carsten Schmidt) 4 years ago.

Download all attachments as: .zip

Change History (2)

Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: main.log.bz2 added

comment:1 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Note that I am adding -Werror=implicit-function-declaration to configure.cflags to mimic the behavior of Xcode 12 and later. Normally with Xcode 11 or earlier this would be a warning, not an error.

Here is a report of a similar problem in PHP: https://bugs.php.net/bug.php?id=81130

It seems that fdatasync does exist in the system library on macOS (which is why the "checking for fdatasync" configure check succeeds) but, oddly, macOS doesn't have a prototype for this function in the system headers (hence use of this function triggers an "implicit declaration of function"). PHP fixed the issue by declaring the prototype manually: https://github.com/php/php-src/commit/e69729f2ba02ddc26c70b4bd88ef86c0a2277bdc

policykit might want to use the same solution.

We have a successful build of policykit on our buildbot even on macOS 11 with Xcode 12. I don't have a log of this handy so I don't know why this succeeded.

We're several versions out of date on policykit (#63277). If the problem remains with the latest version, we should report it to the developers.

Note: See TracTickets for help on using tickets.