Link Givaro and BLAS directly into all precompiled libraries - #420
Merged
ClementPernet merged 1 commit intoAug 26, 2026
Merged
Conversation
With --enable-precompilation, only libfflas listed $(GIVARO_LIBS); libffpack,
libfflas_c and libffpack_c were given a bare libtool archive and relied on
Givaro being reachable through it. libtool does not propagate it: when
linkmode is lib, ltmain.sh copies a dependency's dependency_libs into the
.la file's record, but the only thing it adds to the actual link command is
the -L search paths -- the matching -l flags are never passed on.
On ELF this merely underlinks the three libraries (they resolve Givaro
through libfflas.so's DT_NEEDED), but on Mach-O, where a symbol must come
from a library named directly on the link line, it is fatal:
Undefined symbols for architecture x86_64:
"Givaro::Integer::operator%(unsigned long long) const", referenced from:
Givaro::Modular<double, double, void>::init(double&, Givaro::Integer const&) const in fflas_lvl1.o
All four sources include givaro/modular.h and instantiate Givaro::Modular
inline, and -DFFLAS_COMPILED is never set for these objects, so Givaro is a
direct dependency of each of them, not a transitive one. BLAS is listed for
the same reason: configure restores LIBS after its BLAS probes, so
$(BLAS_LIBS) only reaches these link lines by accident today.
The underlinkage is reproducible on Linux by adding -Wl,--no-undefined to
the pre-patch link command, which fails on the same symbol.
Fixes linbox-team#391
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Member
|
This looks good to me. Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I had Claude take a look at #391, which turned up while investigating Macaulay2/homebrew-tap#349.
The fix is simple (just add some missing library flags), and here's some before and after logs:
Claude's commit message:
With --enable-precompilation, only libfflas listed $(GIVARO_LIBS); libffpack, libfflas_c and libffpack_c were given a bare libtool archive and relied on Givaro being reachable through it. libtool does not propagate it: when linkmode is lib, ltmain.sh copies a dependency's dependency_libs into the .la file's record, but the only thing it adds to the actual link command is the -L search paths -- the matching -l flags are never passed on.
On ELF this merely underlinks the three libraries (they resolve Givaro through libfflas.so's DT_NEEDED), but on Mach-O, where a symbol must come from a library named directly on the link line, it is fatal:
Undefined symbols for architecture x86_64:
"Givaro::Integer::operator%(unsigned long long) const", referenced from:
Givaro::Modular<double, double, void>::init(double&, Givaro::Integer const&) const in fflas_lvl1.o
All four sources include givaro/modular.h and instantiate Givaro::Modular inline, and -DFFLAS_COMPILED is never set for these objects, so Givaro is a direct dependency of each of them, not a transitive one. BLAS is listed for the same reason: configure restores LIBS after its BLAS probes, so $(BLAS_LIBS) only reaches these link lines by accident today.
The underlinkage is reproducible on Linux by adding -Wl,--no-undefined to the pre-patch link command, which fails on the same symbol.
Fixes #391