Ask Your Question
1

OpenCV fails on Run with realloc(): invalid pointer

asked 2013-12-11 03:55:37 -0600

stef gravatar image

updated 2013-12-11 03:57:44 -0600

berak gravatar image

Hello all,

I'm new to OpenCV and I have tried one simple code example with QT Creator. My program builds well, but when I add line:

_capture = cvCaptureFromCAM(1);

I get an error like this:

*** Error in `/home/ivan/Projects/.../Desktop_Qt_5_1_1_GCC_64bit-Debug/my-program': realloc(): invalid pointer: 0x00007fa78cc2d520 ***

======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x7f4c6)[0x7fa78bd584c6] /lib/x86_64-linux-gnu/libc.so.6(realloc+0x300)[0x7fa78bd5ccf0] /usr/lib/nvidia-319-updates/tls/libnvidia-tls.so.319.60(+0x2061)[0x7fa78428d061]

======= Memory map: ======== 00400000-00405000 r-xp 00000000 08:02 1585594 . . .

All libraries are loaded correctly and code passes build without an error. Did anyone had similar issues?

Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-08-04 00:56:32 -0600

ichingchang gravatar image

I have met the same problem, I search it the whole morning and solve it by re-install the OpenCV. My opencv was the version 2.4.9, and build on the Ubuntu 12.04 system following the post , I installed the QT creator later using the Linux installer. The version of QT creator is 3.1.2 based on the QT 5.3.1. My OpenCV was installed on a customized path. I just deleted the build folder

cd opencv-2.4.9
rm -r build

and I just build the OpenCV again without the -D WITH_QT flag in cmake

mkdir build
cd build
cmake -D WITH_XINE=ON -D WITH_OPENGL=ON -D WITH_TBB=ON -D BUILD_EXAMPLES=ON ..
make -j4
sudo make install

the -j4 flag in the make means that make in 4 cores parallel. and the Magic happens, the code works! the reason why it does not work is that when using the cmake WITH_QT flag the system build the opencv using the system default version of the qt, which is not compatible with the newest version of the qt downloaded from the website. however, to make it work, we must have the right version of the QT

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-12-11 03:55:37 -0600

Seen: 3,479 times

Last updated: Aug 04 '14