Bug #76825 [Asn]: Undefined symbols ___cpuid_count

From: Date: Fri, 26 Oct 2018 14:46:28 +0000
Subject: Bug #76825 [Asn]: Undefined symbols ___cpuid_count
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217699@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:         cmb@php.net
 Reported by:        php-bugs-2018 at ryandesign dot com
 Summary:            Undefined symbols ___cpuid_count
 Status:             Assigned
 Type:               Bug
 Package:            Compile Failure
 Operating System:   Mac OS X 10.7.5
 PHP Version:        7.3.0beta3
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

> 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.

Then we'll have to replace the AC_COMPILE_IFELSE with
AC_LINK_IFELSE.  Can you please try that?


Previous Comments:
------------------------------------------------------------------------
[2018-10-26 14:36:13] php-bugs-2018 at ryandesign dot com

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

------------------------------------------------------------------------
[2018-10-17 12:00:00] cmb@php.net

Please check the attached check-cpuid-count patch.

------------------------------------------------------------------------
[2018-10-17 11:59:56] cmb@php.net

The following patch has been added/updated:

Patch Name: check-cpuid-count
Revision:   1539777596
URL:        https://bugs.php.net/patch-display.php?bug=76825&patch=check-cpuid-count&revision=1539777596

------------------------------------------------------------------------
[2018-10-15 19:32:32] php-bugs-2018 at ryandesign dot com

Yes, if I edit Zend/zend_cpuinfo.c and change "# ifdef HAVE_CPUID_H" to "# if 0"
then it builds and runs. So I think it just needs a more specific check for the existence of
__cpuid_count and not just the existence of cpuid.h.

------------------------------------------------------------------------
[2018-10-05 09:54:27] cmb@php.net

Does it work for you if you remove the HAVE_CPUID_H part[1] (plus
the respective #endif[2])?

[1] <https://github.com/php/php-src/blob/php-7.3.0RC2/Zend/zend_cpuinfo.c#L32-L37>
[2] <https://github.com/php/php-src/blob/php-7.3.0RC2/Zend/zend_cpuinfo.c#L45>

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=76825


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


Thread (13 messages)

« previous php.bugs (#217699) next »