Errors about asm for a gcc build on macos

355 Views Asked by At

I used to build a project on windows and now that I am trying to build it on macos (M1) I get errors on a dependency (nested in a dependency):

pixman-0.34.0/pixman/pixman-x86.c:103:4: error: unknown register name '%eax' in asm
        : "%eax", "%ecx");
          ^
pixman-0.34.0/pixman/pixman-x86.c:136:4: error: invalid output constraint '=a' in asm
        : "=a" (*a), "=r" (*b), "=c" (*c), "=d" (*d)
          ^

I also get warnings all around:

pixman-0.34.0/pixman/pixman-x86.c:83:5: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
#if _PIXMAN_X86_64 || defined (_MSC_VER) || defined(__native_client__)
    ^
pixman-0.34.0/pixman/pixman-x86.c:78:6: note: expanded from macro '_PIXMAN_X86_64'
    (defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64))
     ^

The project is configured with CMake with very few parameters, most of the configuration is made in the CMake of the dependency (Orthanc Stone).
There is an emscripten build of almost the same sources and libs that is working fine so I guess I'm missing something in the CMake configuration to make it work on macos.
I suppose the target architecture is not compatible with the pixman lib (and probably others that the compilation has not reached yet). But I did not find how to fix it.

I installed gcc using homebrew

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc-11
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/11.3.0/bin/../libexec/gcc/aarch64-apple-darwin21/11/lto-wrapper
Target: aarch64-apple-darwin21
Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/11 --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-11 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 11.3.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --build=aarch64-apple-darwin21 --with-system-zlib --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Homebrew GCC 11.3.0)
1

There are 1 best solutions below

2
On

The project is configured with CMake with very few parameters, most of the configuration is made in the CMake of the dependency (Orthanc).

Is it this Orthanc? How exactly are they building pixman with CMake? Pixman has lots of special cases implemented in Assembler. At build time, autoconf detects the right one to enable. Since you are writing that you are using CMake, I bet someone side-stepped all that auto-detection and just hardcoded what to build. And hardcoded the x86 build.

If this guess is right, then that is a bug in that CMake file and there is nothing anyone but orthanc devs can do about that.

Which part of orthanc are you trying to build exactly and how? I fail to find its use of cairo...