`.so` dependencies of `gd` library have `undefined reference` errors

Hello,

I have a Flake using haskell.nix: GitHub - input-output-hk/haskell.nix: Alternative Haskell Infrastructure for Nixpkgs

The devShell is defined here: hackage-server/flake.nix at 8794c621fb8aa6d71de38115652a4f03f56b82bf · haskell/hackage-server · GitHub

I am having difficulty with the library gd: NixOS Search
Its dependencies such as libjpeg, libpng, libtiff, libavif, etc. are specified: hackage-server/flake.nix at 8794c621fb8aa6d71de38115652a4f03f56b82bf · haskell/hackage-server · GitHub

In the devShell, cabal build all --enable-tests produces errors like:

...
/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: 
/nix/store/sfmkdpd7kllp4zva989y74mwcm6bm14g-libavif-0.11.1/lib/libavif.so.15: 
undefined reference to `kYvu2020Constants'

/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: 
/nix/store/4zby3xg4dayz4vfd00b9cxz9rgyr4wkr-libtiff-4.5.0/lib/libtiff.so.6:
undefined reference to `lzma_stream_encoder@XZ_5.0'

collect2: error: ld returned 1 exit status

Furthermore, LD_LIBRARY_PATH is specified:

LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;

Any ideas? Thank you

I should have looked higher in the output, there were more warnings about missing libraries:

      pkgs.libdeflate
      pkgs.libaom
      pkgs.libjxl
      pkgs.libyuv
      pkgs.dav1d
      pkgs.libvmaf

On to the next issue

Any ideas? Thx

/nix/store/r2b9k28c6aghczpqfvh71y9xavm7rr68-binutils-2.39/bin/ld: 
/nix/store/m0n83dbmv5kd95f8bbfh76m8ipwcpybw-libvmaf-2.3.1/lib/libvmaf.so.1: 
undefined reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)@GLIBCXX_3.4'

Isolated example here: failure to build `gd` Hackage library in `nix develop` shell · Issue #1865 · input-output-hk/haskell.nix · GitHub

Sounds suspiciously similar to build-support/cc-wrapper: revert "pass in non-existent --sysroot= to … by trofi · Pull Request #213185 · NixOS/nixpkgs · GitHub. Does your nixpkgs input contain the fix?

1 Like

are you locked into IOHK’s haskell.nix or do have the options are using something else?

1 Like

no, I’ve also considered GitHub - srid/haskell-flake: A flake-parts Nix module for Haskell development which is apparently leaner and newer

I haven’t gotten the pinned hackagePackages correct with that, yet, but it looks like a promising alternative

maybe give https://horizon-haskell.net/

It may fit your needs.

These two alternatives, try to be much cleaner and simpler!

1 Like