Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Libjpeg conflict while building qt



  • Hello. I am trying to build Qt-5.12.9 from source on Nvidia Jetson Nano, ubuntu 18.04.5 LTS (GNU/Linux 4.9.140-tegra aarch64). I would like to use sytem libjpeg. At the configuration time I specify -system-libjpeg with -v. After the configuration is done I get this:

    JPEG ................................. yes
          Using system libjpeg ............... yes
        PNG .................................. yes
          Using system libpng ................ yes
    

    And

    Checking for libjpeg... 
    Trying source 0 (type inline) of library libjpeg ...
      => source failed condition 'config.msvc'.
    Trying source 1 (type inline) of library libjpeg ...
    + cd /home/ath/Documents/SourceCode/qtBuild/config.tests/libjpeg && /home/ath/Documents/SourceCode/qtBuild/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared use_gold_linker warn_off console single_arch" 'QMAKE_USE += libjpeg' 'QMAKE_LIBS_LIBJPEG = /usr/lib/aarch64-linux-gnu/libjpeg.so' /home/ath/Documents/SourceCode/qtBuild/config.tests/libjpeg
    + cd /home/ath/Documents/SourceCode/qtBuild/config.tests/libjpeg && MAKEFLAGS= /usr/bin/make
    > g++ -c -pipe -O2 -w -fPIC  -I. -I/home/ath/Documents/SourceCode/qt12Source/qtbase/mkspecs/linux-g++ -o main.o main.cpp
    > g++ -Wl,-O1 -fuse-ld=gold -o libjpeg main.o   /usr/lib/aarch64-linux-gnu/libjpeg.so   
     => source accepted.
    test config.qtbase_gui.libraries.libjpeg succeeded
    

    If I continue with the configuration and build. when I run my app I receive this:

    JPEG prarameter struct mismatch: library thinks size is 584, caller expects
    

    In my app:

    ldd myapp
    .....
    libjpeg.so.8 => /usr/lib/aarch64-linux-gnu/libjpeg.so.8 (0x0000007fa6283000)
    .....
    

    In my system:

    ldconfig -p | grep libjpeg
    	libjpeg.so.8 (libc6,AArch64) => /usr/lib/aarch64-linux-gnu/libjpeg.so.8
    	libjpeg.so (libc6,AArch64) => /usr/lib/aarch64-linux-gnu/libjpeg.so
    dpkg -l
    ii  libjpeg-dev:arm64             8c-2ubuntu8         arm64               Independent JPEG Group's JPEG runtime library (dependency packag
    ii  libjpeg-turbo8:arm64          1.5.2-0ubuntu5.18.0 arm64               IJG JPEG compliant runtime library.
    ii  libjpeg-turbo8-dev:arm64      1.5.2-0ubuntu5.18.0 arm64               Development files for the IJG JPEG library
    ii  libjpeg8:arm64                8c-2ubuntu8         arm64               Independent JPEG Group's JPEG runtime library (dependency packag
    ii  libjpeg8-dev:arm64            8c-2ubuntu8         arm64               Independent JPEG Group's JPEG runtime library (dependency packag
    
    

    How do I link only with libjpeg8 so -system-libjpeg will find only this? Thank you


  • Lifetime Qt Champion

    Hi,

    I think the easiest would be to remove the development package of the version you do not want to use. It will avoid its detection.



  • @SGaist Thanks for replying. Actually I tried to remove, however it seems that libjpeg-turbo8-dev install the rest as dependencies. So when removing it warns about the depencencies and if I remove then install again it will install all.


  • Lifetime Qt Champion

    Something is not clear what exactly depends on libjpeg-turbo-dev ?



  • @SGaist :

    dpkg: libjpeg-turbo8-dev:arm64: dependency problems, but removing anyway as you requested:
     libjpeg8-dev:arm64 depends on libjpeg-turbo8-dev (>= 1.1.90+svn722-1ubuntu6).
    
    dpkg: libjpeg8-dev:arm64: dependency problems, but removing anyway as you requested:
     libjpeg-dev:arm64 depends on libjpeg8-dev.
    
    (Reading database ... 142774 files and directories currently installed.)
    Removing libjpeg8-dev:arm64 (8c-2ubuntu8) ...
    dpkg: libjpeg-dev:arm64: dependency problems, but removing anyway as you requested:
     libcupsimage2-dev:arm64 depends on libjpeg-dev.
     libtiff5-dev:arm64 depends on libjpeg-dev.
    
    Removing libjpeg-dev:arm64 (8c-2ubuntu8) ...
    dpkg: libjpeg8:arm64: dependency problems, but removing anyway as you requested:
     vlc-plugin-base:arm64 depends on libjpeg8 (>= 8c).
     liblcms2-utils depends on libjpeg8 (>= 8c).
     libraw16:arm64 depends on libjpeg8 (>= 8c).
     libwmf0.2-7:arm64 depends on libjpeg8 (>= 8c).
     sane-utils depends on libjpeg8 (>= 8c).
     libgs9:arm64 depends on libjpeg8 (>= 8c).
     libsdl-image1.2:arm64 depends on libjpeg8 (>= 8c).
     gstreamer1.0-plugins-good:arm64 depends on libjpeg8 (>= 8c).
     libsane1:arm64 depends on libjpeg8 (>= 8c).
     netpbm depends on libjpeg8 (>= 8c).
     libopencv depends on libjpeg8 (>= 8c).
     libgxps2:arm64 depends on libjpeg8 (>= 8c).
     libqt5gui5:arm64 depends on libjpeg8 (>= 8c).
     libpoppler73:arm64 depends on libjpeg8 (>= 8c).
     eog depends on libjpeg8 (>= 8c).
     libcupsfilters1:arm64 depends on libjpeg8 (>= 8c).
     libmng2:arm64 depends on libjpeg8 (>= 8c).
     libreoffice-core depends on libjpeg8 (>= 8c).
     libtiff5:arm64 depends on libjpeg8 (>= 8c).
     libgd3:arm64 depends on libjpeg8 (>= 8c).
     libgphoto2-6:arm64 depends on libjpeg8 (>= 8c).
     libvncclient1:arm64 depends on libjpeg8 (>= 8c).
     gstreamer1.0-gl:arm64 depends on libjpeg8 (>= 8c).
     libgdk-pixbuf2.0-0:arm64 depends on libjpeg8 (>= 8c).
     libv4lconvert0:arm64 depends on libjpeg8 (>= 8c).
     libfreerdp2-2:arm64 depends on libjpeg8 (>= 8c).
     libwebkit2gtk-4.0-37:arm64 depends on libjpeg8 (>= 8c).
     libqt5webkit5:arm64 depends on libjpeg8 (>= 8c).
     libdjvulibre21:arm64 depends on libjpeg8 (>= 8c).
     libzbar0:arm64 depends on libjpeg8 (>= 8c).
     vino depends on libjpeg8 (>= 8c).
     libmagickcore-6.q16-3:arm64 depends on libjpeg8 (>= 8c).
     libqtgui4:arm64 depends on libjpeg8 (>= 8c).
     xloadimage depends on libjpeg8 (>= 8c).
    
    

    If I try to install only what I need:

    sudo apt-get install libjpeg8 libjpeg8-dev
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt --fix-broken install' to correct these.
    The following packages have unmet dependencies:
     libcupsimage2-dev : Depends: libjpeg-dev
                         Recommends: libcupsfilters-dev (>= 1.0~b1) but it is not going to be installed
     libjpeg8 : Depends: libjpeg-turbo8 (>= 1.1.90+svn722-1ubuntu6) but it is not going to be installed
     libjpeg8-dev : Depends: libjpeg-turbo8-dev (>= 1.1.90+svn722-1ubuntu6) but it is not going to be installed
     libtiff5-dev : Depends: libjpeg-dev
     nvidia-l4t-weston : Depends: libjpeg-turbo8 but it is not going to be installed
    E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
    

    And if I install libjpeg-turbo8-dev:

    sudo apt-get install libjpeg-turbo8  libjpeg-turbo8-dev
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt --fix-broken install' to correct these.
    The following packages have unmet dependencies:
     eog : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     gstreamer1.0-gl : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     gstreamer1.0-plugins-good : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libcupsfilters1 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libdjvulibre21 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libfreerdp2-2 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libgd3 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libgdk-pixbuf2.0-0 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libgphoto2-6 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libgs9 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libgxps2 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     liblcms2-utils : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libmagickcore-6.q16-3 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libmng2 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libopencv : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libpoppler73 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libqt5gui5 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libqt5webkit5 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libqtgui4 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libraw16 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libreoffice-core : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libsane1 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libsdl-image1.2 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libtiff5 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libv4lconvert0 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libvncclient1 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libwebkit2gtk-4.0-37 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libwmf0.2-7 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     libzbar0 : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     netpbm : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     sane-utils : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     vino : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     vlc-plugin-base : Depends: libjpeg8 (>= 8c) but it is not going to be installed
     xloadimage : Depends: libjpeg8 (>= 8c) but it is not going to be installed
    E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
    
    

  • Lifetime Qt Champion

    Sorry, it just realized I misread your issue.

    You built Qt successfully but have a problem with your application.

    Are you loading a specific file that triggers this error or does it happen for all jpeg files ?



  • @SGaist Just camera and opencv however the same code runs well without problems on a Raspberry Pi with Qt 5.11.3



  • @SGaist I believe this libjpeg mismatch:

    ldd myapp
    .....
    libjpeg.so.8 => /usr/lib/aarch64-linux-gnu/libjpeg.so.8 (0x0000007fa6283000)
    .....
    

    and qt configure with -system-libjpeg

    Checking for libjpeg... 
    Trying source 0 (type inline) of library libjpeg ...
      => source failed condition 'config.msvc'.
    Trying source 1 (type inline) of library libjpeg ...
    + cd /home/ath/Documents/SourceCode/qtBuild/config.tests/libjpeg && /home/ath/Documents/SourceCode/qtBuild/qtbase/bin/qmake "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += shared use_gold_linker warn_off console single_arch" 'QMAKE_USE += libjpeg' 'QMAKE_LIBS_LIBJPEG = /usr/lib/aarch64-linux-gnu/libjpeg.so' /home/ath/Documents/SourceCode/qtBuild/config.tests/libjpeg
    + cd /home/ath/Documents/SourceCode/qtBuild/config.tests/libjpeg && MAKEFLAGS= /usr/bin/make
    > g++ -c -pipe -O2 -w -fPIC  -I. -I/home/ath/Documents/SourceCode/qt12Source/qtbase/mkspecs/linux-g++ -o main.o main.cpp
    > g++ -Wl,-O1 -fuse-ld=gold -o libjpeg main.o   /usr/lib/aarch64-linux-gnu/libjpeg.so   
     => source accepted.
    test config.qtbase_gui.libraries.libjpeg succeeded
    

  • Lifetime Qt Champion

    libjpeg.so is likely a symbolic link to libjpeg.so.8



  • This post is deleted!


  • This is the one installing

    sudo apt-get build-dep qt5-default
    
    The following NEW packages will be installed:
    default-libmysqlclient-dev dh-exec firebird-dev firebird3.0-common firebird3.0-common-doc freetds-common freetds-dev libatk-bridge2.0-dev
      libatk1.0-dev libatspi2.0-dev libcairo-script-interpreter2 libcairo2-dev libct4 libcups2-dev libcupsimage2-dev libdbus-1-dev
      libdouble-conversion-dev libepoxy-dev libevdev-dev libfbclient2 libfontconfig1-dev libfreetype6-dev libgbm-dev libgdk-pixbuf2.0-dev
      libgtk-3-dev libib-util libinput-dev libjbig-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev liblzma-dev libmtdev-dev libmysqlclient-dev
      libodbc1 libpango1.0-dev libpixman-1-dev libpng-dev libpq-dev libpq5 libproxy-dev libpulse-dev libqt5designercomponents5 libqt5sql5-sqlite
      libsqlite3-dev libssl-dev libsybdb5 libtiff-dev libtiff5-dev libtiffxx5 libtommath1 libudev-dev libwacom-dev libxcb-icccm4-dev
      libxcb-image0-dev libxcb-keysyms1-dev libxcb-render-util0-dev libxcb-shm0-dev libxcb-xinerama0-dev libxcb-xkb-dev libxcomposite-dev
      libxcursor-dev libxft-dev libxinerama-dev libxkbcommon-dev libxkbcommon-x11-dev libxtst-dev odbcinst odbcinst1debian2 pkg-kde-tools
      qt5-assistant qttools5-dev-tools unixodbc-dev wayland-protocols x11proto-composite-dev x11proto-record-dev x11proto-xinerama-dev
    
    

  • Lifetime Qt Champion

    So everything looks correct...

    How are you loading your image in your application ?