Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#59512 closed defect (fixed)

orc @0.4.30_1: ../orc-0.4.30/orc/orccpu-x86.c:91:7: error: instruction requires: Not 64-bit mode

Reported by: kencu (Ken) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: orc

Description

On a system running 10.6.8, building orc at 64 bit:

:info:build FAILED: orc/8524582@@orc-0.4@sha/orccpu-x86.c.o 
:info:build /opt/local/bin/clang-mp-9.0 -Iorc/8524582@@orc-0.4@sha -Iorc -I../orc-0.4.30/orc -I. -I../orc-0.4.30/ -I/opt/local/include -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -std=gnu99 -O2 -g -DHAVE_CONFIG_H -fvisibility=hidden -Os -arch x86_64 -DORC_ENABLE_UNSTABLE_API -D_GNU_SOURCE -DBUILDING_ORC -MD -MQ 'orc/8524582@@orc-0.4@sha/orccpu-x86.c.o' -MF 'orc/8524582@@orc-0.4@sha/orccpu-x86.c.o.d' -o 'orc/8524582@@orc-0.4@sha/orccpu-x86.c.o' -c ../orc-0.4.30/orc/orccpu-x86.c
:info:build ../orc-0.4.30/orc/orccpu-x86.c:91:7: error: instruction requires: Not 64-bit mode
:info:build       "  pushl %%ebx\n"
:info:build       ^
:info:build <inline asm>:1:4: note: instantiated into assembly here
:info:build           pushl %ebx
:info:build           ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:94:8: error: instruction requires: Not 64-bit mode
:info:build       "  popl %%ebx\n"
:info:build        ^
:info:build <inline asm>:4:3: note: instantiated into assembly here
:info:build   popl %ebx
:info:build   ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:91:7: error: instruction requires: Not 64-bit mode
:info:build       "  pushl %%ebx\n"
:info:build       ^
:info:build <inline asm>:1:4: note: instantiated into assembly here
:info:build           pushl %ebx
:info:build           ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:94:8: error: instruction requires: Not 64-bit mode
:info:build       "  popl %%ebx\n"
:info:build        ^
:info:build <inline asm>:4:3: note: instantiated into assembly here
:info:build   popl %ebx
:info:build   ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:91:7: error: instruction requires: Not 64-bit mode
:info:build       "  pushl %%ebx\n"
:info:build       ^
:info:build <inline asm>:1:4: note: instantiated into assembly here
:info:build           pushl %ebx
:info:build           ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:94:8: error: instruction requires: Not 64-bit mode
:info:build       "  popl %%ebx\n"
:info:build        ^
:info:build <inline asm>:4:3: note: instantiated into assembly here
:info:build   popl %ebx
:info:build   ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:91:7: error: instruction requires: Not 64-bit mode
:info:build       "  pushl %%ebx\n"
:info:build       ^
:info:build <inline asm>:1:4: note: instantiated into assembly here
:info:build           pushl %ebx
:info:build           ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:94:8: error: instruction requires: Not 64-bit mode
:info:build       "  popl %%ebx\n"
:info:build        ^
:info:build <inline asm>:4:3: note: instantiated into assembly here
:info:build   popl %ebx
:info:build   ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:91:7: error: instruction requires: Not 64-bit mode
:info:build       "  pushl %%ebx\n"
:info:build       ^
:info:build <inline asm>:1:4: note: instantiated into assembly here
:info:build           pushl %ebx
:info:build           ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:94:8: error: instruction requires: Not 64-bit mode
:info:build       "  popl %%ebx\n"
:info:build        ^
:info:build <inline asm>:4:3: note: instantiated into assembly here
:info:build   popl %ebx
:info:build   ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:91:7: error: instruction requires: Not 64-bit mode
:info:build       "  pushl %%ebx\n"
:info:build       ^
:info:build <inline asm>:1:4: note: instantiated into assembly here
:info:build           pushl %ebx
:info:build           ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:94:8: error: instruction requires: Not 64-bit mode
:info:build       "  popl %%ebx\n"
:info:build        ^
:info:build <inline asm>:4:3: note: instantiated into assembly here
:info:build   popl %ebx
:info:build   ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:91:7: error: instruction requires: Not 64-bit mode
:info:build       "  pushl %%ebx\n"
:info:build       ^
:info:build <inline asm>:1:4: note: instantiated into assembly here
:info:build           pushl %ebx
:info:build           ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:94:8: error: instruction requires: Not 64-bit mode
:info:build       "  popl %%ebx\n"
:info:build        ^
:info:build <inline asm>:4:3: note: instantiated into assembly here
:info:build   popl %ebx
:info:build   ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:91:7: error: instruction requires: Not 64-bit mode
:info:build       "  pushl %%ebx\n"
:info:build       ^
:info:build <inline asm>:1:4: note: instantiated into assembly here
:info:build           pushl %ebx
:info:build           ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:94:8: error: instruction requires: Not 64-bit mode
:info:build       "  popl %%ebx\n"
:info:build        ^
:info:build <inline asm>:4:3: note: instantiated into assembly here
:info:build   popl %ebx
:info:build   ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:91:7: error: instruction requires: Not 64-bit mode
:info:build       "  pushl %%ebx\n"
:info:build       ^
:info:build <inline asm>:1:4: note: instantiated into assembly here
:info:build           pushl %ebx
:info:build           ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:94:8: error: instruction requires: Not 64-bit mode
:info:build       "  popl %%ebx\n"
:info:build        ^
:info:build <inline asm>:4:3: note: instantiated into assembly here
:info:build   popl %ebx
:info:build   ^
:info:build ../orc-0.4.30/orc/orccpu-x86.c:91:7: error: instruction requires: Not 64-bit mode
:info:build       "  pushl %%ebx\n"
:info:build       ^
:info:build <inline asm>:1:4: note: instantiated into assembly here
:info:build           pushl %ebx
:info:build           ^
:info:build fatal error: too many errors emitted, stopping now [-ferror-limit=]
:info:build 20 errors generated.

