Unsolved Building qt 5.5.1 with TDM GCC for 32 bit Windows
-
I have TDM GCC 64 which does support building 32 bit targets with -m32 flag.
However, no matter what flags I pass to qt's configure it always sets the architecture to 64 bits.
Is there a way to compile qt from sources with TDM GCC for 32 bit Windows?Here are the typical flags:
configure -static -prefix C:\qt_static -release -platform win32-g++ -nomake tests -nomake examples -opengl desktop -opensource -confirm-license
Here is the output:
QMAKESPEC...................win32-g++ (commandline) Architecture................x86_64, features: mmx sse sse2 Host Architecture...........x86_64, features: mmx sse sse2 Maketool....................mingw32-make Debug.......................no Force debug info............no C++11 support...............yes Link Time Code Generation...no Accessibility support.......yes RTTI support................yes SSE2 support................yes SSE3 support................yes SSSE3 support...............yes SSE4.1 support..............yes SSE4.2 support..............yes AVX support.................yes AVX2 support................yes NEON support................no OpenGL support..............yes Large File support..........yes NIS support.................no Iconv support...............no Evdev support...............no Mtdev support...............no Inotify support.............no eventfd(7) support..........no Glib support................no CUPS support................no OpenVG support..............no SSL support.................no OpenSSL support.............no libproxy support............no Qt D-Bus support............no Qt Widgets module support...yes Qt GUI module support.......yes QML debugging...............yes DirectWrite support.........no Use system proxies..........no QPA Backends: GDI.....................yes Direct2D................no Third Party Libraries: ZLIB support............qt GIF support.............yes JPEG support............yes PNG support.............yes FreeType support........yes Fontconfig support......no HarfBuzz support........qt PCRE support............qt ICU support.............no ANGLE...................no Dynamic OpenGL..........no Styles: Windows.................yes Windows XP..............yes Windows Vista...........yes Fusion..................yes Windows CE..............no Windows Mobile..........no Sql Drivers: ODBC....................no MySQL...................no OCI.....................no PostgreSQL..............no TDS.....................no DB2.....................no SQLite..................yes (qt) SQLite2.................no InterBase...............no Sources are in..............C:\Users\GT70\Source\qt_source\qt-everywhere-opensource-src-5.5.1\qtbase Build is done in............C:\Users\GT70\Source\qt_source\qt-everywhere-opensource-src-5.5.1\qtbase Install prefix..............C:\qt_static Headers installed to........C:\qt_static\include Libraries installed to......C:\qt_static\lib Arch-dep. data to...........C:\qt_static Plugins installed to........C:\qt_static\plugins Library execs installed to..C:\qt_static\bin QML1 imports installed to...C:\qt_static\imports QML2 imports installed to...C:\qt_static\qml Binaries installed to.......C:\qt_static\bin Arch-indep. data to.........C:\qt_static Docs installed to...........C:\qt_static\doc Translations installed to...C:\qt_static\translations Examples installed to.......C:\qt_static\examples Tests installed to..........C:\qt_static\tests WARNING: Using static linking will disable the use of plugins. Make sure you compile ALL needed modules into the library. Qt is now configured for building. Just run mingw32-make. To reconfigure, run mingw32-make confclean and configure.
-
Hi and welcome to devnet,
I'd copy the win32-g++ mkspec to e.g. win32-g++32 and add
QMAKE_CFLAGS = -m32 QMAKE_LFLAGS = -m32
to qmake.conf
Don't forget the license implication when using a static build.
-
Thank you for quick reply.
I found a way to configure it to compile 32 bit architecture.
Here is what I used:$ configure -prefix C:/qt_source -release -opengl desktop -xplatform win32-g++ -opensource -confirm-license -nomake tests -nomake examples -static -device-option CROSS_COMPILE=mingw32-
Now I hit another problem, when it is invoking archiver, it is looking for mingw32-ar, while TDM GCC's archiver is called just ar.
I tried just renaming it, but there were still issues building it. (The files are not compatible)
Do you have any ideas what to add to that? -
Then you may have to also add some parameters to ar, you can modify that in the qmake.conf file under QMAKE_LIB
-
I added "--target=pei-i386" to QMAKE_LIB it so that they are 32bits.
However, I still get error:g++ -Wl,--gc-sections -Wl,-s -Wl,-subsystem,console -o ..\..\..\bin\moc.exe .obj/release/moc.o .obj/release/preprocessor.o .obj/release/generator.o .obj/release/parser.o .obj/release/token.o .obj/release/main.o -LC:/Users/GT70/Source/qt_source/qt-everywhere-opensource-src-5.5.1/qtbase/lib -lQt5Bootstrap -luser32 -lole32 -ladvapi32 -lshell32 C:/Users/GT70/Source/qt_source/qt-everywhere-opensource-src-5.5.1/qtbase/lib/libQt5Bootstrap.a: error adding symbols: Archive has no index; run ranlib to add one collect2.exe: error: ld returned 1 exit status Makefile.Release:100: recipe for target '..\..\..\bin\moc.exe' failed
There is the same error if I do not include this flag either.
-
Did you do a clean build after you modified the mkspec ?
-
yes I did.
I think I will switch to another tool and give it a go there, TDM GCC is not the best set up for cross compiling I guess.