cocoa-xu / evision

Evision: An OpenCV-Erlang/Elixir binding
https://evision.app
Apache License 2.0
322 stars 22 forks source link

Evision fails to compile in Livebook #238

Closed ndrean closed 2 months ago

ndrean commented 2 months ago

The Livebook (OSX, v0.12.1) install fails when I set:

system_env: [{ EVISION_PREFER_PRECOMPILED: false]]

It succeeds when I pass it to true.

However, the install succeeds in a Mix script with this flag set to true:

EVISION_PREFER_PRECOMPILED=false mix deps.compile

# Generated evision app

My Livebook config is:

Mix.install([
  {:bumblebee, "~> 0.5.3"},
  # from main, cf issue: https://github.com/mortont/axon_onnx/issues/55
  {:axon_onnx, git: "https://github.com/mortont/axon_onnx"},
  {:exla, "~> 0.7.1"},
  {:evision, "~> 0.1.38"}
],
config: [nx: [default_backend: EXLA.Backend]],
system_env: [{"EVISION_PREFER_PRECOMPILED", "false"}]
                                              ^^^
)

My Livebook logs show:

[...]
==> evision
using opencv_contrib 4.9.0
Downloading OpenCV contrib 4.9.0...
Unzipping OpenCV contrib 4.9.0...
using opencv 4.9.0
Downloading OpenCV 4.9.0...
Unzipping OpenCV 4.9.0...
[+] applying patches to OpenCV 4.9.0 at /Users/Me/Library/Caches/mix/installs/elixir-1.15.7-erts-14.1.1/5ac34bd0cb01d117ebf11c67f409a56f/deps/evision/3rd_party/opencv/opencv-4.9.0
CMAKE_OPTIONS: -D BUILD_opencv_calib3d=ON -D BUILD_opencv_core=ON -D BUILD_opencv_dnn=ON -D BUILD_opencv_features2d=ON -D BUILD_opencv_flann=ON -D BUILD_opencv_highgui=ON -D BUILD_opencv_imgcodecs=ON -D BUILD_opencv_imgproc=ON -D BUILD_opencv_ml=ON -D BUILD_opencv_photo=ON -D BUILD_opencv_stitching=ON -D BUILD_opencv_ts=ON -D BUILD_opencv_video=ON -D BUILD_opencv_videoio=ON -D BUILD_opencv_aruco=ON -D BUILD_opencv_barcode=ON -D BUILD_opencv_bgsegm=ON -D BUILD_opencv_bioinspired=ON -D BUILD_opencv_dnn_superres=ON -D BUILD_opencv_face=ON -D BUILD_opencv_hfs=ON -D BUILD_opencv_img_hash=ON -D BUILD_opencv_line_descriptor=ON -D BUILD_opencv_mcc=ON -D BUILD_opencv_plot=ON -D BUILD_opencv_quality=ON -D BUILD_opencv_rapid=ON -D BUILD_opencv_reg=ON -D BUILD_opencv_rgbd=ON -D BUILD_opencv_saliency=ON -D BUILD_opencv_shape=ON -D BUILD_opencv_stereo=ON -D BUILD_opencv_structured_light=ON -D BUILD_opencv_surface_matching=ON -D BUILD_opencv_text=ON -D BUILD_opencv_tracking=ON -D BUILD_opencv_wechat_qrcode=ON -D BUILD_opencv_xfeatures2d=ON -D BUILD_opencv_ximgproc=ON -D BUILD_opencv_xphoto=ON -D BUILD_opencv_gapi=OFF -D BUILD_opencv_world=OFF -D BUILD_opencv_python2=OFF -D BUILD_opencv_python3=OFF -D BUILD_opencv_java=OFF -D BUILD_opencv_datasets=OFF -D BUILD_opencv_dnn_objdetect=OFF -D BUILD_opencv_dpm=OFF -D BUILD_opencv_optflow=OFF -D BUILD_opencv_sfm=OFF -D BUILD_opencv_videostab=OFF -D BUILD_opencv_xobjdetect=OFF -D BUILD_PNG=ON -D BUILD_JPEG=ON -D BUILD_TIFF=ON -D BUILD_WEBP=ON -D BUILD_OPENJPEG=ON -D BUILD_JASPER=ON -D BUILD_OPENEXR=ON  -DOPENCV_EXTRA_MODULES_PATH=/Users/me/Library/Caches/mix/installs/elixir-1.15.7-erts-14.1.1/5ac34bd0cb01d117ebf11c67f409a56f/deps/evision/3rd_party/opencv/opencv_contrib-4.9.0/modules -D BUILD_opencv_hdf=OFF -D BUILD_opencv_freetype=OFF -D BUILD_opencv_sfm=OFF -D BUILD_PNG=ON -D BUILD_JPEG=ON -D BUILD_TIFF=ON -D BUILD_WEBP=ON -D BUILD_OPENJPEG=ON -D BUILD_JASPER=ON -D BUILD_OPENEXR=ON  
/bin/sh: cmake: command not found
make: *** [/Users/Me/Library/Caches/mix/installs/elixir-1.15.7-erts-14.1.1/5ac34bd0cb01d117ebf11c67f409a56f/_build/dev/lib/evision/cmake_opencv_4.9.0/modules/python_bindings_generator/headers-contrib.txt] Error 127
could not compile dependency :evision, "mix compile" failed. ...
** (Mix.Error) Could not compile with "make" (exit status: 2).
You need to have gcc and make installed. Try running the
[...]
ndrean commented 2 months ago

Should probably close this as mentioned in #219