Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 597294 - dev-qt/qtmultimedia-5.6.2 build fails in AVX intrinsics - not honoring CFLAGS
Summary: dev-qt/qtmultimedia-5.6.2 build fails in AVX intrinsics - not honoring CFLAGS
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Qt Bug Alias
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-16 16:04 UTC by Malcolm Lashley
Modified: 2016-10-16 23:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Build Log (dev-qt:qtmultimedia-5.6.2:20161016-155003.log,250.10 KB, text/plain)
2016-10-16 16:04 UTC, Malcolm Lashley
Details
emerge --info (emerge.info,7.49 KB, text/plain)
2016-10-16 16:04 UTC, Malcolm Lashley
Details
qtcore build log (dev-qt:qtcore-5.6.2:20161016-153214.log,846.23 KB, text/plain)
2016-10-16 17:07 UTC, Malcolm Lashley
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Malcolm Lashley 2016-10-16 16:04:17 UTC
Created attachment 450416 [details]
Build Log

Build fails with:

x86_64-pc-linux-gnu-g++ -c -O2 -pipe -march=core2 -msse4 -mcx16 -msahf -msse4.1 -msse4.2 -O3 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_EVDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_MULTIMEDIA_PULSEAUDIO -DQTM_PULSEAUDIO_DEFAULTBUFFER -DQT_BUILD_MULTIMEDIA_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -D_REENTRANT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -Iaudio -Icamera -Icontrols -Iplayback -Iradio -Irecording -Ivideo -I../../include -I../../include/QtMultimedia -I../../include/QtMultimedia/5.6.2 -I../../include/QtMultimedia/5.6.2/QtMultimedia -isystem /usr/include/qt5/QtGui/5.6.2 -isystem /usr/include/qt5/QtGui/5.6.2/QtGui -isystem /usr/include/qt5/QtCore/5.6.2 -isystem /usr/include/qt5/QtCore/5.6.2/QtCore -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtCore -I.moc -I/usr/lib64/qt5/mkspecs/linux-g++ -o .obj/qaudiooutput.o audio/qaudiooutput.cpp
video/qvideoframeconversionhelper_avx2.cpp: In function ‘void qt_convert_BGRA32_to_ARGB32_avx2(const QVideoFrame&, uchar*)’:
video/qvideoframeconversionhelper_avx2.cpp:47:101: warning: AVX vector return without AVX enabled changes the ABI [-Wpsabi]
                                                 12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3);
                                                                                                     ^
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/immintrin.h:41:0,
                 from /usr/include/qt5/QtCore/5.6.2/QtCore/private/qsimd_p.h:203,
                 from video/qvideoframeconversionhelper_p.h:49,
                 from video/qvideoframeconversionhelper_avx2.cpp:34:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/avxintrin.h:1252:1: error: inlining failed in call to always_inline ‘__m256i _mm256_set_epi8(char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char, char)’: target specific option mismatch
 _mm256_set_epi8  (char __q31, char __q30, char __q29, char __q28,
 ^
video/qvideoframeconversionhelper_avx2.cpp:47:101: error: called from here
                                                 12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2, 3);
                                                                                                     ^