Attachments (1)

orc-fail-10.6.8.log (97.0 KB) - added by kencu (Ken) 5 years ago.

Download all attachments as: .zip

Change History (12)

Changed 5 years ago by kencu (Ken)

Attachment: orc-fail-10.6.8.log added

comment:1 Changed 5 years ago by kencu (Ken)

this hack fixes it, on my system at least:

$ cat patch-orc-meson-build-override-cpu-choice.diff
--- meson.build.orig	2019-10-28 12:47:16.000000000 -0700
+++ meson.build	2019-10-28 12:48:22.000000000 -0700
@@ -54,7 +54,7 @@
 
 cpu_family = host_machine.cpu_family()
 if cpu_family == 'x86'
-  cdata.set('HAVE_I386', true)
+  cdata.set('x86_64', true)
 elif cpu_family == 'x86_64'
   cdata.set('HAVE_AMD64', true)
 elif cpu_family == 'ppc' or cpu_family == 'ppc64'

Edit: -- looking at this now, this doesn't look like what worked. I'll try it again. It should be this instead, I think. I'll verify that later today -- still a hack, though, and not an acceptable fix for an actual port patch:

$ cat patch-orc-meson-build-override-cpu-choice.diff
--- meson.build.orig	2019-10-28 12:47:16.000000000 -0700
+++ meson.build	2019-10-28 12:48:22.000000000 -0700
@@ -54,7 +54,7 @@
 
 cpu_family = host_machine.cpu_family()
 if cpu_family == 'x86'
-  cdata.set('HAVE_I386', true)
+  cdata.set('HAVE_AMD64', true)
 elif cpu_family == 'x86_64'
   cdata.set('HAVE_AMD64', true)
 elif cpu_family == 'ppc' or cpu_family == 'ppc64'
Last edited 5 years ago by kencu (Ken) (previous) (diff)

comment:2 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

That doesn't look accurate. I haven't looked at this build system, but wouldn't the CPU family be "x86" on 32-bit Intel Macs? If so, setting "x86_64" to "true" would be wrong.

Perhaps the build system is misusing the output of uname -m (which returns "i386" when using the 32-bit kernel and "x86_64" when using the 64-bit kernel but even the 32-bit kernel can happily run 64-bit programs on 64-bit systems).

I can't find this cpu_family in the orc source code. Maybe it's a feature of meson.

comment:3 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

https://mesonbuild.com/Reference-tables.html#cpu-families

These are returned by the cpu_family method of build_machine, host_machine and target_machine

x86 32 bit x86 processor
x86_64 64 bit x86 processor

comment:5 Changed 5 years ago by kencu (Ken)

It's certainly not an accurate fix -- that's why I left it here in this ticket. But it does fix it on my system, as a hack.

I think this is similar to why OpenBLAS is broken on < 10.7. The system reports itself being i386 in uname, etc, but it's really x86_64, and so during the build it tries to build i386 code as x86_64 and fails -- just like OpenBLAS does.

I have a fix worked out for OpenBLAS, by querying sysctl and probing for 64bit-capable, that I haven't sent up to MacPorts because .. well. But anyway, perhaps the same kind of sysctl probing fix would work out here.

comment:6 Changed 5 years ago by kencu (Ken)

BTW, I did try a few variations changing the code to look at target machine, etc, but that didn't seem to return 64bit on any variation I tried. I might have missed one variation that works, can't verify I tried every one.

This is probably a very MacOSX-legacy edge case; we might need to fix this ourselves, rather than expect meson to accommodate it...

comment:7 Changed 5 years ago by kencu (Ken)

I just had to build orc again and used this trade successfully, as mentioned above, to force the compiler detection on 10.6.8.

cpu_family = host_machine.cpu_family()
 if cpu_family == 'x86'
-  cdata.set('HAVE_I386', true)
+  cdata.set('HAVE_AMD64', true)

comment:8 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

And again, as far as I can tell, that would be telling the build system "if the system is 32-bit, build for 64-bit" which would not be correct. Instead, you should be fixing whatever it is that is erroneously identifying your system as 32-bit.

The system reports itself being i386 in uname, etc, but it's really x86_64

uname -m indicates the kernel architecture. Anybody using it to decide the userland build architecture is using it wrong.

But I cannot find any place where meson is using uname -m. Rather, meson seems to be deciding that Intel systems are 32-bit if the preprocessor define __i386__ is defined. That should only be the case when compiling for 32-bit (-arch i386), which you're not, so I don't know where this is going wrong.

Meson is a build system. As such it should work on the widest possible range of systems. If this is a meson bug, then there's no reason to assume they would not want to fix it.

comment:9 Changed 5 years ago by kencu (Ken)

Yes, of course, just wanted to be clear for those who stumbly by later how to get past the error of the moment and move on.

I'm afraid I am not really sure what the right approach might be for the meson devs to sort this out for the general case.

"You have a 64bit processor running a 32bit kernel supporting a 64bit operating system building +universal for both 32bit and 64bit architectures ... " I'm not sure I would take this upstream -- I can only tolerate so much abuse :>

comment:10 Changed 4 years ago by kencu (Ken)

Resolution: fixed
Status: newclosed

comment:11 Changed 4 years ago by kencu (Ken)

fixed by the mson cross-file implementation I added to meson

Note: See TracTickets for help on using tickets.