Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 825722 - dev-libs/libgcrypt-1.9.4: error: argument 3 must be a 4-bit unsigned literal (in chacha20-ppc.c)
Summary: dev-libs/libgcrypt-1.9.4: error: argument 3 must be a 4-bit unsigned literal ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC64 Linux
: Normal normal (vote)
Assignee: Mikle Kolyada (RETIRED)
URL: https://dev.gnupg.org/T5785
Whiteboard:
Keywords:
Depends on:
Blocks: 817935
  Show dependency tree
 
Reported: 2021-11-21 18:36 UTC by Kenneth Hoste
Modified: 2022-01-17 23:33 UTC (History)
3 users (show)

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


Attachments
build.log for failing dev-libs/libgcrypt-1.9.4 on ppc64le (build.log,145.07 KB, text/plain)
2021-11-24 21:22 UTC, Kenneth Hoste
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Hoste 2021-11-21 18:36:07 UTC
Build of libgcrypt is failing on ppc64le:

libtool: compile:  powerpc64le-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/cipher -I.. -I../src -I/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/src -I../mpi -I/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/mpi -DGNUSTEP_BASE_VERSION -I/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/usr/include -fvisibility=hidden -fno-delete-null-pointer-checks -Wall -c /cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/cipher/chacha20-ppc.c  -fPIC -DPIC -o .libs/chacha20-ppc.o
In file included from /cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/cipher/chacha20-ppc.c:28:
/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/cipher/chacha20-ppc.c: In function '_gcry_chacha20_ppc8_blocks1':
/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/cipher/chacha20-ppc.c:60:10: error: argument 3 must be a 4-bit unsigned literal
   60 |   return vec_sld (v, v, (16 - (4 * idx)) & 15);
      |          ^~~~~~~

Reproducible: Always




This occurred during a Gentoo Prefix bootstrap (using portage snapshot 20211120) on a Linux/POWER9 (emulated via QEMU), but I doubt that's relevant for this problem.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-11-21 22:31:56 UTC
Thanks! Could you please include the full build.log and emerge —-info?
Comment 2 Jonas Stein gentoo-dev 2021-11-21 22:45:45 UTC
Thank you for the report. We need to have all information at hand before ticket assignment. Please provide
* the complete build.log as attachment and
* paste the emerge info 
as described on https://wiki.gentoo.org/wiki/Attach_the_logs_to_the_bug_ticket

Please reopen this ticket (Status:UNCONFIRMED) afterwards.
Comment 3 Kenneth Hoste 2021-11-24 21:22:11 UTC
Created attachment 756121 [details]
build.log for failing dev-libs/libgcrypt-1.9.4 on ppc64le
Comment 4 Kenneth Hoste 2021-11-24 21:22:46 UTC
Comment on attachment 756121 [details]
build.log for failing dev-libs/libgcrypt-1.9.4 on ppc64le

$ emerge --info dev-libs/libgcrypt
Portage 3.0.28 (python 3.9.9-final-0, default/linux/ppc64le/17.0/prefix/kernel-3.2+, gcc-10.3.0, unavailable, 4.18.0-240.1.1.el8_3.ppc64le ppc64le)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.18.0-240.1.1.el8_3.ppc64le-ppc64le-POWER9_-architected-,_altivec_supported-with-glibc2.33
KiB Mem:    15654784 total,   5661248 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sun, 21 Nov 2021 17:00:01 +0000
Head commit of repository gentoo: 756755f4c2d6092298371f3a3ef3b759606e949c
sh bash 5.1_p12
ld GNU ld (Gentoo 2.37_p1 p0) 2.37
app-shells/bash:          5.1_p12::gentoo
dev-lang/perl:            5.34.0-r5::gentoo
dev-lang/python:          3.9.9::gentoo, 3.10.0_p1::gentoo
sys-apps/baselayout:      2.8::gentoo
sys-apps/sandbox:         2.29::gentoo
sys-devel/autoconf:       2.71-r1::gentoo
sys-devel/automake:       1.16.5::gentoo
sys-devel/binutils:       2.37_p1::gentoo
sys-devel/gcc:            10.3.0-r2::gentoo
sys-devel/gcc-config:     2.5::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.15::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33-r7::gentoo
Repositories:

