LumiGuide / haskell-opencv

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

Build fails on osx sierra - on building opencv #95

Open luntain opened 7 years ago

luntain commented 7 years ago

cd opencv && nix-shell fails:

[ 33%] Building CXX object modules/superres/CMakeFiles/opencv_superres.dir/opencl_kernels_superres.cpp.o
Undefined symbols for architecture x86_64:
  "_objc_setProperty_atomic", referenced from:
      -[CVWindow setSliders:] in window_cocoa.mm.o
      -[CVView setImage:] in window_cocoa.mm.o
      -[CVSlider setSlider:] in window_cocoa.mm.o
      -[CVSlider setName:] in window_cocoa.mm.o
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
[ 33%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/slice_layer.cpp.o
[ 33%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/softmax_layer.cpp.o
[ 33%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/split_layer.cpp.o
[ 34%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/tensorflow/tf_importer.cpp.o
[ 34%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/tensorflow/tf_io.cpp.o
[ 34%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/torch/THDiskFile.cpp.o
[ 34%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/torch/THFile.cpp.o
[ 34%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/torch/THGeneral.cpp.o
[ 34%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/torch/torch_importer.cpp.o
[ 35%] Linking CXX shared library ../../lib/libopencv_superres.dylib
[ 35%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/opencl_kernels_dnn.cpp.o
[ 35%] Built target opencv_superres
[ 35%] Linking CXX shared library ../../lib/libopencv_dnn.dylib
[ 35%] Built target opencv_dnn
make: *** [Makefile:163: all] Error 2
builder for ‘/nix/store/s66wklryprahb73s2zx6yv572550mp8h-opencv-3.2.0.drv’ failed with exit code 2
error: build of ‘/nix/store/s66wklryprahb73s2zx6yv572550mp8h-opencv-3.2.0.drv’ failed

Installing opencv-3.2.0 on its own via nix-1.11.13, it fails with a very similar error:

[ 47%] Linking CXX shared library ../../lib/libopencv_highgui.dylib
Undefined symbols for architecture x86_64:
  "_objc_setProperty_atomic", referenced from:
      -[CVWindow setSliders:] in window_cocoa.mm.o
      -[CVView setImage:] in window_cocoa.mm.o
      -[CVSlider setSlider:] in window_cocoa.mm.o
      -[CVSlider setName:] in window_cocoa.mm.o
ld: symbol(s) not found for architecture x86_64
basvandijk commented 7 years ago

That's strange. It works on my mid-2015 Mac Book Pro running Mac OS Sierra 10.12.4. What's your uname? Mine is:

$ uname -a
Darwin bassbox.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
basvandijk commented 7 years ago

Also note that installing haskell-opencv from nixpkgs works for me as well:

$ nix-channel --list
nixpkgs https://nixos.org/channels/nixpkgs-unstable

$ nix-channel --update
downloading Nix expressions from ‘https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-17.09pre111388.00512470ec/nixexprs.tar.xz’...
downloading ‘https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-17.09pre111388.00512470ec/nixexprs.tar.xz’... [0/0 KiB, 0.0 KiB/s]
unpacking channels...

$ nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion
"17.09pre111388.00512470ec"

$ nix-build '<nixpkgs>' -A haskellPackages.opencv
/nix/store/nlsyi2x8zssdi3s5gkf254njfrn1qigr-opencv-0.0.1.1

What do these commands return for you?

luntain commented 7 years ago
uname -a
Darwin iMac.local 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64 i386 iMac15,1 Darwin
$ nix-channel --list
nixpkgs https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --update
downloading Nix expressions from ‘https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-17.09pre111388.00512470ec/nixexprs.tar.xz’...
downloading ‘https://d3g5gsiof5omrk.cloudfront.net/nixpkgs/nixpkgs-17.09pre111388.00512470ec/nixexprs.tar.xz’... [0/0 KiB, 0.0 KiB/s]
unpacking channels...
created 2 symlinks in user environment
$ nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion"17.09pre111388.00512470ec"
$ nix-build '<nixpkgs>' -A haskellPackages.opencv
these paths will be fetched (316.36 MiB download, 2316.08 MiB unpacked):
  /nix/store/0rbd6npjcycczb91rii3ggd9aba7m7vd-old-locale-1.0.0.7
  /nix/store/0xmflq9r6g74vv3jm8nxdnll0d00z0jd-libwebp-0.6.0
  /nix/store/0zj01gc9lp5hy20lm7ya0qh58g19dxsl-clock-0.7.2
  /nix/store/1bxsgsxjapzlgqvcgsmfbn0n873cph2i-xz-5.2.3
  /nix/store/1myiai5ykqf3y93vpkn4xdlvdm78jgir-bindings-DSL-1.0.23
  /nix/store/1ndgaysig749nsx82z36bb8a456b8dw7-libtiff-4.0.8
  /nix/store/1q81bildsdv1n0sm85g8ra2h5xbsld49-quickcheck-instances-0.3.12
  /nix/store/1xm9yvif750irl31p2z19nzzq2x9b1rp-ghc-paths-0.1.0.9
  /nix/store/1yz4lwdjmccp39ij7pn36ns8f73z0hig-bifunctors-5.4.2
  /nix/store/202fcg6iaydw1i9siwhqx5826nv5gqqc-parallel-3.2.1.1
  /nix/store/2qjwqwp4s2g44f30q7mcx6iiviz7m0yp-bytes-0.15.3
  /nix/store/2xnlgpc20yzjnx72l7lk7flpjp0cqw7i-refact-0.3.0.2
(... lots of things fetched, no errors)
basvandijk commented 7 years ago

Thanks. So I see you're running a newer version of OS X. I just checked and I have an upgrade to macOS Sierra 10.12.6 pending. Let me just upgrade and see if I run into your problem.

basvandijk commented 7 years ago

I've upgraded nixpkgs and it now builds successfully on my upgraded MBP. Can you try again with the latest master? (The build can take a while since not everything is cached yet).

luntain commented 7 years ago

Something changed, because It was compiling for ages but in the end I got the same error:

[ 34%] Linking CXX shared library ../../lib/libopencv_highgui.dylib
Undefined symbols for architecture x86_64:
  "_objc_setProperty_atomic", referenced from:
      -[CVWindow setSliders:] in window_cocoa.mm.o
      -[CVView setImage:] in window_cocoa.mm.o
      -[CVSlider setSlider:] in window_cocoa.mm.o
      -[CVSlider setName:] in window_cocoa.mm.o
 (...)
builder for ‘/nix/store/hb6zk8iy1xskl9j5mxmf33lwwh2gfgh8-opencv-3.2.0.drv’ failed with exit code 2
error: build of ‘/nix/store/hb6zk8iy1xskl9j5mxmf33lwwh2gfgh8-opencv-3.2.0.drv’ failed

Were you able to repro it before you made the change?