Bug 5408 - qt build failure with Sourcery CodeBench ARM 2010.09
Summary: qt build failure with Sourcery CodeBench ARM 2010.09
Status: RESOLVED WONTFIX
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: PC Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-26 20:34 UTC by Luca Ceresoli
Modified: 2013-10-30 22:02 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments
Defconfig to reproduce the problem (150 bytes, application/octet-stream)
2012-07-26 20:34 UTC, Luca Ceresoli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Ceresoli 2012-07-26 20:34:42 UTC
Created attachment 4454 [details]
Defconfig to reproduce the problem

Current Buildroot master (fd08153b9d677) fails building with a minimalistic ARM Cortex-A8 config with Sourcery CodeBench ARM 2010.09 and just Qt enabled.

This is the make output:

$ LANG= make BR2_DL_DIR=~/src BR2_JLEVEL=1
>>> qt 4.8.2 Building
PATH="/home/murray/devel/buildroot/output/host/bin:/home/murray/devel/buildroot/output/host/usr/bin:/home/murray/devel/buildroot/output/host/usr/sbin/:/home/murray/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" PERLLIB="/home/murray/devel/buildroot/output/host/usr/lib/perl" /usr/bin/make -j1 -C /home/murray/devel/buildroot/output/build/qt-4.8.2
make[1]: Entering directory `/home/murray/devel/buildroot/output/build/qt-4.8.2'
cd src/tools/bootstrap/ && /usr/bin/make -f Makefile 
make[2]: Entering directory `/home/murray/devel/buildroot/output/build/qt-4.8.2/src/tools/bootstrap'
make[2]: Nothing to be done for `first'.
make[2]: Leaving directory `/home/murray/devel/buildroot/output/build/qt-4.8.2/src/tools/bootstrap'
cd src/tools/moc/ && /usr/bin/make -f Makefile 
make[2]: Entering directory `/home/murray/devel/buildroot/output/build/qt-4.8.2/src/tools/moc'
make[2]: Nothing to be done for `first'.
make[2]: Leaving directory `/home/murray/devel/buildroot/output/build/qt-4.8.2/src/tools/moc'
cd src/tools/rcc/ && /usr/bin/make -f Makefile 
make[2]: Entering directory `/home/murray/devel/buildroot/output/build/qt-4.8.2/src/tools/rcc'
make[2]: Nothing to be done for `first'.
make[2]: Leaving directory `/home/murray/devel/buildroot/output/build/qt-4.8.2/src/tools/rcc'
cd src/tools/uic/ && /usr/bin/make -f Makefile 
make[2]: Entering directory `/home/murray/devel/buildroot/output/build/qt-4.8.2/src/tools/uic'
make[2]: Nothing to be done for `first'.
make[2]: Leaving directory `/home/murray/devel/buildroot/output/build/qt-4.8.2/src/tools/uic'
cd src/corelib/ && /usr/bin/make -f Makefile 
make[2]: Entering directory `/home/murray/devel/buildroot/output/build/qt-4.8.2/src/corelib'
compiling animation/qabstractanimation.cpp
In file included from ../../include/QtCore/qatomic_armv6.h:1:0,
                 from ../../include/QtCore/../../src/corelib/arch/qatomic_armv7.h:56,
                 from ../../include/QtCore/qatomic_armv7.h:1,
                 from ../../include/QtCore/../../src/corelib/arch/qatomic_arm.h:53,
                 from ../../include/QtCore/qatomic_arm.h:1,
                 from ../../include/QtCore/../../src/corelib/arch/qatomic_arch.h:56,
                 from ../../include/QtCore/qatomic_arch.h:1,
                 from ../../include/QtCore/../../src/corelib/thread/qbasicatomic.h:227,
                 from ../../include/QtCore/qbasicatomic.h:1,
                 from ../../include/QtCore/../../src/corelib/thread/qatomic.h:46,
                 from ../../include/QtCore/qatomic.h:1,
                 from ../../include/QtCore/../../src/corelib/tools/qbytearray.h:45,
                 from ../../include/QtCore/qbytearray.h:1,
                 from ../../include/QtCore/../../src/corelib/tools/qstring.h:46,
                 from ../../include/QtCore/qstring.h:1,
                 from ../../include/QtCore/../../src/corelib/kernel/qobject.h:48,
                 from ../../include/QtCore/qobject.h:1,
                 from ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:45,
                 from ../../include/QtCore/qcoreapplication.h:1,
                 from global/qt_pch.h:58:
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h: In function 'QThreadStorage<QUnifiedTimer*>* unifiedTimer()':
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:223:25: error: output number 1 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:223:25: warning: use of memory input without lvalue in asm operand 5 is deprecated
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h: In constructor 'QUnifiedTimer::QUnifiedTimer()':
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:127:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:127:35: warning: use of memory input without lvalue in asm operand 4 is deprecated
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:127:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:127:35: warning: use of memory input without lvalue in asm operand 4 is deprecated
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:127:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:127:35: warning: use of memory input without lvalue in asm operand 4 is deprecated
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h: In destructor 'QList<T>::~QList() [with T = QAbstractAnimation*]':
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:145:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:145:35: warning: use of memory input without lvalue in asm operand 4 is deprecated
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h: In member function 'QList<T>::Node* QList<T>::detach_helper_grow(int, int) [with T = QAbstractAnimation*]':
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:145:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:145:35: warning: use of memory input without lvalue in asm operand 4 is deprecated
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h: In member function 'void QList<T>::detach_helper(int) [with T = QAbstractAnimation*]':
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:145:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:145:35: warning: use of memory input without lvalue in asm operand 4 is deprecated
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h: In member function 'void QList<T>::clear() [with T = QAbstractAnimation*]':
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:127:35: error: output number 2 not directly addressable
../../include/QtCore/../../src/corelib/arch/qatomic_armv6.h:127:35: warning: use of memory input without lvalue in asm operand 4 is deprecated
make[2]: *** [.obj/release-shared-emb-arm/qabstractanimation.o] Error 1
make[2]: Leaving directory `/home/murray/devel/buildroot/output/build/qt-4.8.2/src/corelib'
make[1]: *** [sub-corelib-make_default-ordered] Error 2
make[1]: Leaving directory `/home/murray/devel/buildroot/output/build/qt-4.8.2'
make: *** [/home/murray/devel/buildroot/output/build/qt-4.8.2/.stamp_built] Error 2