gentoo
    location: /cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts:
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: no

ACCEPT_KEYWORDS="ppc64 ~ppc64"
ACCEPT_LICENSE="@FREE"
CBUILD="powerpc64le-unknown-linux-gnu"
CFLAGS="-O2 -pipe -O2 -pipe"
CHOST="powerpc64le-unknown-linux-gnu"
CONFIG_PROTECT="/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/etc /etc"
CONFIG_PROTECT_MASK="/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/etc/env.d /cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/etc/gentoo-release /etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -O2 -pipe"
DISTDIR="/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/cache/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 binpkg-multi-instance config-protect-if-modified distlocks ebuild-locks fixlafiles force-prefix ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sfperms strict unknown-features-warn unmerge-logs unmerge-orphans unprivileged"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/"
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="/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp"
USE="acl bzip2 cli crypt dri fortran gdbm iconv ipv6 libglvnd ncurses nls nptl openmp pcre ppc64 prefix readline seccomp split-usr ssl unicode zlib" ABI_PPC="64" ADA_TARGET="gnat_2019" 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" 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-3 php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="fbdev mga nv r128 radeon dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
Comment 5 Kenneth Hoste 2021-11-26 18:52:00 UTC
Small update: masking dev-libs/libgcrypt-1.9.4 so dev-libs/libgcrypt-1.8.8 is installed instead works fine for me on ppc64le
Comment 6 Georgy Yakovlev archtester gentoo-dev 2022-01-17 02:28:14 UTC
I can build it just fine on non-prefix system, both stable and unstable ppc64le.

with USE=asm ofc

probably something prefix-specific after all, maybe some host header leaking in.
Comment 7 Georgy Yakovlev archtester gentoo-dev 2022-01-17 02:32:11 UTC
actually reproduced now.

I usually build with -mcpu=power9

if you have that in CFLAGS it'll build fine.

but without specifying this it will fail.

looks like it requires at least power8 crypto and some definitions to build properly.
Comment 8 Larry the Git Cow gentoo-dev 2022-01-17 02:46:14 UTC
The bug has been closed via the following commit(s):

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

commit d8a4d3fd80741ffdbd17dff2e5ecfde4220c96ab
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2022-01-17 02:44:45 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2022-01-17 02:45:59 +0000

    dev-libs/libgcrypt: add cpu_flags_ppc_vsx2
    
    to control new configure knob
    --disable-ppc-crypto-support
            Disable support for the PPC crypto instructions
            introduced in POWER 8 (PowerISA 2.07)
    
    Closes: https://bugs.gentoo.org/825722
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 dev-libs/libgcrypt/libgcrypt-1.9.4.ebuild | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Comment 9 Georgy Yakovlev archtester gentoo-dev 2022-01-17 03:23:51 UTC
while my fix solves issue partially, you still need to pass proper -mcpu in CFLAGS

this code will compile with -mcpu=power8 and later.

upstream enables power8 crypto but does not check if __POWER8_VECTOR__ is defined, which is required to build this code.

also install app-portage/cpuid2cpuflags
and configure CPU_FLAGS_PPC properly, otherwise you may be missing vector optimizations


for power9 flags will look like this:

> cat /etc/portage/package.use/50-cpu_flags.conf 
> */* altivec
> */* CPU_FLAGS_PPC: altivec vsx vsx2 vsx3
Comment 10 Larry the Git Cow gentoo-dev 2022-01-17 04:25:05 UTC
The bug has been referenced in the following commit(s):

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

