Skip to content

Link failure on the cabal-2.2 branch #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
basvandijk opened this issue May 21, 2018 · 2 comments
Closed

Link failure on the cabal-2.2 branch #116

basvandijk opened this issue May 21, 2018 · 2 comments

Comments

@basvandijk
Copy link
Contributor

basvandijk commented May 21, 2018

I get the following on the cabal-2.2 branch:

$ 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.
@zimbatm
Copy link

zimbatm commented May 22, 2018

"cannot find -lm" is quite surprising, it's like it's trying to open -lm as a file. It would be nice to find out how ld is being invoked. Maybe write a wrapper script for ld?

#!/bin/sh
echo "ld args: $*" >&2
exec /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/ld "$@"

basvandijk added a commit that referenced this issue May 23, 2018
@basvandijk
Copy link
Contributor Author

@zimbatm Thanks, that's an excellent idea. In the process of implementing it I removed the --with-ld c++ override in Setup.hs and then the build suddenly succeeded.

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

No branches or pull requests

2 participants