[Nix-dev] How to build a Haskell binding to a C++ library (OpenCV) on OS X
Vincent Laporte
vincent.laporte at gmail.com
Mon Jun 19 17:00:12 CEST 2017
Hi,
Notice that if you replace the two occurrences of ‘g++’ by ‘clang++’ in
the file ‘opencv/Setup.hs’, then ‘nix-build’ succeeds.
This issue might be reported upstream: they apparently need a configure
step to select the correct name of the C++ compiler.
The following patch also appears to make ‘nix-build’ work.
Regards,
--
Vincent.
```
diff --git a/opencv/Setup.hs b/opencv/Setup.hs
index 031daa1..3c92176 100644
--- a/opencv/Setup.hs
+++ b/opencv/Setup.hs
@@ -3,6 +3,6 @@ import System.Environment ( getArgs )
main = do
args <- getArgs
- let args' | "configure" `elem` args = args ++ ["--with-gcc","g++",
"--with-ld","g++"]
+ let args' | "configure" `elem` args = args
| otherwise = args
defaultMainArgs args'
diff --git a/opencv/opencv.nix b/opencv/opencv.nix
index a28674c..80ed995 100644
--- a/opencv/opencv.nix
+++ b/opencv/opencv.nix
@@ -103,8 +103,8 @@ mkDerivation ({
libraryPkgconfigDepends = [ opencv3 ];
configureFlags =
- [ "--with-gcc=g++"
- "--with-ld=g++"
+ [ "--with-gcc=${stdenv.cc}/bin/c++"
+ "--with-ld=${stdenv.cc}/bin/c++"
];
hardeningDisable = [ "bindnow" ];
```
More information about the nix-dev
mailing list