And here's the offending code around line 223:

template <typename T>
Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue)
{
    register T *result;
    asm volatile("0:\n"
                 "ldrex %[result], [%[_q_value]]\n"
                 "eors %[result], %[result], %[expectedValue]\n"
                 "itt eq\n"
                 "strexeq %[result], %[newValue], [%[_q_value]]\n"
                 "teqeq %[result], #1\n"
                 "beq 0b\n"
                 : [result] "=&r" (result),
                   "+m" (_q_value)
                 : [expectedValue] "r" (expectedValue),
                   [newValue] "r" (newValue),
                   [_q_value] "r" (&_q_value)
                 : "cc");   // <--- line 223
    return result == 0;
}

Other errors raise from similar pieces of code.
Comment 1 Luca Ceresoli 2012-07-27 15:30:15 UTC
This is a gcc 4.5 bug, as discussed in great detail at https://bugs.launchpad.net/gcc-linaro/+bug/675347 and it affects Sourcery 2010.09 too.

The bug has been fixed in later gcc (and thus Sourcery) releases, but there is a workaround in comment 23 in the launchpad bug page above.
Just adding -fno-strict-volatile-bitfields to the compilation options makes Qt build and run. Note that this flag needs to be added to Qt *and* all programs using it, since the line triggering the error is in an include file.

Should I submit a patch so that BR2_TARGET_OPTIMIZATION defaults to a value with this flag when Sourcery 2010.09 is in use? Or just document it in BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201009?
Comment 2 Luca Ceresoli 2012-07-27 15:31:15 UTC
PS: Thomas, do you think it could be wise to add all supported toolchains (including this one) to your build server?
Comment 3 Thomas Petazzoni 2012-07-28 07:42:04 UTC
(In reply to comment #2)
> PS: Thomas, do you think it could be wise to add all supported toolchains
> (including this one) to your build server?

Yes. I actually already have a bunch of CodeSourcery toolchains, but not 2010.09. I.e, I have: ARM 2010q1, ARM 2011.03 default multilib, ARM 2011.03 ARMv4 multilib, ARM 2011.09 default multilib, ARM 2011.09 thumb2 multilib. I also have x86, MIPS and PowerPC CodeSourcery toolchains. But yes, I could plan on adding *all* toolchains that we support, just to give more build coverage.

Generally speaking, the automated test builds are really only in v1 at the moment, I have a lot of ideas to improve the build coverage, and to provide a more useful Web interface for them.
Comment 4 Thomas Petazzoni 2012-07-28 07:43:29 UTC
(In reply to comment #1)
> Should I submit a patch so that BR2_TARGET_OPTIMIZATION defaults to a value
> with this flag when Sourcery 2010.09 is in use? Or just document it in
> BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201009?

Though I fully admit with the goal of ensuring that each and every configuration that an user can come up with should build, I am not sure adding this option globally to the build when this toolchain is used is a good idea. I think in this specific case, I would prefer that we add a "Known issues" chapter in the documentation, in which we list known problems and their solutions.
Comment 5 Thomas Petazzoni 2013-10-30 22:02:45 UTC
We've removed the support for ARM CS 2010.09 since a long time, so this bug cannot occur anymore with the existing toolchain profiles.