Static build on Cygwin with Qt3

  • Hello,

    I am trying to build an independent executable on Cygwin. It comes to my surprise a static version of Qt doesn't come with the installer of Cygwin because it makes a lot of sense to want such a feature.

    Anyways I am trying to build by statically linking the Cygwin libraries using the following features in the pro file:
    QMAKE_CC = i686-pc-mingw32-gcc
    QMAKE_CXX = i686-pc-mingw32-g++
    QMAKE_LINK = i686-pc-mingw32-g++
    QMAKE_LIB = i686-pc-mingw32-ar -ru
    QMAKE_RC = i686-pc-mingw32-windres

    QMAKE_LIBDIR += /usr/lib
    QMAKE_LFLAGS += -static-libgcc

    And I get the following error when I try executing it:
    error while loading shared libraries: libstdc++-6.dll: cannot open shared object file: No such file or directory

    ldd reports:
    ntdll.dll => /cygdrive/c/WINDOWS/system32/ntdll.dll (0x7c900000)
    kernel32.dll => /cygdrive/c/WINDOWS/system32/kernel32.dll (0x7c800000)
    msvcrt.dll => /cygdrive/c/WINDOWS/system32/msvcrt.dll (0x77c10000)
    libstdc++-6.dll => not found
    cygqt-mt-3.dll => /usr/bin/cygqt-mt-3.dll (?)

    This library is located here:

    But it still doesn't work if I copy it in /usr/bin. Any ideas?


  • I have no idea about Qt3, but information for Qt4 are "here": . Also, you'll still have to deploy some of the cygwin specific files. Oh, and of course you'll have to publish your app under the termes of the GPL, if you decide to use the static version of Qt.

    EDIT: Assuming you don't have a commercial license that is, of course

  • Thanks but I was looking not to rebuild the whole Qt. BTW if you build with the following, you won't need all the Cygwin DLL dependencies:
    QMAKE_CXX = i686-pc-mingw32-g++
    QMAKE_LINK = i686-pc-mingw32-g++

    I would hope somebody from Qt would handle the Cygwin package to include a static version of libqt-mt.dll. That would save a lot of problems.

    But my question was about libstdc++-6.dll. Anybody knows how to statically link to libstdc++-6?

  • Assuming your gcc version if >= 4.5, you can use --static libstdc++ otherwise have a look "here". In any way you'll also have to recompile Qt statically, so you can link it into your app.

  • The version of g++ that comes with the latest Cygwin is 4.3.4.

    It's surprising a static version of the library is not provided by either the Cygwin installer or the Qt installer itself. I would definitely recommend adding it somewhere.

    But thanks I'll rebuild Qt from the source package provided by Cygwin.

Log in to reply