Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 763621 - media-libs/harfbuzz-2.7.4 fails to compile on ppc64
Summary: media-libs/harfbuzz-2.7.4 fails to compile on ppc64
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC64 Linux
: Normal normal (vote)
Assignee: Lars Wendler (Polynomial-C) (RETIRED)
URL: https://github.com/adrian-thurston/ra...
Whiteboard:
Keywords:
Depends on: 766039 766051
Blocks:
  Show dependency tree
 
Reported: 2021-01-05 04:56 UTC by Adam Stylinski
Modified: 2021-01-20 01:19 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Stylinski 2021-01-05 04:56:44 UTC
When compiling in a 64 bit userland, it appears the generated code in a .rl file for a pow function fails to build.  It seems to not like a static initializer list?  

Reproducible: Always

Steps to Reproduce:
emerge harfbuzz
Actual Results:  
The actual error is:
FAILED: src/libharfbuzz.so.0.20704.0.p/hb-number.cc.o 
powerpc64-unknown-linux-gnu-g++ -Isrc/libharfbuzz.so.0.20704.0.p -Isrc -I../harfbuzz-2.7.4/src -I. -I../harfbuzz-2.7.4 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/incl
den -DHAVE_CONFIG_H -O2 -mcpu=G5 -std=c++0x -std=c++14 -DHB_NDEBUG -fPIC -pthread -Wno-non-virtual-dtor -MD -MQ src/libharfbuzz.so.0.20704.0.p/hb-number.cc.o -MF src/libharfbuzz.so.0.20704.0.p/h
In file included from ../harfbuzz-2.7.4/src/hb-number.cc:29:
hb-number-parser.rl: In function ‘double _pow10(unsigned int)’:
hb-number-parser.rl:86:16: error: expected initializer before ‘<<’ token
hb-number-parser.rl:88:44: error: ‘mask’ was not declared in this scope


Expected Results:  
Compile and install

The function it's complaining about is here:
/* Works only for n < 512 */
static inline double
_pow10 (unsigned exponent)
{
  static const double _powers_of_10[] =
  {
    1.0e+256,
    1.0e+128,
    1.0e+64,
    1.0e+32,
    1.0e+16,
    1.0e+8,
    10000.,
    100.,
    10.
  };
  unsigned mask = 1 << (ARRAY_LENGTH (_powers_of_10) - 1);
  double result = 1;
  for (const double *power = _powers_of_10; mask; ++power, mask >>= 1)
    if (exponent & mask) result *= *power;
  return result;
}

So either something is messed up with the ARRAY_LENGTH macro, or it doesn't like the initializer before it.

emerge --info output:

Portage 3.0.7 (python 3.7.9-final-0, default/linux/powerpc/ppc64/17.0/64bit-userland/desktop, gcc-10.2.0, glibc-2.32-r6, 5.7.6-gentoo ppc64)
=================================================================
System uname: Linux-5.7.6-gentoo-ppc64-PPC970MP,_altivec_supported-with-gentoo-2.7
KiB Mem:    16206560 total,  10106748 free
KiB Swap:    1048572 total,   1048060 free
Timestamp of repository gentoo: Sun, 03 Jan 2021 15:00:01 +0000
Head commit of repository gentoo: e6a43c89bb209739ef57d4af453c1ce1fd5ee6f8
sh bash 5.1_p4
ld GNU ld (Gentoo 2.35.1 p2) 2.35.1
app-shells/bash:          5.1_p4::gentoo
dev-lang/perl:            5.32.0-r1::gentoo
dev-lang/python:          3.6.12::gentoo, 3.7.9-r1::gentoo, 3.8.5::gentoo, 3.9.1::gentoo
dev-util/cmake:           3.19.2::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.20::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.13.4-r2::gentoo, 1.14.1-r2::gentoo, 1.15.1-r2::gentoo, 1.16.3-r1::gentoo
sys-devel/binutils:       2.26.1::gentoo, 2.27::gentoo, 2.31.1-r3::gentoo, 2.34-r2::gentoo, 2.35.1-r1::gentoo
sys-devel/gcc:            7.4.0-r2::gentoo, 8.2.0-r6::gentoo, 9.3.0::gentoo, 10.2.0-r5::gentoo
sys-devel/gcc-config:     2.3.2-r1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.32-r6::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes

