Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.8.2
-
None
-
Debian GNU/Linux wheezy, gcc 4.7.1
Windows XP, mingw-gcc 4.4.0
-
27d3c14ab6e8865d39f85792eb26c39b76ddf102
Description
There is the "rtti" option for qmake's CONFIG variable.
So, I think that I can always write
CONFIG += rtti
or
CONFIG -= rtti
in my project file. After that I expect appropriate compiler's option (for gcc either "-frtti"/"" or "-fno-rtti"). But it is not quite so. That statement is true only on windows.
I wrote the small test project for my experiments. That project consists of two files. File main.cpp may contain any code.
Here are results of my experiments with mingw.
D:\work\test_rtti>type test_rtti.pro LANGUAGE=C++ TEMPLATE = app QT = core gui SOURCES = main.cpp #CONFIG -= rtti D:\work\test_rtti>qmake test_rtti.pro D:\work\test_rtti>make mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory `D:/work/test_rtti' g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_ HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\Qt\4.8.2\include\QtCore" -I"..\..\Qt\4.8.2\include\QtGui" -I".. \..\Qt\4.8.2\include" -I"..\..\Qt\4.8.2\include\ActiveQt" -I"debug" -I"..\..\Qt\4.8.2\mkspecs\win32-g++" -o debug\main.o main.cpp g++ -mthreads -Wl,-subsystem,windows -o debug\test_rtti.exe debug/main.o -L"d:\Qt\4.8.2\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4 mingw32-make[1]: Leaving directory `D:/work/test_rtti'
Ok. I don't touch rtti in test_rtti.pro and option "-frtti" may be here. Then I removed the comment inside the file and saw that:
D:\work\test_rtti>type test_rtti.pro LANGUAGE=C++ TEMPLATE = app QT = core gui SOURCES = main.cpp CONFIG -= rtti D:\work\test_rtti>qmake test_rtti.pro D:\work\test_rtti>make mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory `D:/work/test_rtti' g++ -c -g -fexceptions -mthreads -Wall -fno-rtti -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -D QT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -DQT_NO_DYNAMIC_CAST -I"..\..\Qt\4.8.2\include\QtCore" -I"..\..\Qt\4. 8.2\include\QtGui" -I"..\..\Qt\4.8.2\include" -I"..\..\Qt\4.8.2\include\ActiveQt" -I"debug" -I"..\..\Qt\4.8.2\mkspecs\win32-g++" -o debug\main.o main. cpp g++ -mthreads -Wl,-subsystem,windows -o debug\test_rtti.exe debug/main.o -L"d:\Qt\4.8.2\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4 mingw32-make[1]: Leaving directory `D:/work/test_rtti'
All right. The Option "-fno-rtti" again is here.
On Linux machine (Debian) both in the first time and in the second time I saw only
user@host:/tmp/test_rtti$ make g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -o main.o main.cpp g++ -m64 -Wl,-O1 -o test_rtti main.o -L/usr/lib/x86_64-linux-gnu -lQtGui -lQtCore -lpthread
So, rtti on/off machinery doesn't work here. I wish I knew why?
So, I've done this:
user@host:~/code/qt-everywhere-opensource-src-4.8.2/mkspecs$ grep -iR rtti * common/wince/qmake.conf:QMAKE_CXXFLAGS_RTTI_ON = -GR common/wince/qmake.conf:QMAKE_CXXFLAGS_RTTI_OFF = common/symbian/symbian.conf:QMAKE_CXXFLAGS_RTTI_ON = common/symbian/symbian.conf:QMAKE_CXXFLAGS_RTTI_OFF = features/win32/rtti.prf:CONFIG -= rtti_off features/win32/rtti.prf:QMAKE_CFLAGS += $$QMAKE_CFLAGS_RTTI_ON features/win32/rtti.prf:QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RTTI_ON features/win32/default_pre.prf:CONFIG = rtti_off exceptions_off stl_off incremental_off thread_off windows $$CONFIG features/win32/rtti_off.prf:CONFIG -= rtti features/win32/rtti_off.prf:QMAKE_CFLAGS += $$QMAKE_CFLAGS_RTTI_OFF features/win32/rtti_off.prf:QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RTTI_OFF qws/linux-zylonite-g++/qmake.conf:QMAKE_CFLAGS += -DQT_QWS_ZYLONITE -DQWS -fno-rtti qws/linux-zylonite-g++/qmake.conf:QMAKE_CXXFLAGS += -DQT_QWS_ZYLONITE -DQWS -fno-rtti unsupported/win32-g++-cross/qmake.conf:QMAKE_CXXFLAGS_RTTI_ON = -frtti unsupported/win32-g++-cross/qmake.conf:QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti win32-borland/qmake.conf:QMAKE_CXXFLAGS_RTTI_ON = win32-borland/qmake.conf:QMAKE_CXXFLAGS_RTTI_OFF = -RT- win32-g++/qmake.conf:QMAKE_CXXFLAGS_RTTI_ON = -frtti win32-g++/qmake.conf:QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti win32-icc/qmake.conf:QMAKE_CXXFLAGS_RTTI_ON = -GR win32-icc/qmake.conf:QMAKE_CXXFLAGS_RTTI_OFF = win32-msvc2003/qmake.conf:QMAKE_CXXFLAGS_RTTI_ON = -GR win32-msvc2003/qmake.conf:QMAKE_CXXFLAGS_RTTI_OFF = win32-msvc2005/qmake.conf:QMAKE_CXXFLAGS_RTTI_ON = -GR win32-msvc2005/qmake.conf:QMAKE_CXXFLAGS_RTTI_OFF = win32-msvc2008/qmake.conf:QMAKE_CXXFLAGS_RTTI_ON = -GR win32-msvc2008/qmake.conf:QMAKE_CXXFLAGS_RTTI_OFF = win32-msvc2010/qmake.conf:QMAKE_CXXFLAGS_RTTI_ON = -GR win32-msvc2010/qmake.conf:QMAKE_CXXFLAGS_RTTI_OFF = user@host:~/code/qt-everywhere-opensource-src-4.8.2/mkspecs$
So, we can see that rtti on/off machinery not supported on many unix platforms! It seems to me that either this fact should be documented or such code should be added at least for all tier1 platforms.