Linking of fontconfig and gstreamer with Qt fails



  • I have been trying to cross-compile my own Qt5.9.1 for an arm platform. I have cross compiled fontconfig, gstreamer and tslib. All of these are installed in the same directory.
    Configuration i am following is

    ./configure -opensource -confirm-license -xplatform linux-hi3520d-g++ -no-egl -skip wayland -no-opengl -nomake examples -c++std c++11 -v -prefix /opt/qt/qt5.9.1arm -proprietary-codecs -gstreamer -fontconfig -tslib -alsa
    

    Error i am getting is

    ERROR: Feature 'fontconfig' was enabled, but the pre-condition '!config.win32 && !config.darwin && features.system-freetype && libs.fontconfig' failed.
    
    ERROR: Feature 'gstreamer' was enabled, but the pre-condition 'features.gstreamer_1_0 || features.gstreamer_0_10' failed.
    

    config.log with gstreamer 1.0 part

    looking for library gstreamer_1_0
    Trying source 0 (type pkgConfig) of library gstreamer_1_0 ...
    pkg-config use disabled globally.
      => source produced no result.
    test config.multimedia.libraries.gstreamer_1_0 FAILED
    

    When source 0 fails, why it is not searching for source 1, which it does for freetype and alsa ?

    config.log with fontconfig part

    looking for library fontconfig
    Trying source 0 (type pkgConfig) of library fontconfig ...
    pkg-config use disabled globally.
      => source produced no result.
    Trying source 1 (type freetype) of library fontconfig ...
    + cd /opt/qt/qt5.9.1arm_source/qt5.9.1/config.tests/unix/fontconfig && /opt/qt/qt5.9.1arm_source/qt5.9.1/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared console single_arch" 'QMAKE_LIBDIR += /opt/qt/qt5.9.1arm/lib' 'INCLUDEPATH += /opt/qt/qt5.9.1arm/include' -early "CONFIG += cross_compile" 'LIBS += -lfontconfig -lfreetype' 'INCLUDEPATH *= /opt/qt/qt5.9.1arm/include/freetype2' /opt/qt/qt5.9.1arm_source/qt5.9.1/qtbase/config.tests/unix/fontconfig
    + cd /opt/qt/qt5.9.1arm_source/qt5.9.1/config.tests/unix/fontconfig && MAKEFLAGS= /usr/bin/make clean && MAKEFLAGS= /usr/bin/make
    > rm -f fontconfig.o
    > rm -f *~ core *.core
    > arm-hisiv300-linux-g++ -c -pipe -O2 -march=armv7-a -mcpu=cortex-a9 -std=gnu++11 -Wall -W -fPIC  -I/opt/qt/qt5.9.1arm_source/qt5.9.1/qtbase/config.tests/unix/fontconfig -I. -I/opt/qt/qt5.9.1arm/include/freetype2 -I/opt/qt/qt5.9.1arm/include -I/opt/qt/qt5.9.1arm/include -I/opt/qt/qt5.9.1arm_source/qt5.9.1/qtbase/mkspecs/linux-hi3520d-g++ -o fontconfig.o /opt/qt/qt5.9.1arm_source/qt5.9.1/qtbase/config.tests/unix/fontconfig/fontconfig.cpp
    > /opt/qt/qt5.9.1arm_source/qt5.9.1/qtbase/config.tests/unix/fontconfig/fontconfig.cpp: In function ‘int main(int, char**)’:
    > /opt/qt/qt5.9.1arm_source/qt5.9.1/qtbase/config.tests/unix/fontconfig/fontconfig.cpp:54:13: warning: variable ‘face’ set but not used [-Wunused-but-set-variable]
    >      FT_Face face;
    >              ^
    > /opt/qt/qt5.9.1arm_source/qt5.9.1/qtbase/config.tests/unix/fontconfig/fontconfig.cpp:56:16: warning: variable ‘pattern’ set but not used [-Wunused-but-set-variable]
    >      FcPattern *pattern;
    >                 ^
    > arm-hisiv300-linux-g++ -Wl,-O1 -o fontconfig fontconfig.o   -L/opt/qt/qt5.9.1arm/lib -lfontconfig -lfreetype 
    > /opt/hisi-linux/x86-arm/arm-hisiv300-linux/bin/../lib/gcc/arm-hisiv300-linux-uclibcgnueabi/4.8.3/../../../../arm-hisiv300-linux-uclibcgnueabi/bin/ld: warning: libexpat.so.1, needed by /opt/qt/qt5.9.1arm/lib/libfontconfig.so, not found (try using -rpath or -rpath-link)
    > /opt/qt/qt5.9.1arm/lib/libfontconfig.so: undefined reference to `XML_ParserCreate'
    > /opt/qt/qt5.9.1arm/lib/libfontconfig.so: undefined reference to `XML_GetErrorCode'
    > /opt/qt/qt5.9.1arm/lib/libfontconfig.so: undefined reference to `XML_SetUserData'
    > /opt/qt/qt5.9.1arm/lib/libfontconfig.so: undefined reference to `XML_SetDoctypeDeclHandler'
    > /opt/qt/qt5.9.1arm/lib/libfontconfig.so: undefined reference to `XML_ParseBuffer'
    > /opt/qt/qt5.9.1arm/lib/libfontconfig.so: undefined reference to `XML_GetCurrentLineNumber'
    > /opt/qt/qt5.9.1arm/lib/libfontconfig.so: undefined reference to `XML_ErrorString'
    > /opt/qt/qt5.9.1arm/lib/libfontconfig.so: undefined reference to `XML_ParserFree'
    > /opt/qt/qt5.9.1arm/lib/libfontconfig.so: undefined reference to `XML_SetElementHandler'
    > /opt/qt/qt5.9.1arm/lib/libfontconfig.so: undefined reference to `XML_GetBuffer'
    > /opt/qt/qt5.9.1arm/lib/libfontconfig.so: undefined reference to `XML_SetCharacterDataHandler'
    > collect2: error: ld returned 1 exit status
    > Makefile:66: recipe for target 'fontconfig' failed
    > make: *** [fontconfig] Error 1
     => source failed verification.
    test config.gui.libraries.fontconfig FAILED
    

    Why fontconfig is not able to find libexpat which is cross-compiled and installed in the same prefix ?

    I have also tried exporting LD_LIBRARY_PATH and PKG_CONFIG_PATH during the cross compilation of all the packages mentioned above. I will be happy to give you more details.
    Thank you for your time.



  • I was able to solve the problem where fontconfig was not able to find libexpat by adding the following in my xplatform qmake.conf

    QMAKE_LINK = $HOST-g++ -lts -L/opt/qt/qt5.9.1arm/lib -Wl,-rpath -Wl,/opt/qt/qt5.9.1arm/lib
    
    QMAKE_LINK_SHLIB= $HOST-g++ -lts -L/opt/qt/qt5.9.1arm/lib -Wl,-rpath -Wl,/opt/qt/qt5.9.1arm/lib
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.