LumiGuide / haskell-opencv

Haskell binding to OpenCV-3.x
Other
154 stars 44 forks source link

Build fails on MacOS: new release needed? #137

Open purcell opened 5 years ago

purcell commented 5 years ago

Hi! I naïvely tried to use opencv 0.0.2.1 in a Stack project on MacOS, and while compilation looked to be going well, it failed with the following error:

    [55 of 71] Compiling OpenCV.ImgProc.MiscImgTransform ( src/OpenCV/ImgProc/MiscImgTransform.hs, .stack-work/dist/x86_64-osx/Cabal-2.2.0.1/build/OpenCV/ImgProc/MiscImgTransform.o )
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    [56 of 71] Compiling OpenCV.ImgProc.ImgFiltering ( .stack-work/dist/x86_64-osx/Cabal-2.2.0.1/build/OpenCV/ImgProc/ImgFiltering.hs, .stack-work/dist/x86_64-osx/Cabal-2.2.0.1/build/OpenCV/ImgProc/ImgFiltering.o )
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]
    [57 of 71] Compiling OpenCV.ImgProc.GeometricImgTransform ( .stack-work/dist/x86_64-osx/Cabal-2.2.0.1/build/OpenCV/ImgProc/GeometricImgTransform.hs, .stack-work/dist/x86_64-osx/Cabal-2.2.0.1/build/OpenCV/ImgProc/GeometricImgTransform.o )
    clang: warning: argument unused during compilation: '-nopie' [-Wunused-command-line-argument]

    /private/var/folders/hc/w17tmcyn47j16fs8h4rb3_6w0000gn/T/ghc8956_0/ghc_654.cpp:140:15: error:
         error: expected expression
                    , {}
                      ^
        |
    140 |             , {}
        |               ^
    1 error generated.
    `gcc' failed in phase `C Compiler'. (Exit code: 1)

This was on MacOS 10.14.2, with OpenCV 3.4.3_2 from homebrew, stack resolver lts-12.24, and extra-deps as follows:

extra-deps:
  - opencv-0.0.2.1
  - inline-c-cpp-0.2.1.0

It looks like this was perhaps the issue reported in #121 and fixed in #122, and indeed by depending on the git version of opencv it looks like I've got things working, but perhaps you'd consider pushing a new release so that's not necessary?

basvandijk commented 5 years ago

We're planning to publish a new release during the Christmas holidays.

purcell commented 5 years ago

W00t! Well, don't let it get in the way of Christmas relaxation. :-)

I should add that this package has been very helpful in the toy project I'm working on, and I hope to find opportunities to make contributions as time allows.

davetapley commented 5 years ago

Hi @basvandijk and @purcell, I should have some more time to work on my project which is using haskell-opencv.

I see there hasn't been too much activity on the repo lately, what's your statuses?

purcell commented 5 years ago

I see there hasn't been too much activity on the repo lately, what's your statuses?

Nothing new on my side, but I think a new release is still needed. In the meantime I'm using Stack to build against the dev version:

extra-deps:
  - inline-c-0.7.0.1@sha256:dece4a0d587e21b8c8987619ffeeab5da3c4c55db47d6ddf4568d7adaa05d5c1
  - inline-c-cpp-0.3.0.1@sha256:916ffd22c097f399a47f6ddb9313e2ce36d8051755dd702c23f8d20a370fee09
  - git: https://github.com/LumiGuide/haskell-opencv.git
    commit: 0d0c1cbe2dd8e7705f6785c8bd4645cd18faebfb
    subdirs: [ opencv ]

Note also that OpenCV 3.x is needed, so now on MacOS with Homebrew it's necessary to brew install opencv@3, and then set PKG_CONFIG_PATH for GHC to find the libraries, e.g.

env PKG_CONFIG_PATH="/usr/local/opt/opencv@3/lib/pkgconfig" stack build
purcell commented 5 years ago

With the latest Stack and Stackage LTS, building via the above method no longer works, sadly:

% env PKG_CONFIG_PATH="/usr/local/opt/opencv@3/lib/pkgconfig" stack build
Cloning 56fe65de2f5b1df9b090f55bc43ea6e49d183f55 from https://github.com/LumiGuide/haskell-opencv.git
Unsupported tarball from /private/var/folders/hc/w17tmcyn47j16fs8h4rb3_6w0000gn/T/with-repo-archive31827/foo.tar: Symbolic link dest not found from doc/generated/dummy.png to ../../data/dummy.png, looking for doc/../data/dummy.png.
This may indicate that the source is a git archive which uses git-annex.
See https://github.com/commercialhaskell/stack/issues/4579 for further information.
make: *** [build] Error 1

I wonder if the dummy symlink is necessary, since that's what appears to be the problem.

Alternatively, could you cut a new release on Hackage at this stage?