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

Bug 723098

Summary: media-libs/libmp4v2-2.0.0-r1 build fails with GCC 10: error: narrowing conversion
Product: Gentoo Linux Reporter: Matt Whitlock <gentoo>
Component: Current packagesAssignee: Gentoo Sound Team <sound>
Status: RESOLVED FIXED    
Severity: normal CC: ao, atoth, jstein, plevine457, waebbl-gentoo
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=706426
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log
libmp4v2-2.0.0-narrowing-cast.patch

Description Matt Whitlock 2020-05-14 19:44:43 UTC
Created attachment 639080 [details]
build.log

media-libs/libmp4v2-2.0.0-r1 fails to build with GCC 10.1.0 due to implicit narrowing conversions in case labels:

libutil/Utility.cpp: In member function 'bool mp4v2::util::Utility::process_impl()':
libutil/Utility.cpp:534:18: error: narrowing conversion of 'mp4v2::util::Utility::LC_DEBUG' from 'unsigned int' to 'int' [-Wnarrowing]
  534 |             case LC_DEBUG:
      |                  ^~~~~~~~
libutil/Utility.cpp:538:18: error: narrowing conversion of 'mp4v2::util::Utility::LC_VERBOSE' from 'unsigned int' to 'int' [-Wnarrowing]
  538 |             case LC_VERBOSE:
      |                  ^~~~~~~~~~
libutil/Utility.cpp:545:18: error: narrowing conversion of 'mp4v2::util::Utility::LC_HELP' from 'unsigned int' to 'int' [-Wnarrowing]
  545 |             case LC_HELP:
      |                  ^~~~~~~
libutil/Utility.cpp:549:18: error: narrowing conversion of 'mp4v2::util::Utility::LC_VERSION' from 'unsigned int' to 'int' [-Wnarrowing]
  549 |             case LC_VERSION:
      |                  ^~~~~~~~~~
libutil/Utility.cpp:553:18: error: narrowing conversion of 'mp4v2::util::Utility::LC_VERSIONX' from 'unsigned int' to 'int' [-Wnarrowing]
  553 |             case LC_VERSIONX:
      |                  ^~~~~~~~~~~
make: *** [GNUmakefile:1364: libutil/Utility.lo] Error 1
make: *** Waiting for unfinished jobs....
util/mp4art.cpp: In member function 'virtual bool mp4v2::util::ArtUtility::utility_option(int, bool&)':
util/mp4art.cpp:380:14: error: narrowing conversion of 'mp4v2::util::ArtUtility::LC_ART_ANY' from 'unsigned int' to 'int' [-Wnarrowing]
  380 |         case LC_ART_ANY:
      |              ^~~~~~~~~~
util/mp4art.cpp:384:14: error: narrowing conversion of 'mp4v2::util::ArtUtility::LC_ART_INDEX' from 'unsigned int' to 'int' [-Wnarrowing]
  384 |         case LC_ART_INDEX:
      |              ^~~~~~~~~~~~
util/mp4art.cpp:393:14: error: narrowing conversion of 'mp4v2::util::ArtUtility::LC_LIST' from 'unsigned int' to 'int' [-Wnarrowing]
  393 |         case LC_LIST:
      |              ^~~~~~~
util/mp4art.cpp:397:14: error: narrowing conversion of 'mp4v2::util::ArtUtility::LC_ADD' from 'unsigned int' to 'int' [-Wnarrowing]
  397 |         case LC_ADD:
      |              ^~~~~~
util/mp4art.cpp:404:14: error: narrowing conversion of 'mp4v2::util::ArtUtility::LC_REMOVE' from 'unsigned int' to 'int' [-Wnarrowing]
  404 |         case LC_REMOVE:
      |              ^~~~~~~~~
util/mp4art.cpp:408:14: error: narrowing conversion of 'mp4v2::util::ArtUtility::LC_REPLACE' from 'unsigned int' to 'int' [-Wnarrowing]
  408 |         case LC_REPLACE:
      |              ^~~~~~~~~~
util/mp4art.cpp:415:14: error: narrowing conversion of 'mp4v2::util::ArtUtility::LC_EXTRACT' from 'unsigned int' to 'int' [-Wnarrowing]
  415 |         case LC_EXTRACT:
      |              ^~~~~~~~~~
make: *** [GNUmakefile:1348: util/mp4art.o] Error 1
util/mp4chaps.cpp: In member function 'virtual bool mp4v2::util::ChapterUtility::utility_option(int, bool&)':
util/mp4chaps.cpp:637:14: error: narrowing conversion of 'mp4v2::util::ChapterUtility::LC_CHPT_ANY' from 'unsigned int' to 'int' [-Wnarrowing]
  637 |         case LC_CHPT_ANY:
      |              ^~~~~~~~~~~
