Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Linux configure option -system-jpeg: stuck as a plugin lib
QtWS25 Last Chance

Linux configure option -system-jpeg: stuck as a plugin lib

Scheduled Pinned Locked Moved Installation and Deployment
6 Posts 2 Posters 4.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qtconfig
    wrote on last edited by
    #1

    Hi everyone,

    I am new to Qt and would like to understand how to configure Qt to use libjpeg as system library in Linux (i686).
    Currently I have a hard time using the libqjpeg plugin in Qt 4.4.1: I am simply not able to make it work as a shared library.
    So I figured that I might just use libjpeg directly.

    Qt was configured with the following options :
    @
    PREFIX=/opt/i686
    SYSROOT=/opt/i686/target
    ./configure -platform linux-g++ -prefix ${PREFIX}/qt4 -bindir ${PREFIX}/bin -libdir ${SYSROOT}/usr/lib -I ${SYSROOT}/usr/include -L ${SYSROOT}/usr/lib -no-rpath -R /usr/lib -release -v -webkit -reduce-relocations -no-qt3support -no-accessibility -no-phonon -no-libtiff -no-libmng -no-nis -no-cups -no-dbus -no-nas-sound -no-opengl -no-tablet -no-glib -nomake examples -nomake demos -nomake docs
    @

    Furthermore, libjpeg was correctly detected by configure :
    @libjpeg auto-detection... ()
    i686-unknown-linux-gnu-g++ -c -pipe -O2 -Wall -W -I../../../mkspecs/linux-g++ -I. -I/opt/i686/target/usr/include -I. -o libjpeg.o libjpeg.cpp
    libjpeg.cpp: In function ‘int main(int, char**)’:
    libjpeg.cpp:10: warning: ‘cinfo’ is used uninitialized in this function
    i686-unknown-linux-gnu-g++ -o libjpeg libjpeg.o -L/opt/i686/target/usr/lib -ljpeg
    libjpeg enabled.
    @

    and the final configure output was the following:
    @...
    Large File support .. yes
    GIF support ......... plugin
    TIFF support ........ plugin (no)
    JPEG support ........ plugin (system)
    PNG support ......... yes (system)
    MNG support ......... plugin (no)
    zlib support ........ system
    ...@

    Then, I can't find any Qt library linking directly to libjpeg. Instead, libjpeg support is provided through libqjpeg !
    Looking at the build output, libqjpeg is still being built (with -ljpeg):
    @i686-unknown-linux-gnu-g++ -Wl,-rpath,/usr/lib -shared -o libqjpeg.so .obj/release-shared/main.o .obj/release-shared/qjpeghandler.o -L/opt/i686/target/usr/lib -L/opt/i686/src/xorg-7.6/qt4/qt-x11-commercial-src-4.4.1/lib -ljpeg -lQtGui -L/opt/i686/target/usr/lib -L/opt/i686/src/xorg-7.6/qt4/qt-x11-commercial-src-4.4.1/lib -lpng -lSM -lICE -lXrender -lXrandr -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -lrt -lpthread -ldl@

    Is there a way to configure libjpeg exactly like libpng ?
    libpng is working perfectly right now, but for some reason libjpeg support is always compiled as a plugin library, instead of being used directly.
    @
    [user@localhost lib]$ ldd libQt*.4.4.1 | grep libpng
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00110000)
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00110000)
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00154000)
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00394000)
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0x0053d000)
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00797000)
    libpng12.so.0 => /usr/lib/libpng12.so.0 (0x00110000)
    [user@localhost lib]$ ldd libQt*.4.4.1 | grep libjpeg
    [user@localhost lib]$ @

    If more info is needed please ask, I've been working on this for a few days and I'm out of ideas.
    Thanks in advance!!

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      May I ask what's the problem in shipping a plugin if you're building Qt dynamically?

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qtconfig
        wrote on last edited by
        #3

        Of course !
        When I use the libqjpeg.so plugin with the following code, it creates an empty file :
        (the size is zero bytes)
        @
        QPixmap pixmap( 200, 200 );
        // fill the content of the pixmap using X11 pixmap functions and pixmap.handle()
        pixmap.save( "/path/to/file.jpeg" );
        @

        If I want my application to find libqjpeg.so, I absolutely need to set rpath to /usr/lib and to put the library there.
        Once the application lauched, it's like the plugin class can't use the plugin even if it's loaded.
        I've tried setting LD_LIBRARY_PATH to both /usr/lib and /usr/lib/qtplugins/imageformats but it doesn't work either...

        In order to get the link flag in my application I modified the .pro file with QTPLUGIN+=qjpeg.

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qtconfig
          wrote on last edited by
          #4

          I've downloaded Qt 4.7.4 (opensource) and tried to configure it using the same parameters.
          I get the same configure output :
          @...
          Large File support ..... yes
          GIF support ............ plugin
          TIFF support ........... no
          JPEG support ........... plugin (system)
          PNG support ............ yes (system)
          MNG support ............ no
          zlib support ........... system
          ...@

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dangelog
            wrote on last edited by
            #5

            The plugin doesn't work as an ordinary shared library. It's supposed to stay in a certain directory (see QLibrary / QPlugin / QCoreApplication / qt.conf docs) and it'll be loaded by Qt automatically. Are you saying that Qt doesn't find the plugin? Did you try running an application with QT_DEBUG_PLUGINS=1?

            Software Engineer
            KDAB (UK) Ltd., a KDAB Group company

            1 Reply Last reply
            0
            • Q Offline
              Q Offline
              qtconfig
              wrote on last edited by
              #6

              libqjpeg is working now! Thanks for the help peppe!

              All I needed was to call this in my application :
              @QCoreApplication::addLibraryPath("/usr/lib/plugins")@

              QT_DEBUG_PLUGINS=1 env didn't print anything, I guess it needs other debug flags.
              Also I removed the QTPLUGIN line from the .pro, I think it's for static linking only.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved