QtGStreamer doesn't link against needed libs when cross-building for Windows

Nikos Chantziaras realnc at gmail.com
Sat Jun 1 06:58:02 PDT 2013


On 01/06/13 11:33, George Kiagiadakis wrote:
> On Sat, Jun 1, 2013 at 7:56 AM, Nikos Chantziaras <realnc at gmail.com> wrote:
>> I'm using MXE (a mingw cross-compiler) to build various libraries for
>> Windows under Linux.  Qt and GStreamer itself, and all their needed deps,
>> build fine.  QtGStreamer however fails horribly.  It seems it doesn't link
>> against the libraries it needs and the result is a humongous amount of
>> "undefined reference" linker errors: [...]
>
> I believe this is a build system bug (actually, 2 different bugs),
> caused by -DQTGSTREAMER_STATIC=ON and also by the fact that your Qt
> library is probably static as well, right?

Yes.  MXE only does static builds (to avoid having to ship 30+ dlls with 
applications.)


> For the dllimport warnings, I guess some hackery is needed to detect
> in {QGlib,QGst,...}/global.h that you are building STATIC and set the
> {QTGLIB, QTGSTREAMER, ...}_EXPORT macros defined to nothing.
>
> For the QtGui linking failure, probably the target_link_libraries()
> needs to change to use ${QT_QTGUI_LIBRARIES} instead of
> ${QT_QTGUI_LIBRARY} and similar for other libraries...
>
> Static configuration is a pain, tbh. I have never tested linking with
> a static Qt library, so I guess that's why I never found this issue.

I've now manually set every _EXPORT to be empty, and replaced every 
_LIBRARY variable with a _LIBRARIES one.  The build gets along much 
further now and successfully links many of the libraries.  But it fails 
when linking libgstqtvideosink.  It seems for this one, 
QTGSTREAMER_STATIC is ignored and tries to build a DLL instead of a 
static ar archive:

Linking CXX shared module libgstqtvideosink.dll
cd /tmp/build/elements/gstqtvideosink && /usr/bin/cmake -E 
cmake_link_script CMakeFiles/gstqtvideosink.dir/link.txt --verbose=1
/usr/bin/cmake -E remove -f CMakeFiles/gstqtvideosink.dir/objects.a
/home/realnc/opt/mxe/usr/bin/i686-pc-mingw32-ar cr 
CMakeFiles/gstqtvideosink.dir/objects.a 
@CMakeFiles/gstqtvideosink.dir/objects1.rsp
/home/realnc/opt/mxe/usr/bin/i686-pc-mingw32-g++    -shared -o 
libgstqtvideosink.dll 
-Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive 
CMakeFiles/gstqtvideosink.dir/objects.a -Wl,--no-whole-archive 
/home/realnc/opt/mxe/usr/i686-pc-mingw32/qt/lib/libQtCore.a 
/home/realnc/opt/mxe/usr/i686-pc-mingw32/qt/lib/libQtGui.a -Wl,-Bstatic 
-lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lgstreamer-0.10 
-lgstbase-0.10 -lgstvideo-0.10 -lgstinterfaces-0.10 -Wl,-Bdynamic 
-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 
-luuid -lcomdlg32 -ladvapi32


More information about the gstreamer-devel mailing list