Dayman I hope you have something to contribute since you did gcc builds in the past.
The purpose of this is to find a way to make qbittorrent as small as possible with gcc(mingw). qBittorrent has to be linked statically to any external lib (including runtime) except the OS provided ones(Windows XP as base).
MSVC has a feature called "Link Time Code Generation" which effectively reduces the binary size a lot. Currently MSVC2008 built qbittorrent is at 15.2MB.
The gcc equivalent is supposed to be "Link Time Optimization". I was under the impression that it would help with the final binary size but it didn't. I compiled zlib,openssl,boost,libtorrent,qt from source with lto enabled. I did the same for qbittorrent. And the results are:
1. With LTO ~30MB
2. Without LTO ~20MB
So lto actually increases the binary size. Or I did something really stupid in the process.
Some info about qt configuration. In mkspecs\win32-g++\qmake.conf I changed some vars to the following:
Code: Select all
QMAKE_CFLAGS_RELEASE = -Os -momit-leaf-frame-pointer -flto -static-libgcc
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -msse -msse2 -mmmx -m3dnow
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -static-libstdc++
QMAKE_LFLAGS_RELEASE = -Wl,-s -lwinpthread -static-libgcc -static-libstdc++ -flto
I use gcc 4.7.2 from Mingw builds
I also can provide compilation instructions/help for the libs involved if anyone is interested.