Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 704230 - games-engines/scummvm-2.1.0 USE=fluidsynth with media-sound/fluidsynth-2.1.0 - In file included from ./common/scummsys.h:472, from audio/softsynth/fluidsynth.cpp:23: ./common/forbidden.h:57:89: error: expected ‘)’ before ‘SYMBOL’
Summary: games-engines/scummvm-2.1.0 USE=fluidsynth with media-sound/fluidsynth-2.1.0 ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2019-12-30 05:09 UTC by Alexandra Parker
Modified: 2019-12-30 22:38 UTC (History)
0 users

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


Attachments
Changes poisoning strategy for printf (scummvm-2.1.0-forbidden-printf-attribute.patch,346 bytes, patch)
2019-12-30 05:11 UTC, Alexandra Parker
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandra Parker 2019-12-30 05:09:05 UTC
common/forbidden.h tries to poison printf:

#define FORBIDDEN_SYMBOL_REPLACEMENT    FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*


#ifndef FORBIDDEN_SYMBOL_EXCEPTION_printf
#undef printf
#define printf  FORBIDDEN_SYMBOL_REPLACEMENT
#endif

But the following in fluidsynth/log.h triggers this macro expansion, causing a compiler error:

FLUIDSYNTH_API int fluid_log(int level, const char *fmt, ...)
#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
__attribute__ ((format (printf, 2, 3)))
#endif

The word 'printf' in this header file doesn't refer to 'printf' the function, but a keyword parameter to the format attribute, described here:

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes

My initial approach to fixing this was to use #pragma GCC poison printf if __GNUC__ or __clang__ are defined, but the simpler choice to define printf as a function-style macro, and that's what the patch I'll attach does. The patch compiles fine on my system.

Reproducible: Always

Steps to Reproduce:
1. USE=fluidsynth emerge scummvm
Actual Results:  
A compiler error occurs.

Expected Results:  
The package installs.

Portage 2.3.84 (python 3.7.6-final-0, default/linux/amd64/17.1/desktop/gnome/systemd, gcc-9.2.0, glibc-2.30-r3, 5.4.6-gentoo x86_64)
=================================================================
System uname: Linux-5.4.6-gentoo-x86_64-Intel-R-_Core-TM-_i7-3770_CPU_@_3.40GHz-with-gentoo-2.6
KiB Mem:    16365084 total,   7445868 free
KiB Swap:   16777212 total,  16368984 free
Timestamp of repository gentoo: Sun, 29 Dec 2019 20:05:44 +0000
Head commit of repository gentoo: 27e74e7843473f62b3e09cc5aedb2cb88a8b1637

sh bash 5.0_p11
ld GNU ld (Gentoo 2.33.1 p1) 2.33.1
distcc 3.3.3 x86_64-pc-linux-gnu [enabled]
app-shells/bash:          5.0_p11::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          2.7.17::gentoo, 3.6.10::gentoo, 3.7.6::gentoo
dev-util/cmake:           3.16.2-r1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.16.1-r2::gentoo
sys-devel/binutils:       2.33.1::gentoo
sys-devel/gcc:            9.2.0-r3::gentoo
sys-devel/gcc-config:     2.1::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.30-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    sync-git-verify-commit-signature: true

