[Development] Help needed: Qt 3D Android build issue

Marc Mutz marc.mutz at kdab.com
Thu May 26 08:32:21 CEST 2016


Hi,

In QAtomic, we use compare_exchange_strong with a single memory_order 
argument. The failure mode is therefore calculated by libctdc++, the relevant 
code in atomic_base.h has not changed from 4.8.0 to 6.1.0, and appears to do 
the correct thing. It does use signed bitmasking operations with enums that 
have values with the high bit set (on 32-bit platforms), so theoretically 
there can be a miscompile there.

A workaround for Qt might be to pass an explicit failure mode, which would 
avoid aforementioned code in libstdc++.

If the failure is reproducible, then someone with access to the configuration 
could try the attached patch.

Thanks,
Marc

On Monday 23 May 2016 13:54:16 Sean Harmer wrote:
> Bump, is anybody able to help here please?
> 
> Thanks,
> 
> Sean
> 
> On Friday 20 May 2016 10:13:51 Sean Harmer wrote:
> > Hi,
> > 
> > Trying to submit a simple patch to Qt 3D we are hitting a weird
> > compilation error on Android CI configurations. The change is:
> > 
> > https://codereview.qt-project.org/#/c/157592/
> > 
> > and the compilation errors can be seen in full at:
> > 
> > http://testresults.qt.io/logs/qt/qt3d/489c6abe13e098eb87fa2c0a8639d43dfca
> > 8c0
> > 2f/LinuxRHEL_6_6x86_64AndroidAndroid_22armv7GCCRelease_DisableTests_Open
> > GLES
> > 2_NoUseGoldLinker/1e29b40895b69af3bcc7f2f8a4b041b69e05b286/buildlog.txt.
> > gz
> > 
> > but in brief they are:
> > 
> > In file included from /opt/android/ndk/sources/cxx-stl/gnu-
> > libstdc++/4.8/include/atomic:41:0,
> > 
> >                  from
> > 
> > /home/qt/work/install/include/QtCore/qatomic_cxx11.h:45, from
> > /home/qt/work/install/include/QtCore/qbasicatomic.h:53, from
> > /home/qt/work/install/include/QtCore/qatomic.h:46, from
> > /home/qt/work/install/include/QtCore/qglobal.h:1145, from
> > ../../include/Qt3DCore/../../src/core/qt3dcore_global.h:43,
> > 
> >                  from ../../include/Qt3DCore/qt3dcore_global.h:1,
> >                  from
> > 
> > ../../include/Qt3DRender/../../src/render/qt3drender_global.h:43,
> > 
> >                  from ../../include/Qt3DRender/qt3drender_global.h:1,
> >                  from
> > 
> > ../../include/Qt3DRender/5.7.0/Qt3DRender/private/../../../../../src/rend
> > er/ backend/backendnode_p.h:54, from
> > ../../include/Qt3DRender/5.7.0/Qt3DRender/private/backendnode_p.h:1,
> > 
> >                  from backend/entity_p.h:55,
> > 
> >                  from backend/entity.cpp:40:
> > /opt/android/ndk/sources/cxx-stl/gnu-libstdc++/4.8/include/bits/atomic_ba
> > se. h: In member function 'virtual void
> > Qt3DRender::Render::Entity::sceneChangeEvent(const QSceneChangePtr&)':
> > /opt/android/ndk/sources/cxx-stl/gnu-
> > libstdc++/4.8/include/bits/atomic_base.h:577:70: error: failure memory
> > model cannot be stronger than success memory model for
> > '__atomic_compare_exchange' return __atomic_compare_exchange_n(&_M_i,
> > &__i1, __i2, 0, __m1, __m2); ^ /opt/android/ndk/sources/cxx-stl/gnu-
> > libstdc++/4.8/include/bits/atomic_base.h:577:70: error: failure memory
> > model cannot be stronger than success memory model for
> > '__atomic_compare_exchange' return __atomic_compare_exchange_n(&_M_i,
> > &__i1, __i2, 0, __m1, __m2); ^ /opt/android/ndk/sources/cxx-stl/gnu-
> > libstdc++/4.8/include/bits/atomic_base.h:577:70: error: failure memory
> > model cannot be stronger than success memory model for
> > '__atomic_compare_exchange' return __atomic_compare_exchange_n(&_M_i,
> > &__i1, __i2, 0, __m1, __m2); ^ /opt/android/ndk/sources/cxx-stl/gnu-
> > libstdc++/4.8/include/bits/atomic_base.h:577:70: error: failure memory
> > model cannot be stronger than success memory model for
> > '__atomic_compare_exchange' return __atomic_compare_exchange_n(&_M_i,
> > &__i1, __i2, 0, __m1, __m2); ^
> > /opt/android/ndk/sources/cxx-stl/gnu-libstdc++/4.8/include/bits/atomic_ba
> > se .h: In member function 'virtual void
> > Qt3DRender::Render::Entity::initializeFromPeer(const
> > QNodeCreatedChangeBasePtr&)':
> > /opt/android/ndk/sources/cxx-stl/gnu-
> > libstdc++/4.8/include/bits/atomic_base.h:577:70: error: failure memory
> > model cannot be stronger than success memory model for
> > '__atomic_compare_exchange' return __atomic_compare_exchange_n(&_M_i,
> > &__i1, __i2, 0, __m1, __m2); ^
> > 
> > The patch makes no direct use of atomics, only via QSharedPointer. BogDan
> > reports that it builds fine with latest NDK.
> > 
> > Is this a genuine error on our part or some corner case issue with the
> > CI's installed NDK?
> > 
> > I'm at a total loss with this one and have no idea how to
> > investigate/fix.
> > 
> > Any help would be greatly appreciated. :)
> > 
> > Kind regards,
> > 
> > Sean
> > --
> > Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> > Klarälvdalens Datakonsult AB, a KDAB Group company
> > Tel. UK +44 (0)1625 809908, Sweden (HQ) +46-563-540090
> > KDAB - Qt Experts - Platform-independent software solutions
> > _______________________________________________
> > Development mailing list
> > Development at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/development

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-QAtomic-pass-explicit-failure-mode-to-std-atomic-com.patch
Type: text/x-patch
Size: 3189 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20160526/5f636f2f/attachment.bin>


More information about the Development mailing list