Bug #76825 [Opn->Csd]: Undefined symbols ___cpuid_count

From: Date: Tue, 04 Sep 2018 09:28:03 +0000
Subject: Bug #76825 [Opn->Csd]: Undefined symbols ___cpuid_count
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216872@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76825&edit=1

 ID:                 76825
 Updated by:         laruence@php.net
 Reported by:        php-bugs-2018 at ryandesign dot com
 Summary:            Undefined symbols ___cpuid_count
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Mac OS X 10.7.5
 PHP Version:        7.3.0beta3
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3497b75b732723b2f8d0745336d9fcaccb2e3dd7
Log: Fixed bug #76825 (Undefined symbols ___cpuid_count)


Previous Comments:
------------------------------------------------------------------------
[2018-08-31 10:58:43] php-bugs-2018 at ryandesign dot com

clang defines __GNUC__. clang identifies itself as gcc 4.2.1. If you want to check if it's
actually clang, you could check for __clang__.

------------------------------------------------------------------------
[2018-08-31 10:55:40] cmb@php.net

I don't understand the compile failure under Clang, since the
respective code is guarded by defined(__GNUC__)[1].

Anyhow, we should use feature detection (AC_TRY_LINK) instead of
inferring by compiler, in my opinion.

[1] <https://github.com/php/php-src/blob/php-7.3.0beta3/Zend/zend_cpuinfo.c#L31-L35>

------------------------------------------------------------------------
[2018-08-31 02:35:32] 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.



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=76825&edit=1


Thread (13 messages)

« previous php.bugs (#216872) next »