commit cdc1e30fea09cd62a5d0e74f4880bb0d38ad5970
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2022-01-17 03:54:02 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2022-01-17 04:25:00 +0000

    dev-libs/libgcrypt: add more ppc specific vector flags
    
    USE="-cpu_flags_ppc_vsx3 -cpu_flags_ppc_vsx2 -cpu_flags_ppc_altivec" build
    now properly configures package with:
    ...
    cc supports PowerPC AltiVec/VSX intrinsics... (cached) no
    cc supports PowerPC AltiVec/VSX/crypto intrinsics with extra GCC flags... (cached) no
    GCC inline assembler supports PowerPC AltiVec/VSX/crypto instructions... (cached) no
    GCC inline assembler supports PowerISA 3.00 instructions... (cached) no
    ...
    Try using PPC crypto:      no
    
    Bug: https://bugs.gentoo.org/825722
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 dev-libs/libgcrypt/libgcrypt-1.9.4.ebuild | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
Comment 11 Georgy Yakovlev archtester gentoo-dev 2022-01-17 07:50:41 UTC
another issue I've noticed in your build log.


you seem to have empty CFLAGS, not only for -mcpu but for -O2 too is missing for example.


real trigger for this bug is absence of at least -O1 parameter, maybe -Os will do. default is -O2.

set that too.

a lot of software does not really build with optimizations turned off or produces horrible code.
I would check other software you've installed, maybe you've been missing those flags for a while.
Comment 12 Kenneth Hoste 2022-01-17 19:46:16 UTC
(In reply to Georgy Yakovlev from comment #11)
> another issue I've noticed in your build log.
> 
> 
> you seem to have empty CFLAGS, not only for -mcpu but for -O2 too is missing
> for example.
> 
> 
> real trigger for this bug is absence of at least -O1 parameter, maybe -Os
> will do. default is -O2.

The "emerge --info" output shows that CFLAGS *is* set though?
Comment 13 Georgy Yakovlev archtester gentoo-dev 2022-01-17 23:33:36 UTC
(In reply to Kenneth Hoste from comment #12)
> (In reply to Georgy Yakovlev from comment #11)
> > another issue I've noticed in your build log.
> > 
> > 
> > you seem to have empty CFLAGS, not only for -mcpu but for -O2 too is missing
> > for example.
> > 
> > 
> > real trigger for this bug is absence of at least -O1 parameter, maybe -Os
> > will do. default is -O2.
> 
> The "emerge --info" output shows that CFLAGS *is* set though?

but they are not in build log

here's your line:

> libtool: compile:  powerpc64le-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/cipher -I.. -I../src -I/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/src -I../mpi -I/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/mpi -DGNUSTEP_BASE_VERSION -I/cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/usr/include -fvisibility=hidden -fno-delete-null-pointer-checks -Wall -c /cvmfs/pilot.eessi-hpc.org/2021.12/compat/linux/ppc64le/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/cipher/salsa20.c  -fPIC -DPIC -o .libs/salsa20.o

and mine as counter-example:

> libtool: compile:  powerpc64le-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/cipher -I.. -I../src -I/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/src -I../mpi -I/var/tmp/portage/dev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/mpi -O2 -mcpu=power9 -ftree-vectorize -pipe -frecord-gcc-switches -fdiagnostics-show-option -fdiagnostics-color=always -fvisibility=hidden -fno-delete-null-pointer-checks -Wall -c /var/tmp/portage/d
ev-libs/libgcrypt-1.9.4/work/libgcrypt-1.9.4/cipher/salsa20.c  -fPIC -DPIC -o .libs/salsa20.o 


-O2 should be seen just before -fvisibility=hidden, but it's simply not there.

also I see your flags are doubled somehow
CFLAGS="-O2 -pipe -O2 -pipe"
^
confusing. are you concatenating COMMON_FLAGS and CFLAGS somehow?
maybe it somehow affects and confuses build system?


can you post raw make.conf just to check if it's correct?