util/mp4chaps.cpp:642:14: error: narrowing conversion of 'mp4v2::util::ChapterUtility::LC_CHPT_QT' from 'unsigned int' to 'int' [-Wnarrowing]
  642 |         case LC_CHPT_QT:
      |              ^~~~~~~~~~
util/mp4chaps.cpp:647:14: error: narrowing conversion of 'mp4v2::util::ChapterUtility::LC_CHPT_NERO' from 'unsigned int' to 'int' [-Wnarrowing]
  647 |         case LC_CHPT_NERO:
      |              ^~~~~~~~~~~~
util/mp4chaps.cpp:652:14: error: narrowing conversion of 'mp4v2::util::ChapterUtility::LC_CHPT_COMMON' from 'unsigned int' to 'int' [-Wnarrowing]
  652 |         case LC_CHPT_COMMON:
      |              ^~~~~~~~~~~~~~
util/mp4chaps.cpp:657:14: error: narrowing conversion of 'mp4v2::util::ChapterUtility::LC_CHP_LIST' from 'unsigned int' to 'int' [-Wnarrowing]
  657 |         case LC_CHP_LIST:
      |              ^~~~~~~~~~~
util/mp4chaps.cpp:662:14: error: narrowing conversion of 'mp4v2::util::ChapterUtility::LC_CHP_EVERY' from 'unsigned int' to 'int' [-Wnarrowing]
  662 |         case LC_CHP_EVERY:
      |              ^~~~~~~~~~~~
util/mp4chaps.cpp:678:14: error: narrowing conversion of 'mp4v2::util::ChapterUtility::LC_CHP_EXPORT' from 'unsigned int' to 'int' [-Wnarrowing]
  678 |         case LC_CHP_EXPORT:
      |              ^~~~~~~~~~~~~
util/mp4chaps.cpp:693:14: error: narrowing conversion of 'mp4v2::util::ChapterUtility::LC_CHP_IMPORT' from 'unsigned int' to 'int' [-Wnarrowing]
  693 |         case LC_CHP_IMPORT:
      |              ^~~~~~~~~~~~~
util/mp4chaps.cpp:705:14: error: narrowing conversion of 'mp4v2::util::ChapterUtility::LC_CHP_CONVERT' from 'unsigned int' to 'int' [-Wnarrowing]
  705 |         case LC_CHP_CONVERT:
      |              ^~~~~~~~~~~~~~
util/mp4chaps.cpp:710:14: error: narrowing conversion of 'mp4v2::util::ChapterUtility::LC_CHP_REMOVE' from 'unsigned int' to 'int' [-Wnarrowing]
  710 |         case LC_CHP_REMOVE:
      |              ^~~~~~~~~~~~~
make: *** [GNUmakefile:1348: util/mp4chaps.o] Error 1


# emerge -pqv media-libs/libmp4v2
[ebuild   R   ] media-libs/libmp4v2-2.0.0-r1  USE="utils -static-libs -test" 


