Hi there,
I’m upgrading the haskell-opencv library to use cabal-version: 2.2 because that version supports the new cxx-options field that I would like to use. So I’m trying to build the library using GHC-8.4.2 because that ships with Cabal-2.2.
Unfortunately I’m getting a link error when building the library using nix-build. Surprisingly building inside a nix-shell succeeds. Details and error messages are in this GitHub issue:
opened 10:51PM - 21 May 18 UTC
closed 09:14AM - 23 May 18 UTC
I get the following on the [cabal-2.2 branch](https://github.com/LumiGuide/haske… ll-opencv/tree/cabal-2.2):
```
$ nix-build -A haskell.packages.ghc842.opencv
...
[76 of 77] Compiling OpenCV.Juicy ( src/OpenCV/Juicy.hs, dist/build/OpenCV/Juicy.p_o )
[77 of 77] Compiling OpenCV.VideoIO.VideoWriter ( src/OpenCV/VideoIO/VideoWriter.hs, dist/build/OpenCV/VideoIO/VideoWriter.p_o )
/nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/ld: cannot find -lm
/nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/ld: cannot find -lgcc_s
/nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/ld: cannot find -lc
/nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
```
The build succeeds if I run it manually:
```
$ nix-shell -A haskell.packages.ghc842.opencv.env
$ cd opencv
$ ghc --make Setup.hs
$ ./Setup configure --enable-tests
$ ./Setup build
$ ./Setup test
Running 2 test suites...
Test suite test-opencv: RUNNING...
Test suite test-opencv: PASS
Test suite logged to: dist/test/opencv-0.0.2.1-test-opencv.log
Test suite doc-images-opencv: RUNNING...
Test suite doc-images-opencv: PASS
Test suite logged to: dist/test/opencv-0.0.2.1-doc-images-opencv.log
2 of 2 test suites (2 of 2 test cases) passed.
```
Any Haskell-Nix users that can help me out?
Thanks,
Bas