Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1692007 - qt4 / opencv library incompatibilities
Summary: qt4 / opencv library incompatibilities
Alias: None
Product: Fedora
Classification: Fedora
Component: opencv
Version: 29
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Nicolas Chauvet (kwizart)
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2019-03-23 09:30 UTC by Fourty Niner
Modified: 2019-03-28 23:44 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-03-28 16:45:27 UTC

Attachments (Terms of Use)
Source and cmake file for reproducing the bug (deleted)
2019-03-23 09:30 UTC, Fourty Niner
no flags Details

Description Fourty Niner 2019-03-23 09:30:27 UTC
Created attachment 1547228 [details]
Source and cmake file for reproducing the bug

Description of problem:
When you link qt4 librairies (from qt4-devel package) with opencv librairies (form opencv-devel package), you can't run any executable. When running, it sends crash error : "realloc(): invalid pointer"

How reproducible:
I use qt-creator package as IDE interface for compiling and linking the executable.

Steps to Reproduce:
1. Compile and link the file main.cpp with the CMakelists.txt file and cmake
2. Run qt-opencv 

Actual results:
10:13:02: Starting src/build-qt4-opencv-Desktop-Default/qt4-opencv...
realloc(): invalid pointer
10:13:02: The program has unexpectedly finished.
10:13:02: The process was ended forcefully.
10:13:02: src/build-qt4-opencv-Desktop-Default/qt4-opencv crashed.

Expected results:
10:15:49: Starting src/build-qt4-opencv-Desktop-Default/qt4-opencv...
It works !
10:15:50: src/build-qt4-opencv-Desktop-Default/qt4-opencv exited with code 0

Additional info:
Expected results can be reproduced by removing link to opencv libs :
1. In CMakeLists.txt, comment the line "target_link_libraries(qt4-opencv ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${OpenCV_LIBS})"
2. In CMakeLists.txt, uncomment the line "target_link_libraries(qt4-opencv ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})"

For information, I've recompiled opencv sources files by using srpms from opencv-3.4.1-6.fc29.src.rpm package.
I use the command : cmake -Wno-dev -DENABLE_PRECOMPILED_HEADERS=OFF -DBUILD_SHARED_LIBS=ON -DWITH_QT=OFF ../opencv-3.4.1 ...
I think the cmake option -DWITH_QT=OFF solves the problem.
When I use these new fresh opencv libraries in the "target_link_libraries(qt4-opencv ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${my_new_fresh_opencv_libs})", it works fine.

Comment 1 Sergio Monteiro Basto 2019-03-23 10:32:07 UTC
2. Run qt-opencv 

bash: qt-opencv: command not found

what are you talking about ?

Comment 2 Fourty Niner 2019-03-23 10:58:16 UTC
Sorry, I'm talking about the executable generated from the main.cpp after compiling and linking named "qt4-opencv" and not "qt-opencv".

To make it running :
1. mkdir ~/qt4-opencv
2. copy the "" provided to "~/qt4-opencv" directory
3. cd ~/qt4-opencv
4. unzip
5. mkdir ~/build-qt4-opencv-Desktop-Default/
6. cd ~/build-qt4-opencv-Desktop-Default/
7. cmake ../qt4-opencv
8. make
9. ./qt4-opencv 

Result :
realloc(): invalid pointer
Aborted (core dumped)

Comment 3 Sergio Monteiro Basto 2019-03-23 11:09:54 UTC
Sorry can't find any qt4-opencv, could you explain better what are you talking about ? ? 

Anyway opencv is compiled with qt5-qtbase-devel, maybe just works with qt5-something

Comment 4 Fourty Niner 2019-03-23 11:13:59 UTC is the file that I've uploaded in attachement.

Comment 5 Fourty Niner 2019-03-23 11:38:58 UTC
I used source files from a program which needs qt4 library (to create GUI) and opencv library (to do matrix operations and other things) in the same time.

Comment 6 Sergio Monteiro Basto 2019-03-23 12:24:12 UTC
opencv-core-3.4.1-6.fc29.x86_64.rpm [1]


So is not weird that crash with qt4 , qt4 is obsolete , can't you use qt5 ? 

Also I think the build just can use one qt version , we can't build opencv with qt4 and with qt5 


Comment 7 Fourty Niner 2019-03-23 14:09:45 UTC
OK, I understand. I will try to find a way to use qt5 but the program is huge.
Thank you for your help.

Comment 8 Sergio Monteiro Basto 2019-03-28 16:45:27 UTC
(In reply to Fourty Niner from comment #7)
> OK, I understand. I will try to find a way to use qt5 but the program is
> huge.
> Thank you for your help.

OK closing as not a bug , ok ?

Comment 9 Fourty Niner 2019-03-28 23:44:23 UTC
OK. Thanks.

Note You need to log in before you can comment on or make changes to this bug.