Fix _xerbla_ linking on older Mac versions #4353
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See issue #4347 for problem description. The symbol
_xerbla_
was missing from thelibopenblas.a
archive file, so weak linking was introduced for Darwin < 20 in PR #4348. This allowed OpenBLAS to compile on older Mac versions, but it did not actually fix the problem. The error would instead show up when trying to load the library, for example through NumPy:I found out that OpenBLAS builds two
xerbla.c.o
files, only one of which contains symbols, and links in the one with symbols explicitly on Darwin < 20. However, its timestamp is older than the object file without symbols, soar -ru
does nothing. Thus, the_xerbla_
symbol will never be present in the final library.My proposal is to write
xerbla.c.o
into the archive usingar -rs
instead of allowing weak linking. With that option, thexerbla.c.o
with symbols is written into the archive regardless of compilation order.(Link to my bug report to MacPorts: https://trac.macports.org/ticket/68810)