[Nix-dev] How to build a Haskell binding to a C++ library (OpenCV) on OS X

Bas van Dijk v.dijk.bas at gmail.com
Mon Jun 19 19:05:36 CEST 2017


Thanks Vincent, you are spot on!

I went with the following change:

https://github.com/LumiGuide/haskell-opencv/commit/6b78bc4c431d693b0bc828cc86708882a26f777c

Bas

On 19 June 2017 at 17:00, Vincent Laporte <vincent.laporte at gmail.com> wrote:

> 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" ];
> ```
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> https://mailman.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.science.uu.nl/pipermail/nix-dev/attachments/20170619/210dda32/attachment.html>


More information about the nix-dev mailing list