Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2022-03-11
08:50 • Closed ticket [8a7ec8a389]: error when compiling a fat binary for Mac M1 plu... artifact: 041f01b70d user: jan.nijtmans
08:48
Fix [8a7ec8a389]: error when compiling a fat binary for Mac M1 check-in: 47f36d7612 user: jan.nijtmans tags: core-8-6-branch
08:17 • Ticket [8a7ec8a389] error when compiling a fat binary for Mac M1 status stil... artifact: 060a82b064 user: sl1200mk2
2022-03-10
22:19 • New ticket [8a7ec8a389]. artifact: e8dfc901fe user: mwdavis

error when compiling a fat binary for Mac M1

Closed / Fixed8a7ec8a38915d1de37404272895337b98afa9a83Created 5 years agoUpdated 5 years ago
Descriptionplain2022-03-10 22:19:12
I don't know if this is a bug or a mistake on my part.
I've always compiled a mac version of Tcl and Tk using the basic recommended make from the macos Readme.md:
make CFLAGS="-O2 -mmacosx-version-min=10.12 -arch x86_64"

I'm now trying to make a fat binary version (or just arm64 version) for the new mac M1 hardware. 
I'm trying these new cflags (based on some searching):
make CFLAGS="-O2 -mmacosx-version-min=10.12 -arch x86_64 -arch arm64e"
or
make CFLAGS="-O2 -mmacosx-version-min=10.12 -arch arm64e"
or
make CFLAGS="-O2 -mmacosx-version-min=10.12 -arch arm64"

but tcl gives the error:
/Users/jorgensenlab/Documents/Tcl_Tk_8_7_a6/tcl-f67b1bb0bb/unix/tclUnixCompat.c:1008:20: error: invalid output constraint '=a' in asm
                 : "=a"(regsPtr[0]), "=S"(regsPtr[1]), "=c"(regsPtr[2]), "=d"(regsPtr[3])
                   ^
1 error generated.
make[3]: *** [tclUnixCompat.o] Error 1
make[2]: *** [build-tcl] Error 2
make[1]: *** [tcl] Error 2
make: *** [develop] Error 2


which seems like something it would have a problem with, since my vague understanding is that line is referencing registers in an i386 CPU. 
Should I have some different/new flags set to make it ignore this, or does it need to be specially dealt with in the source?
Referenced by1
sl1200mk2plain2022-03-11 08:17:38
Hi,
if you want to compile on the M1 for the M1, you don't need the -arch flag.
here on the M1 uname -m gives arm64

do you want to compile or cross-compile?

++
jan.nijtmanswiki2022-03-11 08:50:59

I think I see what's happening. When configuring on an Intel machine, the configure script decides that the cpuid instruction is available. But the arm part of the compile doesn't support that.

Should be fixed [here]

Thanks for the report!

Log in (anonymous is fine) to add a comment.