#58263 closed defect (fixed)

OpenBLAS fails for missing _cpuid_count

Reported by: rmottola (Riccardo) Owned by: NicosPavlov
Priority: Normal Milestone:
Component: ports Version:
Keywords: i386 Cc: michaelld (Michael Dickens)
Port: OpenBLAS

Description (last modified by ryandesign (Ryan Schmidt))

On Leopard i386, OpenBLAS fails to compile, failure:

--->  Building OpenBLAS
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_OpenBLAS/OpenBLAS/work/OpenBLAS-0.3.5" && /usr/bin/make -j2 -w all AR=/opt/local/bin/ar RANLIB=/opt/local/bin/ranlib 
Undefined symbols for architecture i386:
  "_cpuid_count", referenced from:
      _get_cacheinfo in getarch-04fdc3.o
ld: symbol(s) not found for architecture i386

Attachments (1)

patch-openblas-cpuid-fallback-on-less-than-SL.diff (507 bytes) - added by kencu (Ken) 19 months ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 19 months ago by ryandesign (Ryan Schmidt)

Cc: NicosPavlov removed
Description: modified (diff)
Keywords: leopard added; Leopard removed
Owner: set to NicosPavlov
Status: newassigned

Indeed, leopard is too old to have _cpuid_count built in. It could be added with a patch, as was done previously for other ports, like php in [d242053632fa2c95c0b88e3ddeef744d32236093/macports-ports].

Or maybe our legacy support port now offers (or could be changed to offer) this.

comment:2 Changed 19 months ago by kencu (Ken)

show us the whole log, I think, Riccardo. Maybe it's just a gcc thing, and you could get the port to build with clang. I don't see cpuid_count anywhere in my headers, but OpenBLAS builds fine for me on 10.6.8 with clang-5.0.

comment:3 Changed 19 months ago by kencu (Ken)

There are a bunch of implementations of cpuid_count in cpuid_x86.c --- maybe we just have to make one of them activate.

comment:4 Changed 19 months ago by michaelld (Michael Dickens)

I don't have an OSX 10.5 Intel boot drive up and running yet to test / verify. Hopefully Ken can handle this one.

comment:5 Changed 19 months ago by rmottola (Riccardo)

@Ken - I jusst tried building with clang 3.9 and 5.0 yet I get the same error. I attach the build log (after clean). I am on i386 and 10.5, maybe you have amd64 ?

comment:6 Changed 19 months ago by kencu (Ken)

please try this:

diff --git cpuid_x86.c cpuid_x86.c
index eb986b6..63c5270 100644
--- cpuid_x86.c
+++ cpuid_x86.c
@@ -87,7 +87,7 @@ void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, int *edx)
 #ifndef CPUIDEMU
-#if defined(__APPLE__) && defined(__i386__)
+#if defined(__APPLE__) && defined(__i386__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
 void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx);
 void cpuid_count(int op, int count, int *eax, int *ebx, int *ecx, int *edx);

Changed 19 months ago by kencu (Ken)

comment:7 Changed 19 months ago by kencu (Ken)

hmm. that goes a long way, but eventually fails for me with another different error in the fortran code. Somehow, don't know how or why yet, lapack-netlib is thinking it's on a MIPS machine and enables a MIPS-specific abi call that fails. I am not yet sure why that happens, but in the end, just edited by hand lapack-netlib/make.inc and removed the offending -mabi=n32 option, and on it goes again.

comment:8 Changed 19 months ago by kencu (Ken)

the automatic ARCH detection seems to be failing on Intel Leopard. I don't know why yet, but forcing it in the Portfile with:

 puts $makeINC "ARCH=x86"


$ port -v installed openblas
The following ports are currently installed:
  OpenBLAS @0.3.5_1+gcc7+lapack (active) platform='darwin 9' archs='i386' date='2019-04-06T16:17:08-0700'

Needs a bit more cleaning up -- either figure out and fix the ARCH detection, or alternatively figure out and force it correctly in the Portfile.

Also, Leopard's python was too old, so I spec'd current pythons with sudo port select for all the pythons.

Last edited 19 months ago by kencu (Ken) (previous) (diff)

comment:9 Changed 19 months ago by jmroot (Joshua Root)

Keywords: leopard removed

comment:10 Changed 19 months ago by kencu (Ken)

that's a helpful clue, thank you.

comment:11 Changed 19 months ago by michaelld (Michael Dickens)

I'll try building on my 10.6 boot drive ... maybe today if my builds get there ... but certainly this week (if Ken doesn't fix it first LOL)

comment:12 Changed 19 months ago by kencu (Ken)

FYI OpenBlAS 64bit installs without intervention on my 10.6.8 box:

OpenBLAS @0.3.5_1+gcc6+lapack (active) platform='darwin 10' archs='x86_64' date='2019-01-29T23:39:19-0800'

So this is smelling like perhaps an Intel 32bit issue...

comment:13 Changed 19 months ago by rmottola (Riccardo)

Indeed, I have OpenBLAS installed on 10.6.8 64bit and did not even notice. So it seems indeed a 32bit issue more than an OS version issue.

comment:14 Changed 19 months ago by kencu (Ken)

i believe I have this fixed. Just sorting the last bits.

comment:15 Changed 19 months ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

In bd10d11a93fdd3e94d2e34b5dbe6860b7de0ad4e/macports-ports (master):

OpenBLAS: enable build on Apple i386

closes: #58263

Note: See TracTickets for help on using tickets.