PDA

View Full Version : Compilation Error: "inconsistent operand constraints in an `asm'"


jayanth
13th July 2007, 11:43
Hi,

I downloaded qt-x11-opensource-src-4.3.0 from the Trolltech website, but I'm not able to compile the code. 'make' fails, throwing the following errors:

../../include/QtCore/../../src/corelib/arch/qatomic_x86_64.h: In member function `virtual QRect QStyleSheetStyle::subElementRect(QStyle::SubElemen t, const QStyleOption*, const QWidget*) const':
../../include/QtCore/../../src/corelib/arch/qatomic_x86_64.h:105: error: inconsistent operand constraints in an `asm'
../../include/QtCore/../../src/corelib/arch/qatomic_x86_64.h:105: error: inconsistent operand constraints in an `asm'
make[1]: *** [.obj/release-shared/qstylesheetstyle.o] Error 1
make[1]: Leaving directory `/home/jayanth/programs/qt-x11-opensource-src-4.3.0/src/gui'
make: *** [sub-gui-make_default-ordered] Error 2

The code that is causing the problem is given below.

asm volatile("xchgq %0,%1"
: "=r" (newval), "+m" (*reinterpret_cast<volatile long *>(ptr))
: "0" (newval)
: "memory");

I'm running CentOS 5 on a Pentium D machine.

Please help.

Thanks!

Jayanth

jcraig
13th July 2007, 21:44
I had the same issue with Red Hat. The response from Trolltech support was...

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, available online at

http://trolltech.com/developer/task-tracker/index_html?method=entry&id=161994

I did "make confclean" and then "./configure" and then edited the
makefile to remove "-O2" from CFLAGS and CXXFLAGS. The Qt now successfully
builds.

jayanth
16th July 2007, 13:03
Thanks a lot, jcraig! I changed src/gui/Makefile the way you have described and it worked! :)

ericcgx
3rd April 2008, 17:54
thanks a lot, I'v got the same problem and I'v solve it following the indication above.
:D