Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 587954

Summary: media-video/vlc-2.2.x fails to build with gcc-6
Product: Gentoo Linux Reporter: Alexey Shvetsov <alexxy>
Component: Current packagesAssignee: Nick Andrade <SDNick484>
Status: RESOLVED FIXED    
Severity: normal CC: herrtimson, mail, media-video, plevine457, proxy-maint, rose, ua_gentoo_bugzilla
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 582084    
Attachments: build.log.gz
vlc-gcc-6-buildfixes.patch
vlc-2.2.X-gcc6.patch
Fix-build-using-old-GCC-intrinsics.patch

Description Alexey Shvetsov gentoo-dev 2016-07-04 08:00:52 UTC
media-video/vlc-2.2.x fails to build with gcc-6


$ emerge --info media-video/vlc
Portage 2.3.0 (python 3.5.1-final-0, default/linux/amd64/13.0/desktop/plasma, gcc-6.1.0, glibc-2.23-r2, 4.6.0-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.6.0-gentoo-x86_64-Intel-R-_Core-TM-_i3-4010U_CPU_@_1.70GHz-with-gentoo-2.2
KiB Mem:     8108376 total,    251916 free
KiB Swap:   16777212 total,  15926432 free
Timestamp of repository gentoo: Mon, 04 Jul 2016 06:45:01 +0000
sh bash 4.3_p46
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
ccache version 3.2.5 [enabled]
app-shells/bash:          4.3_p46::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.0-r1::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.3-r7::gentoo, 3.5.1-r3::gentoo
dev-util/ccache:          3.2.5::gentoo
dev-util/cmake:           3.5.2-r1::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.2-r1::gentoo
sys-apps/openrc:          0.21.1::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            5.3.0::gentoo, 6.1.0::hardened-development
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.6::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.ru.gentoo.org/gentoo-portage
    priority: -1000

crossdev
    location: /usr/local/crossdev
    masters: gentoo

alexxy
    location: /var/lib/layman/alexxy
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/dev/alexxy.git
    masters: gentoo
    priority: 50

hardened-development
    location: /var/lib/layman/hardened-development
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/hardened-dev.git
    masters: gentoo
    priority: 50

kde
    location: /var/lib/layman/kde
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/kde.git
    masters: gentoo
    priority: 50

science
    location: /var/lib/layman/science
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/sci.git
    masters: gentoo
    priority: 50

x11
    location: /var/lib/layman/x11
    sync-type: laymansync
    sync-uri: https://anongit.gentoo.org/git/proj/x11.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -mtune=native -mfpmath=sse -mavx2"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0 /var/lib/i2pd/certificates"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native -mtune=native -mfpmath=sse -mavx2"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe -march=native -mtune=native -mfpmath=sse -mavx2"
FEATURES="assume-digests binpkg-logs candy ccache cgroup config-protect-if-modified distlocks ebuild-locks fakeroot fixlafiles ipc-sandbox merge-sync metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms sign strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync webrsync-gpg xattr"
FFLAGS="-O2 -pipe -march=native -mtune=native -mfpmath=sse -mavx2"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="ru_RU.UTF-8"
LDFLAGS="-Wl,-O1,--hash-style=gnu,--sort-common,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_COMPRESS="xz"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="64bit X a52 aac acl acpi addressbook alsa amd64 attrib audit avahi avx avx2 avx256 bash-completion berkdb blas bluetooth branding bzip2 cairo caps cdda cli colord consolekit context cracklib crypt cups cvs cxx cyrillic dbus declarative detex device-mapper dhcp dhcpcd dirac djvu dri dts dvd dvdr dvi2tty dvipdfm eap-tls ebook embed_data_files emboss enca encode exif expoblending extensions extra extras faac faad fam fbcondecor fbsplash ffmpeg fftw firefox flac fma fontconfig fortran games gdbm geolocation gif gimp git glamor gmp gnuplot gnutls gpg gphoto2 gps gpu graphics graphite graphviz gstreamer gtk gtk3 hdaps hdf5 hscolour humanities iconsets iconv icu id3tag imagemagick inotify iproute2 ipv6 irc jabber jadetex java jbig jingle jpeg kde kipi kpathsea lapack laptop lastfm latex latex3 lcms ldap lensfun libnotify libv4l libv4l2 lm_sensors lto luatex lvm lzma mad matroska mktemp mmx mmxext mng modemmanager modules mp3 mp4 mpeg mplayer msms multilib multimedia music mysql natspec ncurses netlink networkmanager nls nptl nsplugin ntp ogg omega openexr opengl openmp oscar otr pam pam_ssh pango pcre pdf phonon pkcs11 plasma plotutils plugins pm-utils png policykit postscript povray ppds ps pstricks publishers pulseaudio qemu qml qt3support qt4 qt5 rar raw rdesktop readline realtime redeyes resolvconf romio rtsp schroedinger science script sctp sdl seccomp semantic-desktop session sip skins skype smp speex spell sse sse2 sse3 sse4 ssh ssl ssse3 stars startup-notification stream svg symlink syslog szip taglib tcpd telepathy tex4ht theora threads thumbnail tiff tk tools truetype twolame udev udisks unicode upnp upower urandom usb utils v4l v4l2 vaapi vde vdpau vhost-net video videos vim vim-syntax vlc vlm vnc vorbis vpx wayland webkit widgets wifi wmf wxwidgets x264 xattr xcb xcomposite xetex xindy xinerama xml xmlpatterns xmp xscreensaver xv xvid xvmc zeroconf zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="canon ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev synaptics libinput" KERNEL="linux" L10N="ru en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="ru en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" QEMU_SOFTMMU_TARGETS="x86_64" RUBY_TARGETS="ruby23" USERLAND="GNU" VIDEO_CARDS="intel i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

media-video/vlc-2.2.2::gentoo was built with the following:
USE="X a52 alsa avcodec avformat cdda dbus dts dvbpsi dvd encode faad ffmpeg flac fontconfig gcrypt gnutls growl httpd jpeg kde libnotify libsamplerate linsys lua matroska mp3 mpeg ncurses ogg opengl png postproc pulseaudio qt5 rtsp schroedinger sdl speex svg swscale taglib theora truetype twolame udev upnp v4l vaapi vdpau vlm vnc vorbis vpx x264 xcb xml xv zeroconf -aalib (-altivec) -atmo (-audioqueue) -bidi -bluray -cddb -chromaprint -dc1394 -debug -directfb (-directx) -dvb (-dxva2) -fdk -fluidsynth -gme -gnome -ieee1394 -jack -kate -libass -libav -libcaca -libtar -libtiger -lirc -live (-macosx-dialog-provider) (-macosx-eyetv) (-macosx-qtkit) (-macosx-quartztext) (-media-library) -modplug -mtp -musepack (-neon) -omxil -opencv -optimisememory -opus -projectm -qt4 -rdp -run-as-root -samba -sdl-image -sftp -shout -sid -skins -test -tremor -vcdx -wma-fixed -x265 -zvbi" ABI_X86="64" CPU_FLAGS_X86="mmx sse"
LDFLAGS="-Wl,-O1,--hash-style=gnu,--sort-common,--as-needed -L/usr/lib64/sidplay/builders/"
Comment 1 Alexey Shvetsov gentoo-dev 2016-07-04 08:01:47 UTC
Created attachment 439648 [details]
build.log.gz
Comment 2 Nick Andrade 2016-07-11 07:13:01 UTC
Thanks for reporting this. I haven't tried GCC 6 myself yet so I haven't encountered it, but it looks like other distros (i.e. OpenSuse) have a patch. I will tackle this tomorrow.
Comment 3 Nick Andrade 2016-07-12 07:14:35 UTC
Created attachment 440416 [details, diff]
vlc-gcc-6-buildfixes.patch

Patch taken from opensuse (https://build.opensuse.org/request/show/397726) to allow VLC 2.2.x to build with GCC-6; it requires USE="-atmo" (which is a deprecated feature anyway and won't be in 3.0).  This patch requires further testing before it's committed, but should work on all versions of VLC-2.2.x.

I'm still updating my system to get GCC-6.1 version you're using installed (I assume it's the one in the "hardened-development" overlay).  I will do further tests tomorrow and will update.
Comment 4 Nick Andrade 2016-07-13 05:22:05 UTC
I was able to conduct some testing, and this is what I've found:
1. VLC 2.2.x builds fine with GCC 6.1 if you're not using the new QT5 interface (enabled by the qt5 USE flag) - tested with 2.2.2, 2.2.3, & 2.2.4
2. If you enable USE="-qt4 qt5", then VLC fails 
3. The patch attached to this bug allows VLC to build with QT5 enabled using GCC 6.1.  (tested via epatch_user)

I now need to confirm whether there's any downsides to the patch (i.e. will it break VLC for GCC < 6), so more testing is needed however this patch should allow you to move forward.
Comment 5 Nick Andrade 2016-07-13 05:44:24 UTC
Okay, after further testing I have confirmed the current patch does break GCC < 6.  The break occurs even when building with "qt4 -qt5".  I'll need to do some further research to either modify it to work with both GCC versions or see if there's a mechanism in Portage to only apply it if building with GCC > 6.
Comment 6 Johannes Hirte 2016-08-22 20:37:28 UTC
Same problem with gcc-5.4.0 and Qt-5.7. It's the ordering of includes in vlc, that causes this. VLC defines some macros in vlc_atomic.h that are definded in the system headers, but with different parameters. I'm working on a patch.
Comment 7 Peter Levine 2016-09-21 06:40:06 UTC
Created attachment 447020 [details, diff]
vlc-2.2.X-gcc6.patch

(In reply to Nick Andrade from comment #5)
> Okay, after further testing I have confirmed the current patch does break
> GCC < 6.  The break occurs even when building with "qt4 -qt5".  I'll need to
> do some further research to either modify it to work with both GCC versions
> or see if there's a mechanism in Portage to only apply it if building with
> GCC > 6.

FTFY.  Changed two lines.  This should work for any version of GCC.  Tested on gcc-5.4.0 and gcc-6.2.0.
Comment 8 Peter Levine 2016-09-21 07:15:29 UTC
Created attachment 447024 [details, diff]
Fix-build-using-old-GCC-intrinsics.patch

Previous patch didn't work for USE="-qt4 qt5".
This patch is taken from Debian:

https://sources.debian.net/src/vlc/2.2.4-4/debian/patches/Fix-build-using-old-GCC-intrinsics.patch/

Tested and working for gcc-5.4.0 and gcc-6.2.0, and for USE="-qt4 qt5" and USE="qt4 -qt5".
Comment 9 Nick Andrade 2016-09-28 08:31:32 UTC
Thank you Peter, I am testing the patch on multiple GCCs, should be ready to merge the change soon.  Sorry for the delay.
Comment 10 Andrew John Hughes 2016-10-04 17:58:21 UTC
There's a much simpler fix which will work for this, and maybe for other GCC 6 cases, and that's to just revert back to the C++ standard that was the default before:

--- a/configure.ac.old	2016-08-24 23:11:00.205794236 +0100
+++ b/configure.ac	2016-08-25 01:09:22.222407299 +0100
@@ -867,6 +867,7 @@
 RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast write-strings missing-prototypes volatile-register-var error-implicit-function-declaration])
 RDC_PROG_CC_FLAGS([-pipe])
 AC_LANG_PUSH([C++])
+RDC_PROG_CXX_FLAGS([-std=gnu++98])
 RDC_PROG_CXX_WFLAGS([all extra sign-compare undef pointer-arith volatile-register-var])
 AC_LANG_POP([C++])

From the GCC 6 release notes:

"Default standard is now GNU++14

GCC 6 defaults to -std=gnu++14 instead of -std=gnu++98: the C++14 standard, plus GNU extensions. This brings several changes that users should be aware of, some new with the C++14 standard, others that appeared with the C++11 standard. The following paragraphs describe some of these changes and suggest how to deal with them.

Some users might prefer to stay with gnu++98, in which case we suggest to use the -std=gnu++98 command-line option, perhaps by putting it in CXXFLAGS or similar variables in Makefiles."

https://gcc.gnu.org/gcc-6/porting_to.html

I don't think distributions should be making extensive changes to port applications to newer versions of the C++ standard.
Comment 11 Peter Levine 2016-10-04 22:42:55 UTC
Fixed upstream:
https://git.videolan.org/?p=vlc/vlc-2.2.git;a=commit;h=8b0a359be21c8b66c7f7f5d34b85df3cf6689035

(In reply to Andrew John Hughes from comment #10)
> There's a much simpler fix which will work for this, and maybe for other GCC
> 6 cases, and that's to just revert back to the C++ standard that was the
> default before:

"-std=c++98" and "-std=gnu++98" are simple fixes that will work on most packages that fail with GCC-6 but it is a bandaid that could cripple maintenance in the future as many c++11/14 features get added to source and source files start having quiet dependence on such features. For some packages they are inevitable, temporary, and upstream. For packages that haven't been maintained in a while and aren't expected to, I suppose it wouldn't matter.  But its a bandaid that should be used sparingly.
Comment 12 Andreas Sturmlechner gentoo-dev 2016-11-27 11:11:09 UTC
Please re-check if the recent changes also fix build with gcc-6.
Comment 13 Peter Levine 2017-02-06 22:30:15 UTC
(In reply to Andreas Sturmlechner from comment #12)
> Please re-check if the recent changes also fix build with gcc-6.

Builds fine for me now.  Tested with vlc-2.2.4-r1 and gcc-6.3.0.
Comment 14 Alessandro Di Federico 2017-02-15 21:58:04 UTC
vlc-gcc-6-buildfixes.patch worked for me on media-video/vlc-2.2.4-r1[+qt5 -qt4] with GCC 5.4.0, CXXFLAGS="-std=c++11" and Qt 5.7.1-r1.

Didn't test Fix-build-using-old-GCC-intrinsics.patch.
Comment 15 Andreas Sturmlechner gentoo-dev 2017-03-05 10:50:51 UTC
(In reply to Peter Levine from comment #13)
> Builds fine for me now.  Tested with vlc-2.2.4-r1 and gcc-6.3.0.

Thanks, that's what wanted to hear.


Alessandro, the question was about vanilla 2.2.4-r1 and not about the attached patches in this bug. Please re-open if an _unmodified_ vlc-2.2.4-r1 fails to build for you.