# emerge --info media-libs/libmp4v2
Portage 2.3.99 (python 3.8.2-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-10.1.0, glibc-2.31-r3, 4.18.0-rc3-00235-g18dd6470c2d1-dirty x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.18.0-rc3-00235-g18dd6470c2d1-dirty-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q6600_@_2.40GHz-with-glibc2.2.5
KiB Mem:     8161916 total,    803104 free
KiB Swap:    8388604 total,   6921980 free
Timestamp of repository gentoo: Wed, 13 May 2020 15:15:01 +0000
Head commit of repository gentoo: 23625f6dbfe46ce05196726e9bccef9178541c56
sh dash 0.5.10.2-r1
ld GNU gold (Gentoo 2.34 p1 2.34.0) 1.16
distcc 3.3.3 x86_64-pc-linux-gnu [disabled]
ccache version 3.7.9 [enabled]
app-shells/bash:          5.0_p17::gentoo
dev-java/java-config:     2.2.0-r4::local
dev-lang/perl:            5.30.2::gentoo
dev-lang/python:          2.7.18::gentoo, 3.6.10-r2::gentoo, 3.8.2-r2::gentoo
dev-util/ccache:          3.7.9::gentoo
dev-util/cmake:           3.17.2::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.13.4-r2::gentoo, 1.15.1-r2::gentoo, 1.16.2::gentoo
sys-devel/binutils:       2.34::gentoo
sys-devel/gcc:            9.3.0::gentoo, 10.1.0::gentoo
sys-devel/gcc-config:     2.2.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.6::gentoo (virtual/os-headers)
sys-libs/glibc:           2.31-r3::gentoo
Repositories:

local
    location: /var/db/repos/local
    masters: gentoo
    priority: -2000

bitcoin
    location: /var/lib/layman/bitcoin
    sync-type: laymansync
    sync-uri: https://gitlab.com/bitcoin/gentoo.git
    masters: gentoo
    priority: -1500

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

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

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.us.gentoo.org/gentoo-portage/
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: no
    sync-rsync-verify-max-age: 24

crossdev
    location: /var/db/repos/crossdev
    masters: gentoo

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O3 -ggdb -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/X11/xkb /usr/share/config /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /usr/share/i18n/locales/en_US /usr/share/sddm/scripts/Xsetup /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dbus-1 /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.4/ext-active/ /etc/php/cgi-php7.4/ext-active/ /etc/php/cli-php7.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O3 -ggdb -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--nospinner --unordered-display --verbose-conflicts --usepkg --load-average=8"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs ccache cgroup compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS=" 	http://mirror.leaseweb.com/gentoo/ 	http://mirrors.rit.edu/gentoo/ 	http://gentoo.mirrors.pair.com/ 	http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ "
INSTALL_MASK="/etc/systemd /lib/systemd/system /usr/lib/systemd 	/etc/pam.d 	/usr/share/bash-completion 	/usr/share/locale/*/ -/usr/share/locale/en -/usr/share/locale/en_US"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O2 -Wl,--as-needed"
LINGUAS="en_US en"
MAKEOPTS="-j5 -l8"
PKGDIR="/var/cache/binpkgs"
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 --exclude=/CACHEDIR.TAG"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acpi alsa amd64 berkdb branding bzip2 cairo cdda cdparanoia cdr cli crypt cups curl dbus declarative dri dts dvd dvdr elogind emboss encode evdev exif ffmpeg flac fontconfig gdbm gif git gmp gtk iconv icu id3tag ipv6 jpeg kde kwallet lame lcms libnotify libsamplerate libtirpc lzma mad matroska mng mp3 mp4 mpeg multilib ncurses nptl ogg opengl openmp opus pango pcre pdf phonon php plasma png policykit ppds qt5 quicktime readline sctp sdl seccomp smp spell split-usr ssl startup-notification subversion svg taglib tcmalloc theora threads tiff truetype udev udisks unicode upower usb v4l vaapi vdpau vnc vorbis vpx webkit webp widgets x264 xcb xml xv xvid xvmc zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="hda-intel" 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="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" L10N="en-US en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LIRC_DEVICES="mceusb" LLVM_TARGETS="AMDGPU" OFFICE_IMPLEMENTATION="libreoffice" POSTGRES_TARGETS="postgres12" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_8" QEMU_SOFTMMU_TARGETS="arm" RUBY_TARGETS="ruby25" SANE_BACKENDS="genesys" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi" 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"
Unset:  CC, CPPFLAGS, CTARGET, CXX, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

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

media-libs/libmp4v2-2.0.0-r1::gentoo was built with the following:
USE="utils -static-libs -test" ABI_X86="(64)"
CFLAGS="-pipe -O3 -march=native -ggdb"
CXXFLAGS="-pipe -O3 -march=native -ggdb"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs ccache cgroup compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
Comment 1 Bernd 2020-06-08 13:09:53 UTC
I'm having the same issue. Temporarily adding -Wno-narrowing to CFLAGS let's the build succeed, but adding -fcommon doesn't help.
Comment 2 Peter Levine 2020-06-13 23:36:07 UTC
Created attachment 644612 [details, diff]
libmp4v2-2.0.0-narrowing-cast.patch

Explicitly casts int to unsigned int.
Comment 3 Matt Whitlock 2020-08-04 19:27:34 UTC
(In reply to Peter Levine from comment #2)
> Created attachment 644612 [details, diff] [details, diff]
> libmp4v2-2.0.0-narrowing-cast.patch
> 
> Explicitly casts int to unsigned int.

Patch fixes build of media-libs/libmp4v2-2.0.0-r2 on ~amd64 with GCC 10.2.0.
Comment 4 Larry the Git Cow gentoo-dev 2020-08-06 13:25:07 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=45145f7b3d15af680db938c5a3fd78a68502fad7

commit 45145f7b3d15af680db938c5a3fd78a68502fad7
Author:     Jason A. Donenfeld <zx2c4@gentoo.org>
AuthorDate: 2020-08-06 13:24:14 +0000
Commit:     Jason A. Donenfeld <zx2c4@gentoo.org>
CommitDate: 2020-08-06 13:24:14 +0000

    media-libs/libmp4v2: fix compilation with recent gcc
    
    Closes: https://bugs.gentoo.org/723098
    Package-Manager: Portage-3.0.1, Repoman-2.3.23
    Signed-off-by: Jason A. Donenfeld <zx2c4@gentoo.org>

 .../files/libmp4v2-2.0.0-unsigned-int-cast.patch   | 96 ++++++++++++++++++++++
 media-libs/libmp4v2/libmp4v2-2.0.0-r2.ebuild       |  1 +
 2 files changed, 97 insertions(+)