dfxml-working-group / dfxml_cpp

C++ implementation of DFXML reader and writer
Other
1 stars 2 forks source link

Detection of cpuid producing false positive #15

Closed dfjxs closed 2 years ago

dfjxs commented 2 years ago

When building on ppc64el architecture, the cpuid detection in dfxml_configure.m4 appears to be producing a false positive.

I added a debug statement and found that have_cpuid is set to "yes".

[...]
checking for git... no
configure: WARNING: git not found
configure: have_cpuid: yes
checking for CommonCrypto/CommonDigest.h... no
checking for gcrypt.h... no
[...]

This results in an assembler error.

be20_api/dfxml_cpp/src/dfxml_writer.h:478:96: warning: macro "__TIME__" might prevent reproducible builds [-Wdate-time]
  478 |             snprintf(buf,sizeof(buf),"%4d-%02d-%02dT%s",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,__TIME__);
      |                                                                                                ^~~~~~~~
/tmp/cc8zqd7t.s: Assembler messages:
/tmp/cc8zqd7t.s:47103: Error: unrecognized opcode: `cpuid'
/tmp/cc8zqd7t.s:48665: Error: unrecognized opcode: `cpuid'
/tmp/cc8zqd7t.s:55129: Error: unrecognized opcode: `cpuid'
make[3]: *** [Makefile:1383: phase1.o] Error 1
simsong commented 2 years ago

Neat. I do not have access to a system to test. Can you add a #ifdef to turn it off on this platform?


Sent from my phone.

On May 19, 2022, at 11:19 PM, Jason @.***> wrote:

 When building on ppc64el architecture, the cpuid detection in dfxml_configure.m4 appears to be producing a false positive.

I added a debug statement and found that have_cpuid is set to "yes".

[...] checking for git... no configure: WARNING: git not found configure: have_cpuid: yes checking for CommonCrypto/CommonDigest.h... no checking for gcrypt.h... no [...] This results in an assembler error.

be20_api/dfxml_cpp/src/dfxml_writer.h:478:96: warning: macro "TIME" might prevent reproducible builds [-Wdate-time] 478 | snprintf(buf,sizeof(buf),"%4d-%02d-%02dT%s",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,TIME); | ^~~~ /tmp/cc8zqd7t.s: Assembler messages: /tmp/cc8zqd7t.s:47103: Error: unrecognized opcode: cpuid' /tmp/cc8zqd7t.s:48665: Error: unrecognized opcode:cpuid' /tmp/cc8zqd7t.s:55129: Error: unrecognized opcode: `cpuid' make[3]: *** [Makefile:1383: phase1.o] Error 1 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

dfjxs commented 2 years ago

Sure, so that I could get my build working, I used:

if test "$build_alias" = "powerpc64le-linux-gnu"; then
  have_cpuid=no
fi

build_alias is set through a command line flag though, so it's not always going to be set. Is there something you're defining somewhere that would be better to use?

simsong commented 2 years ago

Can you test to see if the architecture is x86 and disable if it is not?


Sent from my phone.

On May 23, 2022, at 3:24 AM, Jason @.***> wrote:

 Sure, so that I could get my build working, I used:

if test "$build_alias" = "powerpc64le-linux-gnu"; then have_cpuid=no fi build_alias is set through a command line flag though, so it's not always going to be set. Is there something you're defining somewhere that would be better to use?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.