#57797 closed defect (fixed)

OpenBLAS @0.3.4_1 forces system AR and RANLIB but this errors on older systems

Reported by: kencu (Ken) Owned by: NicosPavlov
Priority: Normal Milestone:
Component: ports Version:
Keywords: snowleopard leopard Cc: michaelld (Michael Dickens)
Port: openblas

Description (last modified by kencu (Ken))

The Portfile does this:

# Using system ones as default is set to bin/gcc-ar which does not
# exist, and using gcc-mp ones end up in an error about a missing
# plugin. (see ticket #38551 for example)
build.args          "AR=/usr/bin/ar RANLIB=/usr/bin/ranlib"

but on some systems, that results in the following, because the system cctools are too old to understand the objects coming out of the newer compilers (usually clang-3.9+):

ar: creating archive ../libopenblas-r1.a
/usr/bin/ranlib: object: ../libopenblas-r1.a(comatcopy.o) malformed object (unknown load command 2)
/usr/bin/ar: internal ranlib command failed
make[1]: *** [libs] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_math_OpenBLAS/OpenBLAS/work/OpenBLAS-0.3.4/interface'

I don't presently have a well-thought-out plan for what to do with this issue. This force went into the Portfile a long time ago for a gcc related issue. Probably need to have a dependency on cctools and then force the build to use those, but which systems crossed with which compilers has not been fully worked out yet.

Change History (11)

comment:1 Changed 22 months ago by kencu (Ken)

Description: modified (diff)

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

OpenBLAS builds on all the builders it seems. It's only when newer compilers are defaulted on older systems that this comes up. Fix is:

depends_build-append port:cctools
build.args           "AR=${prefix}/bin/ar RANLIB=${prefix}/bin/ranlib"

for anyone who stumbles upon this.

comment:3 Changed 22 months ago by NicosPavlov

Thanks for the comment. I did not notice, but it indeed seems that forcing the use of system's ar and ranlib is not needed anymore in several cases.

I tried on Mojave, and several combinations of compilers build properly even without that line in the Portfile.

comment:4 Changed 22 months ago by kencu (Ken)

I was going to suggest just removing the line, but in fact I got an error. I didn't record it -- something like /opt/local/bin/mp-ar not found, IIRC.

So ... dunno. Probably could fix it with a combo of system < 10 and configure.compiler matches *clang* tests, if we wanted to .

I can do that sometime in the next while if you like.

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

comment:5 Changed 21 months ago by michaelld (Michael Dickens)

I encountered this issue today when trying to get OpenBLAS to install on 10.6 (along with that it uses the wrong compiler, but that's a different issue). My fix is to tweak the line in question to just read "AR=${prefix}/bin/ar" and "RANLIB=${prefix}/bin/ranlib" and then add "depends_build-append port:cctools". This works for me on 10.6 and 10.14 ... so, guessing it will also on other Intel systems inbetween. I don't think OpenBLAS can compile on PPC anyway, so that would leave just OSX 10.[45] Intel systems that I can't do testing on since I don't have an install available to do so. is this a reasonable solution?

comment:6 Changed 21 months ago by michaelld (Michael Dickens)

@kencu: just saw your "fix" above, same as mine LOL.

comment:7 Changed 21 months ago by michaelld (Michael Dickens)

My vote here: If Ken's (and now my) change works and adds just "cctools" as a dependency, then let's go with it.

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

Looks like with some motivation we might get OpenBLAS to build on PPC (there is a Power makefile to use as a starting point). Dunno if there is any interest. I just tried for a lark and got nowhere with the current Portfile.

I have only seen the AR & RANLIB errors on 10.6 and less so far, and only with newer clangs (3.9+). But enabling it in all cases for systems < 10.7 seems like an easy fix and harmless to me. Another thing it would be nice to do in base, if all builds respected those env vars.

comment:9 Changed 21 months ago by michaelld (Michael Dickens)

I tried for a bit on PPC as well & got nowhere ... fast or slow! I tried doing the build by hand & got nowhere. I'm just thinking of disabling OpenBLAS for PPC for the moment. Got bigger fish to fry right now!

comment:10 Changed 21 months ago by michaelld (Michael Dickens)

I'm going to go ahead with our change then. It seems to work where needed & doesn't seem to harm otherwise.

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

Resolution: fixed
Status: assignedclosed

In f11769c79eda6b36f352fad663e307fac5fe636b/macports-ports (master):

OpenBLAS: use AR and RANLIB from port:cctools for building

Fixes build on older OSX, and doesn't seem to harm newer OSX.

Closes: #57797

Note: See TracTickets for help on using tickets.