localoverlay
    location: /usr/local/portage
    masters: gentoo

haskell
    location: /var/lib/layman/haskell
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="ppc64 ~ppc64"
ACCEPT_LICENSE="*"
CBUILD="powerpc64-unknown-linux-gnu"
CFLAGS="-O2 -pipe -mcpu=G5 -mabi=altivec -maltivec -mpowerpc-gpopt -mpowerpc-gfxopt"
CHOST="powerpc64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /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/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -mcpu=G5 -mabi=altivec -maltivec -mpowerpc-gpopt -mpowerpc-gfxopt"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH 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 config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://lug.mtu.edu/gentoo/ http://mirror.leaseweb.com/gentoo/ http://gentoo.osuosl.org/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en en_US"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
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="/mnt/builddir"
USE="X a52 aac acl alsa altivec berkdb big-endian bluetooth branding bzip2 cairo cdda cdr cli crypt cscope cups dbus dri dts dvd dvdr elogind emboss encode exif flac fortran gdbm gif gpm gtk gui ibm iconv icu ipv6 jpeg lcms libglvnd libnotify mad mng mp3 mp4 mpeg ncurses nls nptl ocamlopt offensive ogg opengl openmp pam pango pcre pdf png policykit ppc64 ppds qt5 readline sdl seccomp spell split-usr ssl startup-notification svg tcpd threads tiff truetype udev udisks unicode upower usb vim-syntax vorbis wxwidgets x264 xattr xcb xml xv xvid zlib" ABI_PPC="64" ADA_TARGET="gnat_2018" 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_PPC="altivec" 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="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_8" PYTHON_TARGETS="python3_7 python3_8 python3_9" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="nouveau" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Adam Stylinski 2021-01-05 05:18:17 UTC
On further investigation, I don't think being on PPC64 has anything to do with it, at least not directly.  I'm using python 3.9, and python is what is used for the code generation.  I'm going to try an earlier python to see if it makes a difference.  If so, I'll alter the bug report to reflect it.
Comment 2 Adam Stylinski 2021-01-05 05:22:56 UTC
Python's 3.7-3.9 all seem to produce this issue.  The byproduct of the code generation is:

static inline double
_pow10 (unsigned exponent)
{       
        static const double _powers_of_10[] =
        {       
                1.0e+256,
                1.0e+128,
                1.0e+64,
                1.0e+32,
                1.0e+16,
                1.0e+8,
                10000.,
                100.,
                10.
        };
        unsigned mask << (ARRAY_LENGTH (_powers_of_10) - 1);
        double result;
        for (const double *power = _powers_of_10; mask; ++power, mask >>= 1)
        if (exponent & mask) result *= *power;
                return result;
}


Clearly the = 1 after mask is being dropped for some reason during the code generation.
Comment 3 Adam Stylinski 2021-01-05 05:30:10 UTC
ahhh, and the python is used to invoke ragel..., so it's pretty unlikely python has anything to do with the issue.  Perhaps a regression in ragel + PPC64?
Comment 4 Adam Stylinski 2021-01-05 05:43:26 UTC
Using ragel 6.10 seems to fix the issue.  I've reported the issue upstream:
https://github.com/adrian-thurston/ragel/issues/61
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-01-18 23:06:24 UTC
Can you verify =dev-util/ragel-7.0.3 and =dev-util/colm-0.14.6 work?
Comment 6 Adam Stylinski 2021-01-20 01:19:29 UTC
Yes, it seems to be working correctly now.