# Curious linker error for libgsl past GHC 9.6

**URL:** <https://discourse.haskell.org/t/curious-linker-error-for-libgsl-past-ghc-9-6/13426>\
**Category:** Learn\
**Created:** [December 18, 2025, 1:33pm UTC](https://discourse.haskell.org/t/curious-linker-error-for-libgsl-past-ghc-9-6/13426 "2025-12-18T13:33:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmplt](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/tmplt/32/5377_2.png) [@tmplt](https://discourse.haskell.org/u/tmplt)\
**Post date:** [December 18, 2025, 1:33pm UTC](https://discourse.haskell.org/t/curious-linker-error-for-libgsl-past-ghc-9-6/13426/1 "2025-12-18T13:33:32Z")

</div>

I’m working on a library that uses `hmatrix-gsl`. Past GHC 9.6 I’m getting confusing linker errors for `libgsl.so: undefined symbol: cblas_ctrmv`. An `LD_PRELOAD=/nix/store/<HASH>-gsl-2.8/lib/libgslcblas.so` fixes the issue, but I do not understand why the symbol is no longer resolved in later toolchain versions; the same `libgslcblas.so` shows up in `ldd` for both builds, after all.

I’m using Nix and haskell-flake, and have an MWE available via [GitHub - tmplt/hmatrix-gsl-mwe](https://github.com/tmplt/hmatrix-gsl-mwe)

This issue was originally posted at [libgslcblas link issue past GHC 9.6 · srid/haskell-flake · Discussion #464 · GitHub](https://github.com/srid/haskell-flake/discussions/464) , but this feels more like a Cabal issue, so I’m trying here.

Any help appreciated!

---

<div class="post-metadata">

**Author:** ![sergv](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/sergv/32/4700_2.png) [@sergv](https://discourse.haskell.org/u/sergv)\
**Post date:** [December 23, 2025, 11:43pm UTC](https://discourse.haskell.org/t/curious-linker-error-for-libgsl-past-ghc-9-6/13426/2 "2025-12-23T23:43:56Z")

</div>

After briefly looking around I notice that `hmatrix-gsl` package does have an `onlygsl` flag. When enabled it will use linking flags obtained from pkg-config which seem to specify `gslcblas` which is what you seem to be after.

> <https://github.com/haskell-numerics/hmatrix/blob/master/packages/gsl/hmatrix-gsl.cabal#L19C1-L22C1>

Your hunch about cabal (meaning cabal-install, the executable) might be correct - cabal might or may not decide to turn this flag on when you upgrade to a different cabal version. The fix is to pass the flags you want explicitly. How to do it with nix is another matter.

---

<div class="post-metadata">

**Author:** ![tmplt](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/tmplt/32/5377_2.png) [@tmplt](https://discourse.haskell.org/u/tmplt)\
**Post date:** [January 8, 2026, 4:13pm UTC](https://discourse.haskell.org/t/curious-linker-error-for-libgsl-past-ghc-9-6/13426/3 "2026-01-08T16:13:36Z")

</div>

Thanks for the suggestion. I’ve updated the MWE to include development environments for both builds: both use cabal 3.16.0.0. Turning flags on/off yielded the same results. Perhaps this is a Nix issue. I’ll leave this open until I find the source of the issue.
