opencv-rust icon indicating copy to clipboard operation
opencv-rust copied to clipboard

Nix compilation issue: Permission denied

Open lelongg opened this issue 3 years ago • 1 comments

I'm having an issue when building opencv-rust with nix. I got a Permission denied error. The build system is probably trying to write or delete some file in a folder that is read only (nix build with some isolation rules for reproducibility).

I suspect that this line is the culprit: Placing generated bindings into: /nix/store/6kw96c55cnccvxzdk39gnpb8ip9985sx-crates-io/opencv-0.61.3/src/opencv

I can't find how to change where the generated bindings will go and I could use some help.

  === Detected OpenCV module header dir at: /nix/store/irzzg1sg4z04i20mdf96c14zhigg50w8-opencv-3.4.15/include/opencv2
  === Found OpenCV version: 3.4.15 in headers located at: /nix/store/irzzg1sg4z04i20mdf96c14zhigg50w8-opencv-3.4.15/include
  === Generating code in: /build/dummy-src/target/release/build/opencv-64b54751f004a207/out
  === Placing generated bindings into: /nix/store/6kw96c55cnccvxzdk39gnpb8ip9985sx-crates-io/opencv-0.61.3/src/opencv
  === Using OpenCV headers from: /nix/store/irzzg1sg4z04i20mdf96c14zhigg50w8-opencv-3.4.15/include
  === Clang command line args: [
      "-isystem/nix/store/y59jn7lzls081h3r1q4zazvyshpws4mf-jq-1.6-dev/include",
      "-isystem/nix/store/pjs16641cz7f2q98lcjhlqvhwzrfpvdy-dbus-1.12.20-dev/include",
      "-isystem/nix/store/55z7f3r1spjah0lpfl2jsaldanah8f1z-expat-2.4.1-dev/include",
      "-isystem/nix/store/kva76kxzfljikns3yxrxyn76m9gdmqc4-zlib-1.2.11-dev/include",
      "-isystem/nix/store/z2s2l29hdwcsiysrr471srldzczk138i-openssl-1.1.1l-dev/include",
      "-isystem/nix/store/db9ichm6k2nn2ch8kf009l89x2afrvcy-libssh2-1.10.0-dev/include",
      "-isystem/nix/store/lq4sz9cp3cw9g65wdbsrlhl81kr877da-systemd-249.5-dev/include",
      "-isystem/nix/store/wfqfmknpv9massx0g71vsaf7v9y8jymq-librealsense-2.45.0-dev/include",
      "-isystem/nix/store/irzzg1sg4z04i20mdf96c14zhigg50w8-opencv-3.4.15/include",
      "-isystem/nix/store/vwrmbwv0xbszy7qs4d9jrxz39qk9ja30-ros-melodic-vision-msgs-0.0.1/include",
      "-isystem/nix/store/2y17a9ra06rwhfmcf15cjhi030sj8r97-ros-melodic-geometry-msgs-1.12.8-r1/include",
      "-isystem/nix/store/v30x8gm8a0y1rk5sd379gfy0cbk8d861-ros-melodic-cpp-common-0.6.14-r1/include",
      "-isystem/nix/store/lz8ddhjilkyq6knqzdpw42rj86dy1lzq-boost-1.73.0-dev/include",
      "-isystem/nix/store/436mz69qfw1lqvf0dcr4c3rg0vr4gl7k-console-bridge-1.0.1/include",
      "-isystem/nix/store/vi61sg6s7alknzc557rm1rb9x0kp4a1a-gtest-1.11.0-dev/include",
      "-isystem/nix/store/fkzla307l4mlcvfyshsrccwl7szihx2z-python3-3.9.6/include",
      "-isystem/nix/store/7mvbnrfpmkh88m1jb66ryn03kbynzfak-ros-melodic-roscpp-serialization-0.6.14-r1/include",
      "-isystem/nix/store/v4l1xbqx75547blznlnvf44gbknx8ly1-ros-melodic-roscpp-traits-0.6.14-r1/include",
      "-isystem/nix/store/n3bl9732l5xyzzkvgiaif7ahdp2h0gsd-ros-melodic-rostime-0.6.14-r1/include",
      "-isystem/nix/store/5q5qw4fn6gh2bnw1hfm0n5lyk88vk237-ros-melodic-std-msgs-0.5.12/include",
      "-isystem/nix/store/c80n9gfaic12nbzks95wg1wvb2fpjbh0-ros-melodic-sensor-msgs-1.12.8-r1/include",
      "-isystem/nix/store/fypkbb03k3dgn9m0s03ms4awicpk4ify-ros-melodic-gazebo-msgs-2.8.7-r1/include",
      "-isystem/nix/store/y6zy5b52vgbk7fwxyzviwsacpv8fc9gm-ros-melodic-std-srvs-1.11.2/include",
      "-isystem/nix/store/x5p2pdra5gwgdxnk1ax86njzrv54dsdc-ros-melodic-trajectory-msgs-1.12.8-r1/include",
      "-isystem/nix/store/9rzx9ai7kmk2sg7ljkag7y2n7536shzw-ros-melodic-tf2-msgs-0.6.5/include",
      "-isystem/nix/store/krcjlinyj3r2i27mm3swgrk79faqh82h-ros-melodic-actionlib-msgs-1.12.8-r1/include",
      "-isystem/nix/store/x4z4cyw3wbbyqysz8x222sp559c0nfq2-compiler-rt-libc-7.1.0-dev/include",
      "-isystem/nix/store/a87yinndp3fgpxxfxb9fyr9aln5yzsr7-gcc-10.3.0/include/c++/10.3.0",
      "-isystem/nix/store/a87yinndp3fgpxxfxb9fyr9aln5yzsr7-gcc-10.3.0/include/c++/10.3.0/x86_64-unknown-linux-gnu",
      "-isystem/nix/store/laxk6rylclks3a6jhfqq0041sc0zxqvl-clang-wrapper-7.1.0/resource-root/include",
      "-isystem/nix/store/i9nqsplgfxfx5c1aa2v1hml7lla1r3s8-glibc-2.33-56-dev/include",
      "-isystem/nix/store/irzzg1sg4z04i20mdf96c14zhigg50w8-opencv-3.4.15/include/opencv",
      "-I/nix/store/irzzg1sg4z04i20mdf96c14zhigg50w8-opencv-3.4.15/include",
      "-F/nix/store/irzzg1sg4z04i20mdf96c14zhigg50w8-opencv-3.4.15/include",
      "-I/nix/store/6kw96c55cnccvxzdk39gnpb8ip9985sx-crates-io/opencv-0.61.3/src_cpp",
      "-F/nix/store/6kw96c55cnccvxzdk39gnpb8ip9985sx-crates-io/opencv-0.61.3/src_cpp",
      "-DOCVRS_PARSING_HEADERS",
      "-includeocvrs_ephemeral.hpp",
      "-std=c++14",
  ]
  === Generated: dpm
  === Generated: freetype
  === Generated: bioinspired
  === Generated: flann
  === Generated: bgsegm
  === Generated: ccalib
  === Generated: face
  === Generated: aruco
  === Generated: fuzzy
  === Generated: hfs
  === Generated: features2d
  === Generated: hdf
  === Generated: img_hash
  === Generated: highgui
  === Generated: imgcodecs
  === Generated: calib3d
  === Generated: phase_unwrapping
  === Generated: dnn
  === Generated: line_descriptor
  === Generated: plot
  === Generated: optflow
  === Generated: photo
  === Generated: objdetect
  === Generated: ml
  === Generated: saliency
  === Generated: stereo
  === Generated: shape
  === Generated: sfm
  === Generated: structured_light
  === Generated: superres
  === Generated: imgproc
  === Generated: surface_matching
  === Generated: rgbd
  === Generated: videoio
  === Generated: video
  === Generated: text
  === Generated: xobjdetect
  === Generated: xphoto
  === Generated: xfeatures2d
  === Generated: tracking
  === Generated: videostab
  === Generated: stitching
  === Generated: ximgproc
  === Generated: core
  === Total binding generation time: 28.999373742s
  Error: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }

lelongg avatar Dec 21 '21 09:12 lelongg

Yes, you're right, I've done it to help IDEs with discovering the generated functions and structs, but it does create some problems like this one or #299 . I'll try to come up with some solution to satisfy both.

twistedfall avatar Dec 21 '21 10:12 twistedfall

Hi, this should now be fixed in v0.76.0, the bindings are no longer generated under src/, but in the output directory instead.

twistedfall avatar Jan 23 '23 14:01 twistedfall