Opened 6 weeks ago

Last modified 5 weeks ago

#70105 new defect

oof2 opportunistically links to a random BLAS implementation

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: snarkhunter (Steve Langer), szhorvat (Szabolcs Horvát), catap (Kirill A. Korinsky), michaelld (Michael Dickens)
Port: oof2, flexiblas, OpenBLAS, blis

Description

Deactivated FlexiBLAS and noticed that oof2 got reported as broken. Lo and behold,

Could not open /opt/local/lib/libflexiblas.3.dylib: Error opening or reading file (referenced from /opt/local/lib/liboof2common.dylib)

I did not tell it to link to FlexiBLAS, I simply had that port installed.

This looks like the same or related bug as in #69538 and #69326

Apparently either Pythons are at fault or MacPorts fails to control what they do.

This should be fixed somehow on a general level, hopefully not just by conflicts_build :)

Change History (6)

comment:1 Changed 6 weeks ago by snarkhunter (Steve Langer)

oof2 uses CMake's findBLAS function, and then links to ${BLAS_LIBRARIES}. It is agnostic about which BLAS it uses. Since it can use Accelerate, it doesn't have an explicit BLAS dependency. Should it? Should it use a variant to specify which BLAS to link to?

comment:2 in reply to:  1 Changed 6 weeks ago by barracuda156

Replying to snarkhunter:

oof2 uses CMake's findBLAS function, and then links to ${BLAS_LIBRARIES}. It is agnostic about which BLAS it uses. Since it can use Accelerate, it doesn't have an explicit BLAS dependency. Should it? Should it use a variant to specify which BLAS to link to?

We should certainly make this controllable, otherwise it links to a random BLAS, MacPorts does not know about that, so once a user deactivates/uninstalls/updates that BLAS, port is broken. Probably just adding linear_algebra port group gonna work, but needs to be tested.

  1. S. AFAIK linear_algebra itself has an issue now, and my PR with a fix is stuck in a limbo for no reason, but anyway. Alternatively, if you are sure that the port must use Accelerate (for example), then other BLAS could be declared conflicts_build, and then they will not be accidentally picked. But better handle it via configure args, either via PR or manually.

comment:3 Changed 6 weeks ago by szhorvat (Szabolcs Horvát)

Ports that use standard CMake features to detect BLAS can usually just use the linear_algebra portgroup. Something like:

PortGroup           linear_algebra 1.0

pre-configure {
    # Link to chosen BLAS/LAPACK
    configure.args-append   ${cmake_linalglib}
}

This creates variants for each available BLAS.

Does this help? Note that I didn't look at oof2 in any detail.

Last edited 6 weeks ago by szhorvat (Szabolcs Horvát) (previous) (diff)

comment:4 Changed 5 weeks ago by snarkhunter (Steve Langer)

Yes, that helps. I was unaware of that port group. I'll submit a PR after I'm done testing locally.

Thanks!

comment:5 in reply to:  3 Changed 5 weeks ago by barracuda156

Replying to szhorvat:

Ports that use standard CMake features to detect BLAS can usually just use the linear_algebra portgroup. Something like:

I think it does not work correctly now, and I have a PR with a provisional fix, but more testing is welcome, or maybe you have a better idea. https://github.com/macports/macports-ports/pull/23395

comment:6 Changed 5 weeks ago by snarkhunter (Steve Langer)

With linear_algebra, oof2 is using the selected blas variant, as far as I can tell. otool -L says it's linking to the correct library, and deactivating the the blas package breaks oof2. What can I do to see if the linear_algebra bug is affecting it? I don't have access to older versions of macOS.

Note: See TracTickets for help on using tickets.