Ask Your Question

Opencv java build error in Ubuntu 13.04

asked 2013-08-05 10:03:26 -0600

rajchinna gravatar image


I need help in building the opencv 2.4.6 in ubuntu 13.04 64bit with Java support. I am trying it for last 2 days and didn't get any positive result. All ways th code failes at this location. I know this is because of some problem with the libv4l dependency. TOday I compiled and installed this libv4l lib into my machine, but still I got this error.. I have tried lib 0.8.8 to 1.0.0 version and am facing the following issue on all the versions.

Please help me to solve this issue.

[ 23%] Built target opencv_test_flann [ 23%] Built target opencv_perf_highgui_pch_dephelp [ 23%] Built target pch_Generate_opencv_perf_highgui Linking CXX executable ../../bin/opencv_perf_highgui /usr/bin/ld: ../../lib/libopencv_highgui.a(cap_libv4l.cpp.o): undefined reference to symbol 'v4l2_munmap' /usr/bin/ld: note: 'v4l2_munmap' is defined in DSO /usr/local/lib/ so try adding it to the linker command line /usr/local/lib/ could not read symbols: Invalid operation collect2: error: ld returned 1 exit status make[2]: * [bin/opencv_perf_highgui] Error 1 make[1]: [modules/highgui/CMakeFiles/opencv_perf_highgui.dir/all] Error 2 make: ** [all] Error 2

reference links followed.

Am I missing something in my steps, i have no clue how to solve this issue.

Thanks in advance for your support.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-08-07 18:03:17 -0600

garyp gravatar image

You shouldn't need to install a local copy of libv4l. The libv4l-dev package in Ubuntu should be sufficient. Here is the full list of steps I had to perform to compile OpenCV from source under Ubuntu 13.04 with Java support:

# install basic development environment
sudo apt-get install build-essential cmake pkg-config

# install opencv dependencies. ubuntu 13.04 ships with opencv
# 2.4.2, which is close enough to 2.4.6 to pull in most of the
# needed dependencies.
sudo apt-get build-dep libopencv-dev
# additional dependencies for java support
sudo apt-get install default-jdk ant

# compile opencv
tar xzvf opencv-
cd opencv-
mkdir build; cd build
sudo make install

If you're still having trouble, can you post the full cmake command you're using?

OpenGL support (optional)

If you need OpenGL support, you'll want to "sudo apt-get install libgtkglext1-dev" and add "-D WITH_OPENGL=ON" to the list of cmake arguments.

OpenCL support (optional)

To compile with OpenCL support, you'll want to "sudo apt-get install ocl-icd-opencl-dev", apply the following patch (if you're on a 64-bit system), and then prefix the above cmake command with "OCLROOT=/usr" (i.e. "OCLROOT=/usr cmake -D ...".

--- opencv-  2013-07-10 11:49:00.000000000 +0000
+++ opencv-       2013-08-02 17:37:11.105800999 +0000
@@ -21,7 +21,7 @@

     if (X86_64)
-      set(OPENCL_POSSIBLE_LIB_SUFFIXES lib/Win64 lib/x86_64 lib/x64)
+      set(OPENCL_POSSIBLE_LIB_SUFFIXES lib/Win64 lib/x86_64 lib/x64 lib/x86_64-linux-gnu)
     elseif (X86)
       set(OPENCL_POSSIBLE_LIB_SUFFIXES lib/Win32 lib/x86)
edit flag offensive delete link more

Question Tools


Asked: 2013-08-05 10:03:26 -0600

Seen: 2,497 times

Last updated: Aug 07 '13