steve-o / openpgm

Automatically exported from code.google.com/p/openpgm
57 stars 44 forks source link

fix build on macOS ARM #71

Closed cho-m closed 2 years ago

cho-m commented 2 years ago

During update of libpgm Homebrew package Homebrew/homebrew-core#95457, the following macOS M1/ARM build failures were seen during make:

cpu.c:44:7: error: invalid output constraint '=a' in asm
    : "=a"(cpu_info[0]), "=D"(cpu_info[1]), "=c"(cpu_info[2]), "=d"(cpu_info[3])
      ^
cpu.c:56:16: error: invalid output constraint '=a' in asm
    "xgetbv" : "=a"(eax), "=d"(edx) : "c"(xcr));
               ^
5 warnings and 2 errors generated.
make: *** [libpgm_noinst_la-cpu.lo] Error 1

The simple fix here is to avoid the incompatible assembly code inside __cpuidex & _xgetbv since they are only used within a i386/x86_64-conditional section from https://github.com/steve-o/openpgm/commit/9730e05169ca819ee27f66deb52e4ae1828f7267

steve-o commented 2 years ago

nice, thx