Bug 198720 - multimedia/qt5-multimedia: compilation fails du to "undefined reference to"
Summary: multimedia/qt5-multimedia: compilation fails du to "undefined reference to"
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-kde (group)
URL:
Keywords:
Depends on: 195105
Blocks:
  Show dependency treegraph
 
Reported: 2015-03-19 20:22 UTC by O. Hartmann
Modified: 2015-12-30 14:04 UTC (History)
2 users (show)

See Also:
rakuco: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2015-03-19 20:22:39 UTC
c++ -fstack-protector -Wl,--no-undefined -pthread -Wl,-rpath,/usr/local/lib -Wl,-rpath-link,/usr/local/lib -shared -o libgstcamerabin.so .obj/camerabinserviceplugin.o  .obj/camerabinservice.o  .obj/camerabinsession.o  .obj/camerabincontrol.o  .obj/camerabinaudioencoder.o  .obj/camerabincontainer.o  .obj/camerabinimagecapture.o  .obj/camerabinimageencoder.o  .obj/camerabinimageprocessing.o  .obj/camerabinmetadata.o  .obj/camerabinrecorder.o  .obj/camerabinvideoencoder.o  .obj/camerabinresourcepolicy.o  .obj/camerabincapturedestination.o  .obj/camerabinviewfindersettings.o  .obj/camerabincapturebufferformat.o  .obj/camerabininfocontrol.o  .obj/camerabinexposure.o  .obj/camerabinflash.o  .obj/camerabinfocus.o  .obj/camerabinlocks.o  .obj/camerabinzoom.o  .obj/moc_camerabinserviceplugin.o  .obj/moc_camerabinservice.o  .obj/moc_camerabinsession.o  .obj/moc_camerabincontrol.o  .obj/moc_camerabinaudioencoder.o  .obj/moc_camerabinimageencoder.o  .obj/moc_camerabinrecorder.o  .obj/moc_camerabincontainer.o  .obj/moc_camerabinimagecapture.o  .obj/moc_camerabinimageprocessing.o  .obj/moc_camerabinmetadata.o  .obj/moc_camerabinvideoencoder.o  .obj/moc_camerabinresourcepolicy.o  .obj/moc_camerabincapturedestination.o  .obj/moc_camerabincapturebufferformat.o  .obj/moc_camerabinviewfindersettings.o  .obj/moc_camerabininfocontrol.o  .obj/moc_camerabinfocus.o  .obj/moc_camerabinexposure.o  .obj/moc_camerabinflash.o  .obj/moc_camerabinlocks.o  .obj/moc_camerabinzoom.o  -lqgsttools_p -lgstphotography-0.10 -L/usr/local/lib -lgstaudio-0.10 -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstpbutils-0.10 -lgstapp-0.10 -lgstbase-0.10 -lgstreamer-0.10 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -pthread -lglib-2.0 -lintl -lxml2 -L/usr/ports/multimedia/qt5-multimedia/work/qtmultimedia-opensource-src-5.4.1/lib -lQt5MultimediaWidgets -lQt5Multimedia -lQt5Widgets -lQt5Gui -lQt5Network -lQt5Core -lGL 
.obj/camerabinserviceplugin.o: In function `CameraBinServicePlugin::defaultDevice(QByteArray const&) const':
camerabinserviceplugin.cpp:(.text+0xa87): undefined reference to `QGstUtils::enumerateCameras(_GstElementFactory*)'
.obj/camerabinserviceplugin.o: In function `CameraBinServicePlugin::devices(QByteArray const&) const':
camerabinserviceplugin.cpp:(.text+0xc84): undefined reference to `QGstUtils::cameraDevices(_GstElementFactory*)'
.obj/camerabinserviceplugin.o: In function `non-virtual thunk to CameraBinServicePlugin::devices(QByteArray const&) const':
camerabinserviceplugin.cpp:(.text+0xcc4): undefined reference to `QGstUtils::cameraDevices(_GstElementFactory*)'
.obj/camerabinserviceplugin.o: In function `CameraBinServicePlugin::deviceDescription(QByteArray const&, QByteArray const&)':
camerabinserviceplugin.cpp:(.text+0xd42): undefined reference to `QGstUtils::cameraDescription(QString const&, _GstElementFactory*)'
.obj/camerabinserviceplugin.o: In function `CameraBinServicePlugin::cameraPosition(QByteArray const&) const':
camerabinserviceplugin.cpp:(.text+0xe1f): undefined reference to `QGstUtils::cameraPosition(QString const&, _GstElementFactory*)'
.obj/camerabinserviceplugin.o: In function `non-virtual thunk to CameraBinServicePlugin::cameraPosition(QByteArray const&) const':
camerabinserviceplugin.cpp:(.text+0xeaf): undefined reference to `QGstUtils::cameraPosition(QString const&, _GstElementFactory*)'
.obj/camerabinserviceplugin.o: In function `CameraBinServicePlugin::cameraOrientation(QByteArray const&) const':
camerabinserviceplugin.cpp:(.text+0xf3f): undefined reference to `QGstUtils::cameraOrientation(QString const&, _GstElementFactory*)'
.obj/camerabinserviceplugin.o: In function `non-virtual thunk to CameraBinServicePlugin::cameraOrientation(QByteArray const&) const':
camerabinserviceplugin.cpp:(.text+0xfcf): undefined reference to `QGstUtils::cameraOrientation(QString const&, _GstElementFactory*)'
.obj/camerabinservice.o: In function `CameraBinService::CameraBinService(_GstElementFactory*, QObject*)':
camerabinservice.cpp:(.text+0x85): undefined reference to `QGstreamerVideoInputDeviceControl::QGstreamerVideoInputDeviceControl(_GstElementFactory*, QObject*)'
.obj/camerabinsession.o: In function `CameraBinSession::buildCameraSource()':
camerabinsession.cpp:(.text+0xcc3): undefined reference to `QGstUtils::cameraDriver(QString const&, _GstElementFactory*)'
.obj/camerabininfocontrol.o: In function `CameraBinInfoControl::cameraPosition(QString const&) const':
camerabininfocontrol.cpp:(.text+0xf0): undefined reference to `QGstUtils::cameraPosition(QString const&, _GstElementFactory*)'
.obj/camerabininfocontrol.o: In function `CameraBinInfoControl::cameraOrientation(QString const&) const':
camerabininfocontrol.cpp:(.text+0x110): undefined reference to `QGstUtils::cameraOrientation(QString const&, _GstElementFactory*)'
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1
Comment 1 Rainer Hurling freebsd_committer freebsd_triage 2015-03-20 09:41:22 UTC
For me, it helped to uninstall old multimedia/qt5-multimedia before build and reinstall the new one.
Comment 2 Jens Grassel 2015-04-12 08:04:42 UTC
(In reply to Rainer Hurling from comment #1)

Deinstalling the port first worked for me too.
Comment 3 Raphael Kubo da Costa freebsd_committer freebsd_triage 2015-12-11 11:51:11 UTC
The error likely comes from GStreamer's pkg-config files passing -L/usr/local/lib to the linker before -L/usr/ports/multimedia/qt5-multimedia/work/qtmultimedia-opensource-src-5.4.1/lib, so existing QtMultimedia libraries end up being used instead of the ones being built.

This was supposed to have been solved when we fixed bug 194088, but the pkg-config case was not taken into account. The only way to solve this once and for all is to fix 195105.
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-12-28 18:51:56 UTC
A commit references this bug:

Author: rakuco
Date: Mon Dec 28 18:51:42 UTC 2015
New revision: 404694
URL: https://svnweb.freebsd.org/changeset/ports/404694

Log:
  Make sure ${WRKSRC}/lib is passed before /usr/local/lib when linking.

  This is another shot at fixing the linkage problems that have plagued our
  users particularly when upgrading from Qt 5.x to 5.(x+1). Quick recap: in
  Qt5, qmake will by default pass QMAKE_LIBDIR to the linker before other
  directories such as ${WRKSRC}/lib, which is where the port's libraries are
  built. When a user is upgrading Qt, we can end up with the following linker
  line:
    c++ -o SomeBinary -lfoo1 -L/usr/local/lib -L${WRKSRC}/lib -lfoo2 -lfoo3
  If libfoo2.so is being built by the port and an older version is currently
  installed on the system, /usr/local/lib/libfoo2.so will be picked up instead
  of the newly-built ${WRKSRC}/lib/libfoo2.so. At best things just work, at
  worst SomeBinary needs some new symbol that is not present in the old
  libfoo2.so and linking fails. Case in point: bug 198720.

  The previous approach, adopted when fixing bug 194088, was to stop setting
  QMAKE_{INC,LIB}DIR in the FreeBSD mkspecs and set the CPATH and LIBRARY_PATH
  environment variables in Uses/qmake.mk. This way we just did not pass
  -L/usr/local/lib to the linker at all and things mostly worked. However,
  people using Qt to build their own software without the ports tree were out
  of luck, as they would then need need to deal with passing
  /usr/local/{include,lib} to the compiler/linker themselves (bug 195105). Not
  only that, but if a dependency mentioned /usr/local/lib we would still have
  problems anyway (in bug 198720, the GStreamer pkg-config files contain
  -L/usr/local/lib, for example).

  We now solve the issue by setting the QMAKE_LIBDIR_FLAGS variable in
  .qmake.cache to ${WRKSRC}/lib instead. qmake appends the value of
  QMAKE_LIBDIR to QMAKE_LIBDIR_FLAGS, so we are always sure -L${WRKSRC}/lib
  will come before -L/usr/local/lib in the linker options. Moreover, qmake is
  smart enough to automatically call sed(1) and remove references to
  ${WRKSRC}/lib from .prl and .pc files when installing them.

  PR:		194088
  PR:		195105
  PR:		198720
  MFH:		2015Q4

Changes:
  head/Mk/Uses/qmake.mk
  head/Mk/bsd.qt.mk
  head/devel/qmake5/Makefile
  head/devel/qmake5/files/patch-mkspecs__common__freebsd.conf
Comment 5 commit-hook freebsd_committer freebsd_triage 2015-12-30 14:04:32 UTC
A commit references this bug:

Author: rakuco
Date: Wed Dec 30 14:03:43 UTC 2015
New revision: 404856
URL: https://svnweb.freebsd.org/changeset/ports/404856

Log:
  qmake5: Set QMAKE_{INC,LIB}DIR_OPENGL.

  Follow-up to r404694. When we stopped setting CPATH and LIBRARY_PATH, some
  Qt5-based ports (astro/stellarium, audio/musescore, audio/cantata,
  irc/quassel, deskutils/owncloudclient) broke because the QtGui headers end
  up bringing in GL/gl.h, but -I/usr/local/include was no longer being passed
  to the compiler.

  This is generally caused by QMAKE_{INC,LIB}DIR_OPENGL being empty, which
  leads to some parts of Qt5ConfigExtras.cmake.in being left out when being
  processed into Qt5ConfigExtras.cmake. Specifically, the bits of code that
  make the directories containing GL/gl.h and libGL.so a dependency of the
  Qt5::Gui CMake target were not present.

  Fix it by setting those two variables again like we also do in devel/qmake4.

  Most ports broken by r404694 are fixed by this change, but not all:
  * audio/cantata: Accidentally fixed by this change. Upstream includes the
    TagLib headers wrongly. `taglib-config --cflags' returns
    -I${LOCALBASE}/include/taglib, but the code references headers as
    <taglib/foo.h> instead of <foo.h>.
  * multimedia/obs-studio, textproc/sigil, x11/antimicro: Those remain broken,
    linker calls pass -lfoo instead of /path/to/libfoo.so, and they were only
    working because we were passing LIBRARY_PATH to the linker before. They
    need to be fixed separately.

  Thanks to antoine@ for the fallout heads-up.

  PR:	194088
  PR:	195105
  PR:	198720
  MFH:	2015Q4

Changes:
  head/devel/qmake5/Makefile
  head/devel/qmake5/files/patch-mkspecs__common__freebsd.conf
  head/x11-toolkits/qt5-gui/Makefile