-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
address argument to atomic operation must be a pointer to non-const _Atomic type #8881
Comments
Seems related to #8327, could you have a try with the patch in #8764? (or just use this patch) bson-atomic also used type casting to avoid such problems, to be on the safe side, I've added type-casts to all calls. |
I apologize for my delay in following up on this. The problem still occurs with PHP 8.2.0RC7.
This patch did not apply cleanly to PHP 8.2.0RC7 but I updated the patch (php82-atomic.patch.txt) and it built successfully. But there seems to be disagreement in #8764 about whether that's the correct fix. In Zend/zend_atomic.h it says: #if __has_feature(c_atomic)
#define HAVE_C11_ATOMICS 1
#elif ZEND_GCC_PREREQ(4, 7)
#define HAVE_GNUC_ATOMICS 1
#elif defined(__GNUC__)
#define HAVE_SYNC_ATOMICS 1
#elif !defined(ZEND_WIN32)
#define HAVE_NO_ATOMICS 1
#endif If I just change the first line to: #if 0
that also allows it to build successfully. And, as I said above, earlier clangs (that presumably don't have the https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1807.htm So another solution might be for PHP to detect at configure time whether |
@morrisonlevi, could you please have a look at this? |
requote this link here again: and discussion: I also hope it can be fixed soon :) |
I can confirm the fix mentioned by @ryandesign works when trying to install |
C11 did not have the const qualifier on atomic_load; C17 does. One can either use C11 atomics by casting away the constness, which was proposed and rejected in phpGH-8764, or one can avoid using C11 atomics altogether, instead using C17 atomics if available, which is what this change does. Fixes phpGH-8881
It was recently pointed out to me that I misinterpreted this: The C11 standard did not have the What had confused me into thinking that there was a "revised C11 standard" is that newer compilers that support C17 also use the |
The issue is specifically for older compilers which haven't fixed this errata yet. It's hard to know exactly which compilers these are. Can you please share your compiler name and version? For example, even for C11, clang is supposed to allow const here. There's no reason it shouldn't, so it fixed it even for C11 mode. I'm trying to find when exactly the fixes landed. |
As I've said, I believe the issue would affect compilers which support C11 mode and which predate the existence of the C17 standard which made the change to the constness. I said in my report that I observed it on OS X 10.10–10.13, and it would have been on the MacPorts automated buildbot system, on which the compiler versions are: OS X Yosemite v10.10.5 (14F2511) OS X El Capitan v10.11.6 (15G22010) macOS Sierra v10.12.6 (16G2136) macOS High Sierra v10.13.6 (17G14042) I also said "I also verified the problem on macOS 10.13 with Xcode 10.1 and its Apple clang 1000.11.45.5" which must have been on my own machine, not the buildbot system. We did not see the problem on the macOS 10.14 or later build machines. The 10.14 builder has this version: macOS Mojave v10.14.6 (18G9323) |
Description
Hello! I'm the maintainer of php in MacPorts, and I noticed this build failure of php 8.2.0alpha2 and 8.2.0alpha1 on macOS 10.13 with Xcode 9.4.1 and its Apple clang 902.0.39.2:
Here is a full failed build log from macOS 10.13.
I also verified the problem on macOS 10.13 with Xcode 10.1 and its Apple clang 1000.11.45.5.
It also fails similarly on macOS 10.12, OS X 10.11, and OS X 10.10.
The build succeeds on macOS 10.14 with Xcode 10.3 and its Apple clang 1001.0.46.4 and on newer systems. Here is a full successful build log from macOS 10.14.
Curiously the build also succeeds on much older systems like OS X 10.9, OS X 10.8, and Mac OS X 10.7 with their older versions of Xcode and clang.
I see "c11" in the error message but I don't see
-std=c11
being passed to the compiler. Thinking this might be a situation where certain older compilers would support whatever you're wanting to do if only you would ask the compiler to be in c11 mode, I tried adding-std=c11
on macOS 10.13 with Xcode 10.1 and its Apple clang 1000.11.45.5, and I also tried-std=gnu11
, but neither of those changed the error.php 8.1.7 and earlier don't have this problem.
PHP Version
8.2.0alpha2
Operating System
macOS 10.13.6
The text was updated successfully, but these errors were encountered: