Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 589396 - media-video/vlc-2.2.4 USE="qt5" fails compile against qt 5.7 with "error: #error "Qt requires C++11 support""
Summary: media-video/vlc-2.2.4 USE="qt5" fails compile against qt 5.7 with "error: #er...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Nick Andrade
URL: https://github.com/gentoo/gentoo/pull...
Whiteboard:
Keywords:
Depends on:
Blocks: qt5-c++11
  Show dependency tree
 
Reported: 2016-07-22 23:03 UTC by Kent Fredric (IRC: kent\n) (RETIRED)
Modified: 2016-11-26 18:12 UTC (History)
15 users (show)

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


Attachments
emerge --ignore-default-opts --info '=media-video/vlc-2.2.4::gentoo' (einfo,7.86 KB, text/plain)
2016-07-22 23:03 UTC, Kent Fredric (IRC: kent\n) (RETIRED)
Details
build log (vlc.log,941.81 KB, text/plain)
2016-07-22 23:04 UTC, Kent Fredric (IRC: kent\n) (RETIRED)
Details
build log with atomic errors (file_589396.txt,803.06 KB, text/plain)
2016-09-12 23:59 UTC, PM
Details
vlc-atomics.patch (vlc-atomics.patch,8.42 KB, patch)
2016-09-21 06:29 UTC, Jan Kundrát (RETIRED)
Details | Diff
vlc-qt5-c++11.patch (vlc-qt5-c++11.patch,619 bytes, patch)
2016-09-21 06:31 UTC, Jan Kundrát (RETIRED)
Details | Diff
build.log.bz2 (build.log.bz2,49.09 KB, application/x-bzip)
2016-09-26 11:18 UTC, Juergen Rose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2016-07-22 23:03:34 UTC
Created attachment 441384 [details]
emerge --ignore-default-opts --info '=media-video/vlc-2.2.4::gentoo'

