Page 1 of 1

Troubles compiling Qt with broken GCC releases

Posted: Tue Jan 01, 2008 2:56 pm
by admin
After successfully configuring Qt, you can get the following error after starting make:

Code: Select all

g++ -c -include .pch/release-shared/QtGui -m64 -pipe -g -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -O2 -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_BUILD_GUI_LIB -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_44_API_QSQLQUERY_FINISH -DQT3_SUPPORT -DQT_MOC_COMPAT -DQT_RASTER_IMAGEENGINE -DQT_HAVE_MMX -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_NO_STYLE_MAC -DQT_NO_STYLE_WINDOWSVISTA -DQT_NO_STYLE_WINDOWSXP -DQ_INTERNAL_QAPP_SRC -DQT_NO_DEBUG -DQT_CORE_LIB -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../mkspecs/linux-g++-64 -I. -I../../include/QtCore -I../../include/QtCore -I../../include -I../../include/QtGui -I/usr/include/freetype2 -I../3rdparty/harfbuzz/src -Idialogs -I.moc/release-shared -I/usr/X11R6/include -I.uic/release-shared -o .obj/release-shared/qstylesheetstyle.o styles/qstylesheetstyle.cpp
../../include/QtCore/../../src/corelib/arch/qatomic_x86_64.h: In member function `virtual QRect QStyleSheetStyle::subControlRect(QStyle::ComplexControl, const QStyleOptionComplex*, QStyle::SubControl, const QWidget*) const':
../../include/QtCore/../../src/corelib/arch/qatomic_x86_64.h:120: error: inconsistent operand constraints in an `asm'
../../include/QtCore/../../src/corelib/arch/qatomic_x86_64.h:120: error: inconsistent operand constraints in an `asm'
../../include/QtCore/../../src/corelib/arch/qatomic_x86_64.h:120: error: inconsistent operand constraints in an `asm'
../../include/QtCore/../../src/corelib/arch/qatomic_x86_64.h:120: error: inconsistent operand constraints in an `asm'
gmake[1]: *** [.obj/release-shared/qstylesheetstyle.o] Error 1
gmake[1]: Leaving directory `/root/qt-x11-opensource-src-4.3.2/src/gui'
gmake: *** [sub-gui-make_default-ordered] Error 2
[From http://www.qtcentre.org/forum]
This is a known issue when building Qt 4.3 with gcc 3.4. To work around this bug, recompile qstylesheetstyle.cpp with removing -O2, or add the -fno-gcse compiler option. For more information, please see the description of task 161994

If you can, upgrade GCC to a more recent release. To check your current GCC release:

Code: Select all

gcc --version
Clear current configuration

Code: Select all

make confclean
Re-configure Qt

Code: Select all

./configure
Edit file qt-x11-opensource-src-4.3.2/src/gui/Makefile and add option -fno-gcse to CFLAGS and CXXFLAGS
Line 14: CFLAGS = -pipe -g -O2 -fno-gcse -fvisibility=hidden -Wall -W -D_REENTRANT -f PIC $(DEFINES)
Line 15: CXXFLAGS = -pipe -g -pthread -I/usr/include/glib-2.0 -I/usr/lib64/gl ib-2.0/include -O2 -fno-gcse -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC $(DEFINES)
Build Qt normally

Code: Select all

make