torch / demos

Demos and tutorials around Torch7.
355 stars 301 forks source link

error with luarocks install camera #65

Open cjliux opened 7 years ago

cjliux commented 7 years ago

I am not sure whether this is caused by library imcompatibility, because I am currently using opencv3.2.

Installing https://raw.githubusercontent.com/torch/rocks/master/camera-1.1-0.rockspec... Using https://raw.githubusercontent.com/torch/rocks/master/camera-1.1-0.rockspec... switching to 'build' mode Cloning into 'lua---camera'... remote: Counting objects: 29, done. remote: Compressing objects: 100% (28/28), done. remote: Total 29 (delta 3), reused 10 (delta 0), pack-reused 0 Receiving objects: 100% (29/29), 18.57 KiB | 0 bytes/s, done. Resolving deltas: 100% (3/3), done. Checking connectivity... done. cmake -E make_directory build; cd build; cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/cjliux/.local_install/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/cjliux/.local_install/torch/install/lib/luarocks/rocks/camera/1.1-0"; make

-- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Torch7 in /home/cjliux/.local_install/torch/install -- Found CUDA: /usr/local/cuda-8.0 (found suitable exact version "8.0") -- Found OpenCV: /usr/local (found version "3.2.0") -- Try OpenMP C flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Try OpenMP CXX flag = [-fopenmp] -- Performing Test OpenMP_FLAG_DETECTED -- Performing Test OpenMP_FLAG_DETECTED - Success -- Found OpenMP: -fopenmp
-- OpenMP Found with compiler flag : -fopenmp CMake Warning at video4linux/CMakeLists.txt:13 (FIND_PACKAGE): By not providing "FindARM.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "ARM", but CMake did not find one.

Could not find a package configuration file provided by "ARM" with any of the following names:

ARMConfig.cmake
arm-config.cmake

Add the installation prefix of "ARM" to CMAKE_PREFIX_PATH or set "ARM_DIR" to a directory containing one of the above files. If "ARM" provides a separate development package or SDK, be sure it has been installed.

-- Configuring done -- Generating done -- Build files have been written to: /tmp/luarocks_camera-1.1-0-4873/lua---camera/build Scanning dependencies of target camopencv [ 25%] Building C object opencv/CMakeFiles/camopencv.dir/opencv.c.o /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c:33:8: error: unknown type name ‘CvCapture’ static CvCapture* capture[MAXIDX]; ^ /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c: In function ‘l_initCam’: /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c:51:21: warning: implicit declaration of function ‘cvCaptureFromCAM’ [-Wimplicit-function-declaration] capture[fidx] = cvCaptureFromCAM(idx); ^ /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c:51:19: warning: assignment makes pointer from integer without a cast [-Wint-conversion] capture[fidx] = cvCaptureFromCAM(idx); ^ /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c:58:19: warning: implicit declaration of function ‘cvQueryFrame’ [-Wimplicit-function-declaration] frame[fidx] = cvQueryFrame ( capture[fidx] ); ^ /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c:58:17: warning: assignment makes pointer from integer without a cast [-Wint-conversion] frame[fidx] = cvQueryFrame ( capture[fidx] ); ^ /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c:64:19: warning: assignment makes pointer from integer without a cast [-Wint-conversion] frame[fidx] = cvQueryFrame ( capture[fidx] ); ^ /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c:79:21: warning: implicit declaration of function ‘cvCreateFileCapture’ [-Wimplicit-function-declaration] capture[fidx] = cvCreateFileCapture(file); ^ /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c:79:19: warning: assignment makes pointer from integer without a cast [-Wint-conversion] capture[fidx] = cvCreateFileCapture(file); ^ /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c: In function ‘l_grabFrame’: /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c:98:14: warning: assignment makes pointer from integer without a cast [-Wint-conversion] frame[idx] = cvQueryFrame ( capture[idx] ); ^ /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c: In function ‘l_releaseCam’: /tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c:130:3: warning: implicit declaration of function ‘cvReleaseCapture’ [-Wimplicit-function-declaration] cvReleaseCapture( &capture[idx] ); ^ opencv/CMakeFiles/camopencv.dir/build.make:62: recipe for target 'opencv/CMakeFiles/camopencv.dir/opencv.c.o' failed make[2]: [opencv/CMakeFiles/camopencv.dir/opencv.c.o] Error 1 CMakeFiles/Makefile2:85: recipe for target 'opencv/CMakeFiles/camopencv.dir/all' failed make[1]: [opencv/CMakeFiles/camopencv.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2

Error: Build error: Failed building.

liesrock commented 7 years ago

I have exactly the same issue.

HRLurie commented 7 years ago

I also have a similar issue. Does anybody understand a solution or workaround?

/tmp/luarocks_camera-1.1-0-4873/lua---camera/opencv/opencv.c:33:8: error: unknown type name ‘CvCapture’

freedomsb commented 7 years ago

Detailed solution:

  1. Download lua rocks camera package: $ git clone https://github.com/clementfarabet/lua---camera.git
  2. Edit the file /lua---camera/opencv/opencv.c: add one line in the beginning:

    include "opencv2/videoio/videoio_c.h"

  3. Compile the program from source: $ mkdir build $ cd build $ cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$(LUA_BINDIR)/.." - DCMAKE_INSTALL_PREFIX="$(PREFIX)" $ sudo make install

If you find it difficult to solve, you can do the following: $ git clone https://github.com/freedomsb/lua_camera.git $ cd lua_camera $ luarocks install camera-1.1-0.rockspec Since I modified the rockspec, you can install the camera package automatically