Open mratsim opened 7 months ago
It seems like the MacOS CI is now using ARM CPUs:
and the make_headers
task assumes it is running on x86
Executing task make_lib in /Users/runner/work/constantine/constantine/constantine/constantine.nimble
Compiling static library: lib/libconstantine.a.arm
Compiling static library: lib/libconstantine.a.x64
Compiling dynamic library: lib/libconstantine.dylib.arm
ld: warning: ignoring duplicate libraries: '-lm'
Compiling dynamic library: lib/libconstantine.dylib.x64
ld: warning: ignoring duplicate libraries: '-lm'
Executing task make_headers in /Users/runner/work/constantine/constantine/constantine/constantine.nimble
/Users/runner/work/constantine/constantine/constantine/nimcache/libcurves_headers/@m..@sconstantine@splatforms@sisa@scpudetect_x86.nim.c:80:8: error: invalid output constraint '=a' in asm
:"=a"(result.eax), "=b"(result.ebx), "=c"(result.ecx), "=d"(result.edx)
^
However building a fat binary for both x86 and ARM works well.
Cross-compiling for Linux ARM64 on Linux x86 host works with Clang.
However looking at the error message we can see Nim Compiler version 1.6.21 [MacOSX: amd64]
but the host is actually arm64-apple-darwin23.4.0
So I suspect Nim is actually running through Rosetta and "thinks" it is on a x86 platform, which leads to this const X86
check being mistakenly true:
https://github.com/mratsim/constantine/blob/976c8bb215a3f0b21ce3d05f894eb506072a6285/constantine/platforms/config.nim#L12-L13
It seems like assembly for Apple Clang changed:
https://github.com/mratsim/constantine/actions/runs/8862799707/job/24336160802?pr=370
https://github.com/mratsim/constantine/blob/976c8bb215a3f0b21ce3d05f894eb506072a6285/constantine/platforms/isa/cpudetect_x86.nim#L17-L36