make  all-am
make[7]: Entering directory '/var/tmp/portage/media-video/vlc-2.2.4/work/vlc-2.2.4/modules/gui/qt4'
../../../doltlibtool  --tag=CXX   --mode=compile x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I../../..  -DMODULE_STRING=\"$(p="libqt4_plugin_la-qt4.lo"; p="${p##*/}"; p="${p#lib}"; p="${p%_plugin*}"; p="${p%.lo}"; echo "$p")\" -D__PLUGIN__  -I../../../include -I../../../inclu
de   -I/usr/include/qt5/QtWidgets -I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I/usr/include/qt5 -I/usr/include/qt5/QtX11Extras -I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I/usr/include/
qt5 -DQT5_HAS_X11  -DHAVE_XI -O2 -pipe -mtune=native -march=native -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wvolatile-register-var -fvisibility=hidden -c -o libqt4_plugin_la-qt4.lo `test -f 'qt4.cpp' || echo './'`qt4.cpp
../../../doltlibtool  --tag=CXX   --mode=compile x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I../../..  -DMODULE_STRING=\"$(p="libqt4_plugin_la-menus.lo"; p="${p##*/}"; p="${p#lib}"; p="${p%_plugin*}"; p="${p%.lo}"; echo "$p")\" -D__PLUGIN__  -I../../../include -I../../../inc
lude   -I/usr/include/qt5/QtWidgets -I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I/usr/include/qt5 -I/usr/include/qt5/QtX11Extras -I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I/usr/includ
e/qt5 -DQT5_HAS_X11  -DHAVE_XI -O2 -pipe -mtune=native -march=native -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wvolatile-register-var -fvisibility=hidden -c -o libqt4_plugin_la-menus.lo `test -f 'menus.cpp' || echo './'`menus.cpp
In file included from /usr/include/qt5/QtCore/qatomic.h:46:0,
                 from /usr/include/qt5/QtCore/qglobal.h:1145,
                 from /usr/include/qt5/QtCore/qcoreapplication.h:43,
                 from /usr/include/qt5/QtWidgets/qapplication.h:43,
                 from /usr/include/qt5/QtWidgets/QApplication:1,
                 from qt4.cpp:29:
/usr/include/qt5/QtCore/qbasicatomic.h:61:4: error: #error "Qt requires C++11 support"
 #  error "Qt requires C++11 support"


[ebuild     U ] media-video/vlc-2.2.4 [2.2.3] USE="X a52 alsa avcodec avformat bluray cdda cddb dbus dts dvb dvbpsi dvd encode faad ffmpeg flac gcrypt gme jpeg kate libass libnotify libsamplerate libtiger matroska modplug mp3 mpeg mtp musepack ncurses ogg opencv opengl opus png projectm pulseaudio qt5 rtsp schroedinger sdl sdl-image sftp shout speex svg swscale taglib theora truetype udev upnp v4l vaapi vlm vnc vorbis x264 xcb xv -aalib (-altivec) -atmo (-audioqueue) -bidi -chromaprint -dc1394 -debug -directfb (-directx) (-dxva2) -fdk -fluidsynth -fontconfig -gnome -gnutls -growl -httpd -ieee1394 -jack -kde -libav -libcaca -libtar -linsys -lirc -live -lua (-macosx-dialog-provider) (-macosx-eyetv) (-macosx-qtkit) (-macosx-quartztext) (-media-library) (-neon) -omxil -optimisememory -postproc -qt4 -rdp -run-as-root -samba -sid -skins {-test} -tremor -twolame -vcdx -vdpau -vpx -wma-fixed -x265 -xml -zeroconf -zvbi" CPU_FLAGS_X86="mmx sse"
Comment 1 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2016-07-22 23:04:57 UTC
Created attachment 441386 [details]
build log
Comment 2 Nick Andrade 2016-07-25 07:03:48 UTC
Sorry for my delayed response; it took me a while to build a system with QT 5.7 from the overlay to test.  

I confirmed the problem in VLC 2.4 and have found at least two workarounds:
1. Use GCC > 6 as they change to defaulting to C++14 (
Comment 3 Nick Andrade 2016-07-25 07:08:22 UTC
Sorry for my delayed response; it took me a while to build a system with QT 5.7 from the overlay to test.  

I confirmed the problem in VLC 2.2.4 and have found at least two workarounds:

1. Set the CXX flag "--std=c++11".  I confirmed this work with GCC 5.4.0, but presumably any GCC > 4.8.1 should work (source: https://gcc.gnu.org/projects/cxx-status.html#cxx11)

2. Use GCC > 6 as they change to defaulting to C++14 (source: https://gcc.gnu.org/gcc-6/changes.html), I have confirmed this works with GCC 6.1 from the "hardened-development" overlay.  If you go with GCC 6, you'll need the patch I posted in Bug 587954.

I will research how to incorporate one of these fixes (probably the first one) into the ebuild.
Comment 4 Michael Palimaka (kensington) gentoo-dev 2016-07-31 18:44:16 UTC
(In reply to Nick Andrade from comment #3)
> 1. Set the CXX flag "--std=c++11".  I confirmed this work with GCC 5.4.0,
> but presumably any GCC > 4.8.1 should work (source:
> https://gcc.gnu.org/projects/cxx-status.html#cxx11)

Any suggestion on how to achieve this? The usual append-cxxflags -std=c++11 seems not to be working. I'm using GCC 4.9, so happy to test.
Comment 5 Nick Andrade 2016-08-05 05:14:19 UTC
(In reply to Michael Palimaka (kensington) from comment #4)
> (In reply to Nick Andrade from comment #3)
> > 1. Set the CXX flag "--std=c++11".  I confirmed this work with GCC 5.4.0,
> > but presumably any GCC > 4.8.1 should work (source:
> > https://gcc.gnu.org/projects/cxx-status.html#cxx11)
> 
> Any suggestion on how to achieve this? The usual append-cxxflags -std=c++11
> seems not to be working. I'm using GCC 4.9, so happy to test.

Hi Michael, I'm sorry for the delayed response; I've been sick the last few days and finally got some testing done.  I was able to get the build VLC 2.2.4 w/ QT 5.7 & GCC-4.9.3 by applying the patch I posted in Bug 587954 (vlc-gcc-6-buildfixes.patch) and also using CXXFLAGS="-std=c++11".  

Now that I know the patch can work with old GCC versions, I may update the ebuild to use "-std=c++11" and the patch by default.  I would need to test some more, but I think this will be my go-forward approach.
Comment 6 Johannes Hirte 2016-08-22 19:58:39 UTC
(In reply to Nick Andrade from comment #3)
> Sorry for my delayed response; it took me a while to build a system with QT
> 5.7 from the overlay to test.  
> 
> I confirmed the problem in VLC 2.2.4 and have found at least two workarounds:
> 
> 1. Set the CXX flag "--std=c++11".  I confirmed this work with GCC 5.4.0,
> but presumably any GCC > 4.8.1 should work (source:
> https://gcc.gnu.org/projects/cxx-status.html#cxx11)

Doing so, I'm running into #587954
Comment 7 Juergen Rose 2016-09-07 17:05:11 UTC
BTW. 'USE="qt4 -qt5" emerge -v1 vl' works like a charm.
Comment 8 PM 2016-09-12 23:59:15 UTC
Created attachment 445552 [details]
build log with atomic errors

I tried it with -std=c++11, but now it fails with a bunch of atomic errors. Any idea what's that about?
Comment 9 Jan Kundrát (RETIRED) gentoo-dev 2016-09-21 06:29:27 UTC
Created attachment 447016 [details, diff]
vlc-atomics.patch

(In reply to PM from comment #8)
> I tried it with -std=c++11, but now it fails with a bunch of atomic errors.
> Any idea what's that about?

Yes, https://mailman.videolan.org/pipermail/vlc-devel/2016-July/108715.html
Comment 10 Jan Kundrát (RETIRED) gentoo-dev 2016-09-21 06:31:21 UTC
Created attachment 447018 [details, diff]
vlc-qt5-c++11.patch

Patch: Enable C++11 just for the qt module. Own hackish work.
Comment 11 benzejaa 2016-09-23 12:53:49 UTC
So I poked around a bit.

It seems the "real" problem has to do with vlc_atomic.h.  It is intended to be a c-style header that's included in a c++ context.  In a c-context, it includes <stdatomic.h> with the proper five argument function, however in a c++ context it's just providing some four argument macros.

Something along the lines of a patch that simply adds

#if (__cplusplus >= 201103L)
#include<atomic>
#else

//everything else

#endif

Alternatively, go through the cpp and hpp files and replace all instances of "vlc_atomic.h" with the regular <atomic>

Neither of these fixes are super portable or fit for sending upstream but will probably make it build on your system.

I'm going to fool around with this, and when I have a working patch I'll post it here.
Comment 12 benzejaa 2016-09-23 13:54:58 UTC
Oh ignore me, I didn't see that there was a patch from vlc posted already.  Definitely use that.
Comment 13 Juergen Rose 2016-09-26 11:16:29 UTC
(In reply to Jan Kundrát from comment #10)
> Created attachment 447018 [details, diff] [details, diff]
> vlc-qt5-c++11.patch
> 
> Patch: Enable C++11 just for the qt module. Own hackish work.

'emerge vlc' still fails with qt5 USE flag for me"
...
 make[7]: Entering directory '/var/tmp/portage/media-video/vlc-2.2.4/work/vlc-2.2.4/modules/gui/qt4'
../../../doltlibtool  --tag=CXX   --mode=compile x86_64-pc-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I../../..  -DMODULE_STRING=\"$(p="libqt4_plugin_la-qt4.lo"; p="${p##*/}"; p="${p#lib}"; p="${p%_plugin*}"; p="${p%.lo}"; echo "$p")\" -D__PLUGIN__  -I../../../include -I../../../include  -I/usr/include/samba-4.0  -I/usr/include/qt5/QtWidgets -I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I/usr/include/qt5 -I/usr/include/qt5/QtX11Extras -I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I/usr/include/qt5 -DQT5_HAS_X11 -std=c++11  -DHAVE_XI -march=native -O2 -pipe -Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wvolatile-register-var -fvisibility=hidden -c -o libqt4_plugin_la-qt4.lo `test -f 'qt4.cpp' || echo './'`qt4.cpp
In file included from ../../../include/vlc_picture.h:35:0,
                 from ../../../include/vlc_subpicture.h:34,
                 from ../../../include/vlc_spu.h:29,
                 from ../../../include/vlc_vout_osd.h:29,
                 from ../../../include/vlc_input.h:39,
                 from ../../../include/vlc_playlist.h:31,
                 from qt4.hpp:34,
                 from qt4.cpp:33:
../../../include/vlc_atomic.h:37:0: warning: "ATOMIC_FLAG_INIT" redefined
 #  define ATOMIC_FLAG_INIT false
 ^
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/atomic:41:0,
                 from /usr/include/qt5/QtCore/qatomic_cxx11.h:45,
                 from /usr/include/qt5/QtCore/qbasicatomic.h:53,
                 from /usr/include/qt5/QtCore/qatomic.h:46,
                 from /usr/include/qt5/QtCore/qglobal.h:1145,
                 from /usr/include/qt5/QtCore/qcoreapplication.h:43,
                 from /usr/include/qt5/QtWidgets/qapplication.h:43,
                 from /usr/include/qt5/QtWidgets/QApplication:1,
                 from qt4.cpp:29:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/bits/atomic_base.h:157:0: note: this is the location of the previous definition
 #define ATOMIC_FLAG_INIT { 0 }
 ^
...
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/atomic:988:25: error: macro "atomic_compare_exchange_weak_explicit" passed 5 arguments, but takes just 4
        memory_order __m2) noexcept
                         ^
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/atomic:996:25: error: macro "atomic_compare_exchange_weak_explicit" passed 5 arguments, but takes just 4
        memory_order __m2) noexcept
                         ^
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5/atomic:1004:27: error: macro "atomic_compare_exchange_strong_explicit" passed 5 arguments, but takes just 4
Comment 14 Juergen Rose 2016-09-26 11:18:31 UTC
Created attachment 448020 [details]
build.log.bz2
Comment 15 Jan Kundrát (RETIRED) gentoo-dev 2016-09-26 16:39:51 UTC
(In reply to Juergen Rose from comment #13)
> (In reply to Jan Kundrát from comment #10)
> > Created attachment 447018 [details, diff] [details, diff] [details, diff]
> > vlc-qt5-c++11.patch
> > 
> > Patch: Enable C++11 just for the qt module. Own hackish work.
> 
> 'emerge vlc' still fails with qt5 USE flag for me"

That's expected, you need an actual patch from https://bugs.gentoo.org/attachment.cgi?id=447016 as well.
Comment 16 Juergen Rose 2016-10-02 14:52:30 UTC
(In reply to Jan Kundrát from comment #15)
> (In reply to Juergen Rose from comment #13)
> > (In reply to Jan Kundrát from comment #10)
> > > Created attachment 447018 [details, diff] [details, diff] [details, diff] [details, diff]
> > > vlc-qt5-c++11.patch
> > > 
> > > Patch: Enable C++11 just for the qt module. Own hackish work.
> > 
> > 'emerge vlc' still fails with qt5 USE flag for me"
> 
> That's expected, you need an actual patch from
> https://bugs.gentoo.org/attachment.cgi?id=447016 as well.

Thanks for the hint. It works now with qt5.
Comment 17 Andreas Sturmlechner gentoo-dev 2016-10-27 18:02:30 UTC
I've set up a PR mostly about qt4 vs. qt5 conflict removal but also adding the attached patches from here to speed up things wrt Qt 5.7.x unmasking (coming very soon).
Comment 18 Dennis Schridde 2016-11-17 22:19:41 UTC
Has there been any progress with this recently? What's holding it back?
Comment 19 Dennis Schridde 2016-11-18 08:03:39 UTC
(In reply to Andreas Sturmlechner from comment #17)
> I've set up a PR mostly about qt4 vs. qt5 conflict removal but also adding
> the attached patches from here to speed up things wrt Qt 5.7.x unmasking
> (coming very soon).

The patches from efb634127e94b5d71f5bd7472f19a54d024934d9 solve the issue for me.
Comment 20 Andreas Sturmlechner gentoo-dev 2016-11-26 18:12:58 UTC
Fixed in git with commit 7698d3296b27e1f53a9abd8af43a66dc5e676541.