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

  • 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 :
    ./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 .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 => /usr/lib/ (0x00110000) => /usr/lib/ (0x00110000) => /usr/lib/ (0x00154000) => /usr/lib/ (0x00394000) => /usr/lib/ (0x0053d000) => /usr/lib/ (0x00797000) => /usr/lib/ (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!!

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

  • Of course !
    When I use the 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() "/path/to/file.jpeg" );

    If I want my application to find, 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.

  • 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

  • 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?

  • libqjpeg is working now! Thanks for the help peppe!

    All I needed was to call this in my application :

    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.

Log in to reply

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