I did a test build of gsl-ocaml 1.25.0 for Fedora Rawhide and got a library that was linked with gsl, but not with any blas library, so there are unresolved symbols. There are multiple factors involved:
Fedora adds -Wl,--as-needed to the default linker flags
Fedora uses flexiblas as the blas library, so we set GSL_CBLAS_LIB in in the ocaml-gsl build
In discover.ml, the GSL_CBLAS_LIB case adds the blas library at the front of the linker flags, before -lgsl.
When the blas library is linked, it doesn't resolve any symbols, since gsl-ocaml itself does not directly use them. Because of -Wl,--as-needed, the blas library is therefore not linked into the final ELF object.
This PR moves the blas library after -lgsl so that it is used to resolve symbols in libgsl.
I did a test build of gsl-ocaml 1.25.0 for Fedora Rawhide and got a library that was linked with gsl, but not with any blas library, so there are unresolved symbols. There are multiple factors involved:
-Wl,--as-needed
to the default linker flagsGSL_CBLAS_LIB
in in the ocaml-gsl buildGSL_CBLAS_LIB
case adds the blas library at the front of the linker flags, before-lgsl
.When the blas library is linked, it doesn't resolve any symbols, since gsl-ocaml itself does not directly use them. Because of
-Wl,--as-needed
, the blas library is therefore not linked into the final ELF object.This PR moves the blas library after
-lgsl
so that it is used to resolve symbols in libgsl.