Why all the graphics libraries included for a console app

  • I used the fortune server example to create my first app, then removed all aspects of the gui. It's a console only app now.

    However, using ldd I see that my compiled app still depends on lots of libX11 etc. libraries (see below). Why? Is this left over from the fortune example - and if so how do I get rid of them?

    @ linux-vdso.so.1 => (0x00007fff79f82000)
    libQt5Network.so.5 => /opt/Qt/5.1.1/gcc_64/lib/libQt5Network.so.5 (0x00007f655d339000)
    libQt5Gui.so.5 => /opt/Qt/5.1.1/gcc_64/lib/libQt5Gui.so.5 (0x00007f655cce0000)
    libQt5Core.so.5 => /opt/Qt/5.1.1/gcc_64/lib/libQt5Core.so.5 (0x00007f655c656000)
    libGL.so.1 => /lib64/libGL.so.1 (0x000000372ee00000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003724600000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x0000003732e00000)
    libm.so.6 => /lib64/libm.so.6 (0x0000003724e00000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003726600000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003723e00000)
    libicui18n.so.51 => /opt/Qt/5.1.1/gcc_64/lib/libicui18n.so.51 (0x00007f655c227000)
    libicuuc.so.51 => /opt/Qt/5.1.1/gcc_64/lib/libicuuc.so.51 (0x00007f655bea0000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003724200000)
    libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x000000372ae00000)
    librt.so.1 => /lib64/librt.so.1 (0x0000003725200000)
    libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x0000003725e00000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003723a00000)
    libglapi.so.0 => /lib64/libglapi.so.0 (0x0000003730a00000)
    libXext.so.6 => /lib64/libXext.so.6 (0x0000003728e00000)
    libXdamage.so.1 => /lib64/libXdamage.so.1 (0x000000372fe00000)
    libXfixes.so.3 => /lib64/libXfixes.so.3 (0x0000003732600000)
    libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x000000372be00000)
    libX11.so.6 => /lib64/libX11.so.6 (0x0000003727e00000)
    libxcb-glx.so.0 => /lib64/libxcb-glx.so.0 (0x000000372da00000)
    libxcb-dri2.so.0 => /lib64/libxcb-dri2.so.0 (0x000000372d600000)
    libxcb.so.1 => /lib64/libxcb.so.1 (0x0000003727a00000)
    libXxf86vm.so.1 => /lib64/libXxf86vm.so.1 (0x0000003729e00000)
    libdrm.so.2 => /lib64/libdrm.so.2 (0x0000003730600000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003725a00000)
    libicudata.so.51 => /opt/Qt/5.1.1/gcc_64/lib/libicudata.so.51 (0x00007f655a751000)
    libXau.so.6 => /lib64/libXau.so.6 (0x0000003728200000)
    libpcre.so.1 => /lib64/libpcre.so.1 (0x0000003725600000)@

  • This is just a guess since I can't see your source code. Probably you are still using "QApplication" header instead of "QCoreApplication".

    Maybe you can post your code here

  • Moderators

    Did you remove also QT += widgets etc. from your .pro file?

  • I changed QApplication to QCoreApplication, and removed widgets from my .pro file (only QT += network left). My Code is too big to post now...but are there other things I can look for?

  • Moderators

    Yes, you should also add CONFIG += console. Take a look "here":http://qt-project.org/doc/qt-5.0/qtdoc/qmake-reference.html to find out about other qmake options available.

    Anyway, the easiest way is to create an empty console app and take a look at the generated config.

  • I tried adding CONFIG+=console to my .pro file, but the executable still has all the x11 libraries....

  • I took your advice and create a new console app, and found a few more settings

    CONFIG -=app_bundle
    QT -=gui

    and once I added those to my .pro it now looks right. Thanks!

Log in to reply

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