x-portage
    location: /mnt/storage/usr/local/portage
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -pipe  -march=ivybridge -mtune=ivybridge -maes   -O3 -fgcse-sm -fgcse-las -fgraphite -fgraphite-identity -floop-nest-optimize -ftree-vectorize -fvariable-expansion-in-unroller -fstack-protector-strong -fno-lto "
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt"
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"
CXXFLAGS="-O2 -pipe -pipe  -march=ivybridge -mtune=ivybridge -maes   -O3 -fgcse-sm -fgcse-las -fgraphite -fgraphite-identity -floop-nest-optimize -ftree-vectorize -fvariable-expansion-in-unroller -fstack-protector-strong -fno-lto "
DISTDIR="/var/portage/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=3 --load-average=8.1 --keep-going --quiet-fail y"
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 compressdebug config-protect-if-modified distcc distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict news parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="rsync://gentoo.gossamerhost.com/gentoo-distfiles/ ftp://mirror.netcologne.de/gentoo/ http://gentoo.mirrors.easynews.com/linux/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-O2 -pipe -pipe  -march=ivybridge -mtune=ivybridge -maes   -O3 -fgcse-sm -fgcse-las -fgraphite -fgraphite-identity -floop-nest-optimize -ftree-vectorize -fvariable-expansion-in-unroller -fstack-protector-strong -fno-lto  -Wl,-O1,--sort-common,--hash-style=gnu,--as-needed,-z,now -fno-lto"
LINGUAS="en ja"
MAKEOPTS="-j24 -l8"
PKGDIR="/var/cache/binpkgs"
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="X a52 aac acl acoustid acpi alsa amd64 ao archive audiofile avahi berkdb bluetooth branding bzip2 cairo cdda cddb cdr cjk cli colord crypt cups curl cxx dbus dc1394 dri dts dvd dvdr eds emboss encode evo exif faac faad fam firefox flac fortran fuse gdbm gif gnome gnome-keyring gnome-online-accounts gnutls gphoto2 gpm gstreamer gtk gtkhtml iconv icu ieee1394 introspection ipv6 jpeg jpeg2k lcms ldap leim libglvnd libnotify libsamplerate libsecret libtirpc libv4l lm_sensors lzma mad matroska mikmod mmap mng modplug mono mp3 mp4 mpeg multilib musepack nautilus ncurses networkmanager nls nptl offensive ogg opengl openmp pam pango pcre pdf png policykit postproc ppds pulseaudio qt5 readline samba schroedinger sdl seccomp slang sndfile speex spell split-usr ssl startup-notification svg systemd tcpd theora threads tiff tracker truetype udev udisks unicode upnp upower usb v4l vaapi vdpau vorbis vpx winbind wxwidgets x264 xattr xcb xcomposite xinerama xml xv xvid xvmc zlib" ABI_X86="64 32" ADA_TARGET="gnat_2018" APACHE2_MODULES="actions alias auth_digest authn_anon authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias inotify auth_basic authn_core authz_core lbmethod_byrequests lbmethod_bytraffic lbmethod_bybusyness lbmethod_heartbeat unixd socache_shmcb slotmem_shm networkmanager" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx f16c mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="openssl" 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" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev" KERNEL="linux" L10N="en ja" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python3_7 python3_6 python2_7" RUBY_TARGETS="ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="vga vesa nvidia" 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, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Alexandra Parker 2019-12-30 05:11:24 UTC
Created attachment 601754 [details, diff]
Changes poisoning strategy for printf
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2019-12-30 08:10:45 UTC
(In reply to Alex Parker from comment #0)
> But the following in fluidsynth/log.h triggers this macro expansion, causing
> a compiler error:

Can you provide that coompiler error message for clarity's sake? Attaching the full build log would help as well.
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2019-12-30 08:34:42 UTC
In file included from ./common/scummsys.h:472,
                 from audio/softsynth/fluidsynth.cpp:23:
./common/forbidden.h:57:89: error: expected ‘)’ before ‘SYMBOL’
   57 | #define FORBIDDEN_SYMBOL_REPLACEMENT FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
      |                                                                                         ^~~~~~
In file included from /usr/include/fluidsynth.h:105,
                 from audio/softsynth/fluidsynth.cpp:38:
/usr/include/fluidsynth/log.h:82:24: note: to match this ‘(’
   82 | __attribute__ ((format (printf, 2, 3)))
      |                        ^
make: *** [Makefile.common:121: audio/softsynth/fluidsynth.o] Error 1
make: *** Waiting for unfinished jobs....
Comment 4 Alexandra Parker 2019-12-30 19:17:42 UTC
(In reply to Jeroen Roovers from comment #3)
> In file included from ./common/scummsys.h:472,
>                  from audio/softsynth/fluidsynth.cpp:23:
> ./common/forbidden.h:57:89: error: expected ‘)’ before ‘SYMBOL’
>    57 | #define FORBIDDEN_SYMBOL_REPLACEMENT
> FORBIDDEN_look_at_common_forbidden_h_for_more_info SYMBOL !%*
>       |                                                                     
> ^~~~~~
> In file included from /usr/include/fluidsynth.h:105,
>                  from audio/softsynth/fluidsynth.cpp:38:
> /usr/include/fluidsynth/log.h:82:24: note: to match this ‘(’
>    82 | __attribute__ ((format (printf, 2, 3)))
>       |                        ^
> make: *** [Makefile.common:121: audio/softsynth/fluidsynth.o] Error 1
> make: *** Waiting for unfinished jobs....

Yes that's exactly the error message. Sorry!
Comment 5 James Le Cuirot gentoo-dev 2019-12-30 22:22:01 UTC
Although I like your fix better, they've already fixed it in https://github.com/scummvm/scummvm/commit/8593a9e1e4e8dd1f5dfac9b1304a417df9a742e6.
Comment 6 James Le Cuirot gentoo-dev 2019-12-30 22:30:00 UTC
Hah spoke too soon and didn't read the rest of the bug report. They did this instead!
https://github.com/scummvm/scummvm/commit/68758a879e0c8ecc0d40962516d4e808aa4e15e5
Comment 7 Larry the Git Cow gentoo-dev 2019-12-30 22:38:46 UTC
The bug has been closed via the following commit(s):

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

commit d4b50daa7a356bbf112e37bd712d3d7b29d1c001
Author:     James Le Cuirot <chewi@gentoo.org>
AuthorDate: 2019-12-30 22:37:09 +0000
Commit:     James Le Cuirot <chewi@gentoo.org>
CommitDate: 2019-12-30 22:38:24 +0000

    games-engines/scummvm: Upstream patch for fluidsynth-2.1.0
    
    Closes: https://bugs.gentoo.org/704230
    Package-Manager: Portage-2.3.84, Repoman-2.3.20
    Signed-off-by: James Le Cuirot <chewi@gentoo.org>

 .../scummvm/files/scummvm-2.1.0-fluidsynth.patch   | 39 ++++++++++++++++++++++
 games-engines/scummvm/scummvm-2.1.0.ebuild         |  1 +
 2 files changed, 40 insertions(+)