Ask Your Question
0

build error: undefined reference to 'v4l2_munmap'

asked 2014-10-20 18:23:48 -0600

kilua gravatar image

updated 2014-10-23 09:49:41 -0600

I am compiling the latest version of opencv from github under fedora 20 x86_64. A few weeks ago I built opencv-2.4.9 in the same machine so I think I have all the libraries installed properly or at least that i thought...

The cmake command that I used is:

cmake -DBUILD_SHARED_LIBS=OFF -DWITH_TBB=on -DWITH_JAVA=on ..

But in the building process I get this error:

/usr/bin/ld: ../../lib/libopencv_videoio.a(cap_libv4l.cpp.o): undefined reference to symbol 'v4l2_munmap'
/usr/bin/ld: note: 'v4l2_munmap' is defined in DSO /lib64/libv4l2.so.0 so try adding it to the linker command line
/lib64/libv4l2.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [bin/opencv_perf_videoio] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_perf_videoio.dir/all] Error 2

Does anybody know about this?

EDIT:

General configuration for opencv-3.0.0 is:

-- The CXX compiler identification is GNU 4.8.3
-- The C compiler identification is GNU 4.8.3
-- 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
-- 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
-- Detected version of GNU GCC: 48 (408)
-- Performing Test HAVE_CXX_FSIGNED_CHAR
-- Performing Test HAVE_CXX_FSIGNED_CHAR - Success
-- Performing Test HAVE_C_FSIGNED_CHAR
-- Performing Test HAVE_C_FSIGNED_CHAR - Success
-- Performing Test HAVE_CXX_W
-- Performing Test HAVE_CXX_W - Success
-- Performing Test HAVE_C_W
-- Performing Test HAVE_C_W - Success
-- Performing Test HAVE_CXX_WALL
-- Performing Test HAVE_CXX_WALL - Success
-- Performing Test HAVE_C_WALL
-- Performing Test HAVE_C_WALL - Success
-- Performing Test HAVE_CXX_WERROR_RETURN_TYPE
-- Performing Test HAVE_CXX_WERROR_RETURN_TYPE - Success
-- Performing Test HAVE_C_WERROR_RETURN_TYPE
-- Performing Test HAVE_C_WERROR_RETURN_TYPE - Success
-- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR
-- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR
-- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_CXX_WERROR_ADDRESS
-- Performing Test HAVE_CXX_WERROR_ADDRESS - Success
-- Performing Test HAVE_C_WERROR_ADDRESS
-- Performing Test HAVE_C_WERROR_ADDRESS - Success
-- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT
-- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT - Success
-- Performing Test HAVE_C_WERROR_SEQUENCE_POINT
-- Performing Test HAVE_C_WERROR_SEQUENCE_POINT - Success
-- Performing Test HAVE_CXX_WFORMAT
-- Performing Test HAVE_CXX_WFORMAT - Success
-- Performing Test HAVE_C_WFORMAT
-- Performing Test HAVE_C_WFORMAT - Success
-- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY
-- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY - Success
-- Performing Test HAVE_C_WERROR_FORMAT_SECURITY
-- Performing Test HAVE_C_WERROR_FORMAT_SECURITY - Success
-- Performing Test HAVE_CXX_WMISSING_DECLARATIONS
-- Performing Test HAVE_CXX_WMISSING_DECLARATIONS - Success
-- Performing Test HAVE_C_WMISSING_DECLARATIONS
-- Performing Test HAVE_C_WMISSING_DECLARATIONS - Success
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES
-- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Failed
-- Performing Test HAVE_C_WMISSING_PROTOTYPES
-- Performing Test HAVE_C_WMISSING_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES
-- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Failed
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES
-- Performing Test HAVE_C_WSTRICT_PROTOTYPES - Success
-- Performing Test HAVE_CXX_WUNDEF
-- Performing Test HAVE_CXX_WUNDEF - Success
-- Performing Test HAVE_C_WUNDEF
-- Performing Test HAVE_C_WUNDEF - Success
-- Performing Test HAVE_CXX_WINIT_SELF
-- Performing Test HAVE_CXX_WINIT_SELF - Success
-- Performing Test HAVE_C_WINIT_SELF
-- Performing Test HAVE_C_WINIT_SELF - Success
-- Performing Test HAVE_CXX_WPOINTER_ARITH
-- Performing Test HAVE_CXX_WPOINTER_ARITH - Success
-- Performing Test HAVE_C_WPOINTER_ARITH
-- Performing Test HAVE_C_WPOINTER_ARITH - Success
-- Performing Test HAVE_CXX_WSHADOW
-- Performing Test HAVE_CXX_WSHADOW - Success
-- Performing Test HAVE_C_WSHADOW
-- Performing Test HAVE_C_WSHADOW - Success
-- Performing Test HAVE_CXX_WSIGN_PROMO
-- Performing Test HAVE_CXX_WSIGN_PROMO - Success
-- Performing Test HAVE_C_WSIGN_PROMO
-- Performing Test HAVE_C_WSIGN_PROMO - Failed
-- Performing Test HAVE_CXX_WNO_NARROWING
-- Performing Test HAVE_CXX_WNO_NARROWING - Success
-- Performing Test HAVE_C_WNO_NARROWING
-- Performing Test HAVE_C_WNO_NARROWING - Success
-- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR
-- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR - Success
-- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR
-- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR - Failed
-- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS
-- Performing Test ...
(more)
edit retag flag offensive close merge delete

Comments

You are building the 3.0 branch and not 2.4.9 since you have the opencv_videoio library. As you can see here, that one is NOT present in the 2.4.9 branch. Probably you forgot to do git checkout 2.4 before running CMAKE. You can see here that 3.0 master branch contains the module that gives you problems.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-21 04:36:53 -0600 )edit

Yes, I am building the 3.0 branch (I forgot to tell....). I did a git clone https://github.com/Itseez/opencv.git and then ran CMAKE.

kilua gravatar imagekilua ( 2014-10-21 08:46:18 -0600 )edit

Using libv4l (ver 1.0.0) that is a pretty old version. Could you update it?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-22 04:53:11 -0600 )edit

I updated it to the 1.6.0 version and the issue persists.

kilua gravatar imagekilua ( 2014-10-22 12:54:07 -0600 )edit

Weird :) Cannot reproduce the error here ...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-23 02:55:25 -0600 )edit

I thought it could be by the libraries version, I am using fedora 20. So I installed a vbox machine with fedora 21 alpha (it practically has all libraries at the latest version) and installed all dependencies (at least all packages I thought that are required). However the issue persists.

kilua gravatar imagekilua ( 2014-10-23 08:18:34 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-10-23 16:47:31 -0600

kilua gravatar image

I installed ubuntu 14.04 x64 inside of a vbox machine and installed all packaged listed here. It worked, I was able to compile opencv-3.0.0. Then I copied the .jar file and the lib folder into my fedora 20, linked it to my java application and it worked too.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-10-20 18:23:48 -0600

Seen: 1,478 times

Last updated: Oct 23 '14