php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80171 reentrancy.c:139:23: error: too few arguments to function call
Submitted: 2020-10-02 08:56 UTC Modified: 2020-11-03 09:40 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: smillerdev at me dot com Assigned: nikic (profile)
Status: Closed Package: Compile Failure
PHP Version: 7.3.23 OS: macOS 10.15
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: smillerdev at me dot com
New email:
PHP Version: OS:

 

 [2020-10-02 08:56 UTC] smillerdev at me dot com
Description:
------------
Compiling PHP on the latest macOS 10.15 fails in Homebrew CI because Apple changed the way readdir_r is defined as far as I can tell.

https://github.com/Homebrew/homebrew-core/pull/61828
https://github.com/Homebrew/homebrew-core/pull/61820

Actual result:
--------------
/private/tmp/php@7.2-20201002-12382-1t37dvh/php-7.2.34/main/reentrancy.c:139:23: error: too few arguments to function call, expected 3, have 2
        readdir_r(dirp, entry);
        ~~~~~~~~~            ^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/dirent.h:110:1: note: 'readdir_r' declared here
int readdir_r(DIR *, struct dirent *, struct dirent **) __DARWIN_INODE64(readdir_r);
^
1 error generated.
make: *** [main/reentrancy.lo] Error 1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-02 09:21 UTC] nikic@php.net
PHP >= 7.4 sidesteps the issue by removing use of readdir_r: https://github.com/php/php-src/commit/2b28f7189144a21e753dbc09efadd571121a82b9

It looks like PHP_READDIR_R_TYPE is detecting the wrong readdir_r signature for your case. Could you provide the config.log dump?
 [2020-10-02 09:38 UTC] smillerdev at me dot com
I'm personally running the macOS 11.0 beta, but the error is the same. Here is a gist with the log. I can't get it from the CI servers, but I can ask someone to run it on 10.15 if needed.

https://gist.github.com/SMillerDev/638547b3840380fac9f9fd8e0eefb5f6
 [2020-10-02 09:46 UTC] nikic@php.net
Relevant part:

conftest.c:277:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
main() {
^
conftest.c:284:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
    exit(1);
    ^
conftest.c:284:5: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
conftest.c:286:5: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    close(dir);
    ^
conftest.c:289:3: error: implicit declaration of function 'close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  close(dir);
  ^
1 warning and 3 errors generated.
configure:15832: $? = 1
configure: program exited with status 1

It fails due to implicit declaration warnings that become errors under -Werror.

While we can fix the missing includes, running configure with -Werror will also break other checks -- and if I remember correct, some of them are ones done by autoconf itself, so we cannot easily address them. This is why we have an --enable-werror option that enables -Werror only for the build of PHP itself, not for configure checks.

Where does the -Werror flag come from in your case? Is this a new default flag in macos 10.15?
 [2020-10-02 10:01 UTC] smillerdev at me dot com
> Where does the -Werror flag come from in your case? Is this a new default flag in macos 10.15?

As far as I know it's added by Homebrew. That has been the case for tons of software years though, without any issues.
 [2020-10-02 17:05 UTC] php-bugs-2020 at ryandesign dot com
Hi, sorry for filing the duplicate #80176; I didn't see this one.

Apple did not redefine readdir_r; instead, as of Xcode 12, implicit function declarations are an error. They used to be just warnings. php's configure script fails to include various required headers, causing it to misidentify the system's capabilities (such as how many arguments the readdir_r function needs). php needs to fix its configure script to include the right headers for each test.
 [2020-10-05 08:22 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2020-10-05 08:53 UTC] nikic@php.net
-Status: Assigned +Status: Feedback
 [2020-10-05 08:53 UTC] nikic@php.net
I addressed a number of issues in https://github.com/php/php-src/commit/aa405b7da270595d349d0596ad31305a41d4b1c0. Could you please check whether that makes the build succeed?
 [2020-10-05 09:18 UTC] smillerdev at me dot com
This doesn't apply cleanly to the 7.2/7.3 codebase the issue was occurring in, which is to be expected for a commit based on master. I'm trying to make it work, but I don't think I know enough about the changes between 7.2 and 8.0 on this level to make it work.
 [2020-10-05 09:31 UTC] nikic@php.net
The referenced commit is on PHP-7.3, so it should at least apply cleanly there :)

For older versions, we cannot address this from our side, but I expect passing something like CFLAGS="-Wno-error" or maybe CFLAGS="-Wno-error=implicit-function-declarations" to configure should allow working around the issue.
 [2020-10-05 10:21 UTC] smillerdev at me dot com
Whoops I accidentally build 7.2 twice. Yeah, 7.3 seems to be working indeed. I'll try applying the CFLAGS to 7.2 and otherwise homebrew will have to retire it a couple months early.
 [2020-10-18 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2020-10-31 13:37 UTC] php-bugs-2020 at ryandesign dot com
In php 7.4.12 and 7.3.24 there is still one implicit declaration of exit in the configure tests that should be fixed:

php-7.3.24/config.log:

configure:96698: checking whether dlsym() requires a leading underscore in symbol names
configure:96769: ccache /usr/bin/clang -o conftest -pipe -Os -Werror=implicit-function-declaration -arch x86_64 -fvisibility=hidden -I/opt/local/include -no-cpp-precomp  conftest.c  >&5
configure:96765:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
    exit (status);
    ^
configure:96765:5: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 error generated.

php-7.4.12/config.log:

configure:83023:5: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
 [2020-11-03 09:40 UTC] nikic@php.net
-Status: No Feedback +Status: Closed
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Nov 28 18:03:14 2021 UTC