This is due to not passing -mavx -mavx2 in CFLAGS (I upgraded CPU some time ago and switched from those specific CFLAGS to -march=native:

# emerge --info  | grep ^C.*FLAGS
CFLAGS="-O2 -pipe -ggdb -march=native"
CXXFLAGS="-O2 -pipe -ggdb -march=native"

I also have CPU_FLAGS_X86 set to include them (determined using app-portage/cpuid2cpuflags):

CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"

I figured something in QT5/cmake was storing the settings in order to ensure all of QT is built with the same flags - so I rebuilt everything (also gcc - not shown below)

emerge -av1 cmake $(qlist -ICS dev-qt | grep :5)

But still it tries to compile qtmultimedia with the (broken) CFLAGS above.

If I go into $WORKDIR manually and add -mavx -mavx2 in 

/var/tmp/portage/dev-qt/qtmultimedia-5.6.2/work/qtmultimedia-opensource-src-5.6.2/src/multimedia/Makefile

Then it builds just fine. 

Why *isn't* a full rebuild of QT from -core up - apparently not honouring CFLAGS
Comment 1 Malcolm Lashley 2016-10-16 16:04:59 UTC
Created attachment 450418 [details]
emerge --info
Comment 2 Davide Pesavento (RETIRED) gentoo-dev 2016-10-16 17:03:06 UTC
Can you attach the build log for qtcore please?
Comment 3 Malcolm Lashley 2016-10-16 17:07:35 UTC
Created attachment 450434 [details]
qtcore build log

Here ya go - that /does/ seem to get the sane CFLAGS

# grep march dev-qt:qtcore-5.6.2:20161016-153214.log | tail -n 2
x86_64-pc-linux-gnu-g++ -c -O2 -pipe -ggdb -march=native -std=c++1z -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_EVDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_USE_QSTRINGBUILDER -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I../../../include -I../../../include/QtCore -I.moc -I../../../mkspecs/linux-g++ -o .obj/recognizer.o recognizer.cpp
x86_64-pc-linux-gnu-g++ -c -O2 -pipe -ggdb -march=native -std=c++1z -fno-exceptions -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_EVDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -DQT_USE_QSTRINGBUILDER -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_CORE_LIB -I. -I../../../include -I../../../include/QtCore -I.moc -I../../../mkspecs/linux-g++ -o .obj/grammar.o grammar.cpp
Comment 4 Malcolm Lashley 2016-10-16 17:14:04 UTC
It may also be useful to mention - I have most of QT4 installed - it seems to exhibit the same behaviour with CFLAGS in qtmultimedia - but not qtcore. (However here qtmultimedia:4 builds fine)

(This was a rebuild of dev-qt/*:4 from yesterday whilst I was trying to isolate the issue.)

# ls -ltr *qtmultimedia-4.8.7*
-rw-rw---- 1 portage portage   3584 Oct 15 13:09 dev-qt:qtmultimedia-4.8.7:20161015-120920.log
-rw-rw---- 1 portage portage 447094 Oct 15 13:09 dev-qt:qtmultimedia-4.8.7:20161015-120747.log

# grep march dev-qt:qtmultimedia-4.8.7:20161015-120747.log | tail -n 1
x86_64-pc-linux-gnu-g++ -c -O2 -pipe -march=core2 -msse4 -mcx16 -msahf -msse4.1 -msse4.2 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_SHARED -DQT_BUILD_MULTIMEDIA_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DHAS_ALSA -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -DQT_HAVE_SSSE3 -DQT_HAVE_SSE4_1 -DQT_HAVE_SSE4_2 -DQT_HAVE_AVX -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/var/tmp/portage/dev-qt/qtmultimedia-4.8.7/work/qt-everywhere-opensource-src-4.8.7/mkspecs/linux-g++ -I/var/tmp/portage/dev-qt/qtmultimedia-4.8.7/work/qt-everywhere-opensource-src-4.8.7/src/multimedia -I../../include/QtCore -I../../include/QtGui -I../../include -I../../include/QtMultimedia -I.rcc/release-shared -I/var/tmp/portage/dev-qt/qtmultimedia-4.8.7/work/qt-everywhere-opensource-src-4.8.7/src/multimedia/video -I.moc/release-shared -I. -o .obj/release-shared/qaudioformat.o /var/tmp/portage/dev-qt/qtmultimedia-4.8.7/work/qt-everywhere-opensource-src-4.8.7/src/multimedia/audio/qaudioformat.cpp

# ls -ltr *qtcore-4.8.7*
-rw-rw---- 1 portage portage  106039 Oct 15 12:59 dev-qt:qtcore-4.8.7-r2:20161015-115952.log
-rw-rw---- 1 portage portage 1463519 Oct 15 12:59 dev-qt:qtcore-4.8.7-r2:20161015-115651.log

# grep march dev-qt:qtcore-4.8.7-r2:20161015-115651.log | tail -n 1
x86_64-pc-linux-gnu-g++ -c -O2 -pipe -ggdb -march=native -Wall -W -D_REENTRANT -DPROEVALUATOR_CUMULATIVE -DPROEVALUATOR_INIT_PROPS -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_XML_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -DQT_HAVE_SSSE3 -DQT_HAVE_SSE4_1 -DQT_HAVE_SSE4_2 -DQT_HAVE_AVX -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_SHARED -I/var/tmp/portage/dev-qt/qtcore-4.8.7-r2/work/qt-everywhere-opensource-src-4.8.7/mkspecs/linux-g++ -I/var/tmp/portage/dev-qt/qtcore-4.8.7-r2/work/qt-everywhere-opensource-src-4.8.7/tools/linguist/lupdate -I../../../include/QtCore -I../../../include/QtXml -I../../../include -I/var/tmp/portage/dev-qt/qtcore-4.8.7-r2/work/qt-everywhere-opensource-src-4.8.7/tools/linguist/shared -I/var/tmp/portage/dev-qt/qtcore-4.8.7-r2/work/qt-everywhere-opensource-src-4.8.7/src/declarative/qml/parser -I/var/tmp/portage/dev-qt/qtcore-4.8.7-r2/work/qt-everywhere-opensource-src-4.8.7/src/declarative/qml -I../../../include/QtDeclarative -I.moc/release-shared -I. -o .obj/release-shared/ui.o /var/tmp/portage/dev-qt/qtcore-4.8.7-r2/work/qt-everywhere-opensource-src-4.8.7/tools/linguist/lupdate/ui.cpp
Comment 5 Malcolm Lashley 2016-10-16 23:08:51 UTC
I am a massive dick... (don't ask me how much of littering qtmm and a test dummy e-build with 'echo ${CFLAGS}' it took before I figured this out...)

# grep -R qtmultimedia /etc/portage/
/etc/portage/package.env/origstuff.env:dev-qt/qtmultimedia nodebug

# cat /etc/portage/env/nodebug 
CFLAGS="-O2 -pipe -march=core2 -msse4 -mcx16 -msahf -msse4.1 -msse4.2"
CXXFLAGS="${CFLAGS}"

Gah - leftovers from not wanting to bloat my rootfs with QT's debug symbols.

Closing, please accept my sincere apologies for the time-waste.
Comment 6 Davide Pesavento (RETIRED) gentoo-dev 2016-10-16 23:52:16 UTC
No worries. Glad you quickly identified the root cause :)