Opened 9 years ago

Closed 8 years ago

#50709 closed defect (fixed)

port:opencv+qt4 uses Qt5 if both Qt4 and Qt5 are installed

Reported by: RJVB (René Bertin) Owned by: stromnov (Andrey Stromnov)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: mkae (Marko Käning)
Port: opencv

Description

The venom is all in the title: installing port:opencv with a Qt4 gui isn't possible currently if Qt5 is installed. I have encountered this kind of situation in other ports: a CMake file somewhere simply prefers Qt5 over Qt4 if the former version is available. The +qt4 variant thus requires a patch to that CMake file, to force it to consider only Qt4.

Attachments (1)

opencv.diff (1.3 KB) - added by RJVB (René Bertin) 9 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 9 years ago by RJVB (René Bertin)

In addition, I'm seeing the following error when building VLC against port:opencv+qt5 :

make[5]: Entering directory `/Volumes/Debian/MP9/var/macports/build/_Volumes_Debian_MP9_site-ports_multimedia_VLC/VLC/work/vlc-2.2.2/modules/video_filter'
../../doltlibtool  --tag=CC   --mode=link /usr/bin/clang  -I/opt/local/include/opencv -I/opt/local/include   -O3 -march=native -g -arch x86_64 -D_INTL_REDIRECT_MACROS -I/Volumes/Debian/MP9/var/macports/build/_Volumes_Debian_MP9_site-ports_multimedia_VLC/VLC/work/vlc-2.2.2/contrib/include -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wvolatile-register-var -Werror-implicit-function-declaration -pipe -fvisibility=hidden -O3 -ffast-math -funroll-loops -fomit-frame-pointer -avoid-version -module -export-symbols-regex ^vlc_entry -shrext .dylib -no-undefined ../../compat/libcompat.la ../../src/libvlccore.la  -rpath '/opt/local/lib/vlc/plugins/video_filter'  -L/opt/local/lib -Wl,-headerpad_max_install_names -L/opt/local/lib/samba3 -arch x86_64 -Wl,-headerpad_max_install_names -L/Volumes/Debian/MP9/var/macports/build/_Volumes_Debian_MP9_site-ports_multimedia_VLC/VLC/work/vlc-2.2.2/contrib/lib -o libopencv_wrapper_plugin.la  libopencv_wrapper_plugin_la-opencv_wrapper.lo -L/opt/local/lib -L/opt/local/libexec/qt5/Library/Frameworks/QtCore.framework -L/opt/local/libexec/qt5/Library/Frameworks/QtGui.framework -L/opt/local/libexec/qt5/Library/Frameworks/QtWidgets.framework -L/opt/local/libexec/qt5/Library/Frameworks/QtTest.framework -L/opt/local/libexec/qt5/Library/Frameworks/QtConcurrent.framework -L/opt/local/libexec/qt5/Library/Frameworks/QtOpenGL.framework -L/opt/local/lib -L//System/Library/Frameworks -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core -lQtCore -lQtGui -lQtWidgets -lQtTest -lQtConcurrent -lQtOpenGL -lwebp -lpng -ltiff -ljasper -ljpeg -lImath -lIlmImf -lIex -lHalf -lIlmThread -lavcodec-2 -lavformat-2 -lavutil-2 -lswscale-2 -lavresample-2 -lz -lbz2 -framework VideoDecodeAcceleration -framework QTKit -framework QuartzCore -framework AppKit -ltbb -ltbbmalloc -lAGL -lOpenGL    
libtool: link: rm -fr  .libs/libopencv_wrapper_plugin.exp
libtool: link: /opt/local/bin/nm  .libs/libopencv_wrapper_plugin_la-opencv_wrapper.o   | sed -n -e 's/^.*[       ]\([BCDEGRST][BCDEGRST]*\)[     ][      ]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' | sed '/ __gnu_lto/d' | /opt/local/bin/gsed 's/.* //' | sort | uniq > .libs/libopencv_wrapper_plugin.exp
libtool: link: /usr/bin/grep -E -e "^vlc_entry" ".libs/libopencv_wrapper_plugin.exp" > ".libs/libopencv_wrapper_plugin.expT"
libtool: link: mv -f ".libs/libopencv_wrapper_plugin.expT" ".libs/libopencv_wrapper_plugin.exp"
libtool: link: sed -e 's|^|_|' < .libs/libopencv_wrapper_plugin.exp > .libs/libopencv_wrapper_plugin-symbols.expsym
libtool: link: /usr/bin/clang  -o .libs/libopencv_wrapper_plugin.dylib -bundle  .libs/libopencv_wrapper_plugin_la-opencv_wrapper.o   ../../compat/.libs/libcompat.a -L/opt/local/lib -L/opt/local/lib/samba3 -L/Volumes/Debian/MP9/var/macports/build/_Volumes_Debian_MP9_site-ports_multimedia_VLC/VLC/work/vlc-2.2.2/contrib/lib ../../src/.libs/libvlccore.dylib -lintl -lidn -liconv -lm -ldbus-1 -L/opt/local/libexec/qt5/Library/Frameworks/QtCore.framework -L/opt/local/libexec/qt5/Library/Frameworks/QtGui.framework -L/opt/local/libexec/qt5/Library/Frameworks/QtWidgets.framework -L/opt/local/libexec/qt5/Library/Frameworks/QtTest.framework -L/opt/local/libexec/qt5/Library/Frameworks/QtConcurrent.framework -L/opt/local/libexec/qt5/Library/Frameworks/QtOpenGL.framework -L//System/Library/Frameworks -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core -lQtCore -lQtGui -lQtWidgets -lQtTest -lQtConcurrent -lQtOpenGL -lwebp -lpng -ltiff -ljasper -ljpeg -lImath -lIlmImf -lIex -lHalf -lIlmThread -lavcodec-2 -lavformat-2 -lavutil-2 -lswscale-2 -lavresample-2 -lz -lbz2 -framework VideoDecodeAcceleration -framework QTKit -framework QuartzCore -framework AppKit -ltbb -ltbbmalloc -lAGL -lOpenGL  -O3 -march=native -g -arch x86_64 -O3 -Wl,-headerpad_max_install_names -arch x86_64 -Wl,-headerpad_max_install_names   -framework VideoDecodeAcceleration -framework QTKit -framework QuartzCore -framework AppKit -Wl,-exported_symbols_list,.libs/libopencv_wrapper_plugin-symbols.expsym
ld: library not found for -lQtCore
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Data like -L/opt/local/libexec/qt5/Library/Frameworks/QtOpenGL.framework comes from opencv.pc (Libs.private), and is not correct. It should be -framework /opt/local/.../QtFoo.framework without a subsequent -lQtFoo. The exact path to Qt's frameworks should be obtained from the appropriate Qt PortGroup.

comment:2 Changed 9 years ago by RJVB (René Bertin)

Building +qt4 when Qt5 is also installed turns out not to require many modifications:

--- /opt/local/var/macports/sources/default-ports/graphics/opencv/Portfile      2016-02-24 16:35:31.000000000 +0100
+++ /opt/local/site-ports/graphics/opencv/Portfile      2016-02-24 19:47:41.000000000 +0100
@@ -208,13 +208,13 @@
 variant qt4 conflicts qt5 description {Build with Qt4 Backend support.} {
     PortGroup               qt4 1.0
     configure.args-replace  -DWITH_QT=OFF \
-                            -DWITH_QT=ON
+                            -DWITH_QT=4
 }
 
 variant qt5 conflicts qt4 description {Build with Qt5 Backend support.} {
     PortGroup               qt5 1.0
     configure.args-replace  -DWITH_QT=OFF \
-                            -DWITH_QT=ON
+                            -DWITH_QT=5
 }
 
 variant java description {Add Java bindings.} {

Changed 9 years ago by RJVB (René Bertin)

Attachment: opencv.diff added

comment:3 Changed 9 years ago by RJVB (René Bertin)

the attached patchfile contains the above change, plus correction of an error in opencv.pc for the +qt4 variant .

comment:4 Changed 9 years ago by mf2k (Frank Schima)

Cc: stromnov@… removed
Owner: changed from macports-tickets@… to stromnov@…

comment:5 Changed 9 years ago by mkae (Marko Käning)

Cc: mk@… added

Cc Me!

comment:6 Changed 8 years ago by mkae (Marko Käning)

Resolution: fixed
Status: newclosed
Version: 2.3.4

This should be closed, as opencv has progressed in the meantime.

Note: See TracTickets for help on using tickets.