Skip to content

Link Givaro and BLAS directly into all precompiled libraries - #420

Merged
ClementPernet merged 1 commit into
linbox-team:masterfrom
d-torrance:fix-precompiled-libadd
Aug 26, 2026
Merged

Link Givaro and BLAS directly into all precompiled libraries#420
ClementPernet merged 1 commit into
linbox-team:masterfrom
d-torrance:fix-precompiled-libadd

Conversation

@d-torrance

Copy link
Copy Markdown
Contributor

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

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>
@ClementPernet

Copy link
Copy Markdown
Member

This looks good to me. Thanks.

@ClementPernet
ClementPernet merged commit 788f6c9 into linbox-team:master Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fflas-ffpack master: Build fails on macOS

2 participants