Ask Your Question
1

Opencv java build error in Ubuntu 13.04

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

rajchinna gravatar image

Hi,

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/libv4l2.so.0 so try adding it to the linker command line /usr/local/lib/libv4l2.so.0: 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.

http://jayrambhia.wordpress.com/2012/06/20/install-opencv-2-4-in-ubuntu-12-04-precise-pangolin/

http://www.ozbotz.org/opencv-installation/

http://docs.opencv.org/doc/tutorials/introduction/desktop_java/java_dev_intro.html

http://forum.ivorde.ro/ffmpeg-error-while-loading-shared-libraries-libavdevice-so-52-cannot-open-shared-object-file-no-t129.html

http://www.cloudjim.com/install-opencv-242-on-ubuntu-1204-lts.html

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
2

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-2.4.6.1.tar.gz
cd opencv-2.4.6.1
mkdir build; cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON ..
make
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-2.4.6.1/cmake/OpenCVDetectOpenCL.cmake.orig  2013-07-10 11:49:00.000000000 +0000
+++ opencv-2.4.6.1/cmake/OpenCVDetectOpenCL.cmake       2013-08-02 17:37:11.105800999 +0000
@@ -21,7 +21,7 @@
               NO_DEFAULT_PATH)

     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)
     endif()
edit flag offensive delete link more

Question Tools

Stats

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

Seen: 2,521 times

Last updated: Aug 07 '13