[Solved]Building for linux statically



  • I built qt static for linux using the directions below:

    http://qt-project.org/doc/qt-5/linux-deployment.html

    It seemed to build fine (all except for make sub-src -- make didn't know what that meant, but plain make built w/o errors)

    I added the static build to my Qt Creator and it appears to build apps just fine ... except for the humongous size (~170Mb) -- debug code instead of release! When I looked at the details of my gcc_static I see default debug. When I build static and release are selected, not debug.

    Do I need to rebuild Qt? How can I fix this to get statically linked non-debug code?

    @
    Qt version 5.3.0 for Desktop

    Name:
    Qt 5.3.0 (gcc_static)
    ABI:
    x86-linux-generic-elf-64bit
    Source:
    /home/jeff/Qt/5.3/gcc_static
    mkspec:
    linux-g++
    qmake:
    /home/jeff/Qt/5.3/gcc_static/bin/qmake
    Default:
    debug
    Version:
    5.3.0
    QMAKE_SPEC
    linux-g++
    QMAKE_VERSION
    3.0
    QMAKE_XSPEC
    linux-g++
    QT_HOST_BINS
    /home/jeff/Qt/5.3/gcc_static/bin
    QT_HOST_DATA
    /home/jeff/Qt/5.3/gcc_static
    QT_HOST_LIBS
    /home/jeff/Qt/5.3/gcc_static/lib
    QT_HOST_PREFIX
    /home/jeff/Qt/5.3/gcc_static
    QT_INSTALL_ARCHDATA
    /home/jeff/Qt/5.3/gcc_static
    QT_INSTALL_BINS
    /home/jeff/Qt/5.3/gcc_static/bin
    QT_INSTALL_CONFIGURATION
    /home/jeff/Qt/5.3/gcc_static/etc/xdg
    QT_INSTALL_DATA
    /home/jeff/Qt/5.3/gcc_static
    QT_INSTALL_DEMOS
    /home/jeff/Qt/5.3/gcc_static/examples
    QT_INSTALL_DOCS
    /home/jeff/Qt/5.3/gcc_static/doc
    QT_INSTALL_EXAMPLES
    /home/jeff/Qt/5.3/gcc_static/examples
    QT_INSTALL_HEADERS
    /home/jeff/Qt/5.3/gcc_static/include
    QT_INSTALL_IMPORTS
    /home/jeff/Qt/5.3/gcc_static/imports
    QT_INSTALL_LIBEXECS
    /home/jeff/Qt/5.3/gcc_static/libexec
    QT_INSTALL_LIBS
    /home/jeff/Qt/5.3/gcc_static/lib
    QT_INSTALL_PLUGINS
    /home/jeff/Qt/5.3/gcc_static/plugins
    QT_INSTALL_PREFIX
    /home/jeff/Qt/5.3/gcc_static
    QT_INSTALL_QML
    /home/jeff/Qt/5.3/gcc_static/qml
    QT_INSTALL_TESTS
    /home/jeff/Qt/5.3/gcc_static/tests
    QT_INSTALL_TRANSLATIONS
    /home/jeff/Qt/5.3/gcc_static/translations
    QT_SYSROOT

    QT_VERSION
    5.3.0

    @

    Here's an ldd against my binary, of it matters...

    @
    linux-vdso.so.1 => (0x00007fffe347a000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f489dd79000)
    libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f489db77000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f489d957000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f489d753000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f489d54b000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f489d32c000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f489d028000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f489cd22000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f489cb0b000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f489c745000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f489e0cf000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f489c541000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f489c33a000)
    @



  • I use "strip":http://unixhelp.ed.ac.uk/CGI/man-cgi?strip to remove a debug info from the binaries and from the libraries.



  • Thanks, I never thought to strip the binary. Worked perfectly of course.


Log in to reply
 

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