|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-08-31 02:35 UTC] php-bugs-2018 at ryandesign dot com
Description:
------------
Hello, php 7.3.0beta3 fails to build on Mac OS X 10.7.5 using the clang 425.0.28 compiler that ships with Xcode 4.6.3:
Zend/zend_cpuinfo.c:34:2: warning: implicit declaration of function '__cpuid_count' is invalid in C99 [-Wimplicit-function-declaration]
__cpuid_count(func, subfunc, cpuinfo->eax, cpuinfo->ebx, cpuinfo->ecx, cpuinfo->edx);
^
...
Undefined symbols for architecture x86_64:
"___cpuid_count", referenced from:
_zend_cpu_startup in zend_cpuinfo.o
On Mac OS X 10.6.8 using the Apple gcc 4.2.1 compiler that ships with Xcode 3.2.6, there is a different but seemingly related error:
Zend/zend_cpuinfo.c:32:19: error: cpuid.h: No such file or directory
The commit that probably introduced this problem is https://github.com/php/php-src/commit/1a078117b5ae862b18ef5362accef4b4d0a6b7c4
Using a newer compiler does work around the problem, but requiring users to install or possibly even build a newer compiler can be an imposition. It looks like php used to have some custom assembly that was replaced with a call to __cpuid_count, and there was discussion in https://github.com/php/php-src/pull/3395 about whether the old code should be retained as a fallback, and it was decided not to do so until someone reported a build failure; this ticket is that build failure report.
Patchescheck-cpuid-count (last revision 2018-10-17 11:59 UTC by cmb@php.net)Pull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
Sorry for the delay. The configure test says __cpuid_count is available, though it's obviously not. Here's what config.log says about it: configure:5874: checking whether __cpuid_count is available configure:5896: /usr/bin/clang -c -pipe -Os -arch x86_64 -fvisibility=hidden -I/opt/local/include -no-cpp-precomp conftest.c >&5 conftest.c:34:3: warning: implicit declaration of function '__cpuid_count' is invalid in C99 [-Wimplicit-function-declaration] __cpuid_count(0, 0, eax, ebx, ecx, edx); ^ 1 warning generated. configure:5896: $? = 0 configure:5907: result: yes It looks like the problem is that the compiler is being invoked using the "-c" flag, which skips the link phase which is where the error occurs. I can reproduce this with a small test program: $ clang -c test.c; echo $? test.c:5:1: warning: implicit declaration of function '__cpuid_count' is invalid in C99 [-Wimplicit-function-declaration] __cpuid_count(0, 0, eax, ebx, ecx, edx); ^ 1 warning generated. 0 $ clang test.c; echo $? test.c:5:1: warning: implicit declaration of function '__cpuid_count' is invalid in C99 [-Wimplicit-function-declaration] __cpuid_count(0, 0, eax, ebx, ecx, edx); ^ 1 warning generated. Undefined symbols for architecture x86_64: "___cpuid_count", referenced from: _main in test-eIiJ3P.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 1