Skip to content
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

Build fails on osx sierra - on building opencv #95

Open
luntain opened this issue Jul 26, 2017 · 6 comments
Open

Build fails on osx sierra - on building opencv #95

luntain opened this issue Jul 26, 2017 · 6 comments

Comments

@luntain
Copy link

luntain commented Jul 26, 2017

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Author

luntain commented Jul 27, 2017

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Author

luntain commented Jul 28, 2017

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?

@basvandijk basvandijk reopened this Jul 28, 2017
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