Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 572904 - dev-libs/libsodium-1.0.8 build failure: ‘__builtin_ia32_aeskeygenassist128’ needs isa option -m32 -maes
Summary: dev-libs/libsodium-1.0.8 build failure: ‘__builtin_ia32_aeskeygenassist128’ n...
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Sam James
URL:
Whiteboard:
Keywords: NeedPatch
Depends on:
Blocks:
 
Reported: 2016-01-25 18:42 UTC by Robin Bankhead
Modified: 2021-04-16 14:29 UTC (History)
3 users (show)

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


Attachments
build log (dev-libs:libsodium-1.0.8:20160125-182644.log,368.89 KB, text/plain)
2016-01-25 18:42 UTC, Robin Bankhead
Details
build.log (build.log,380.00 KB, text/x-log)
2016-02-24 15:52 UTC, Michael Weber (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Bankhead 2016-01-25 18:42:08 UTC
Created attachment 423880 [details]
build log

Trying to build dev-libs/libsodium-1.0.8 with gcc-5.3.0 I get the following error:

libtool: compile:  x86_64-pc-linux-gnu-gcc -DPACKAGE_NAME=\"libsodium\" -DPACKAGE_TARNAME=\"libsodium\" -DPACKAGE_VERSION=\"1.0.8\" "-DPACKAGE_STRING=\"libsodium 1.0.8\"" -DPACKAGE_BUGREPORT=\"https://github.com/jedisct1/libsodium/issues\" -DPACKAGE_URL=\"https://github.com/jedisct1/libsodium\" -DPACKAGE=\"libsodium\" -DVERSION=\"1.0.8\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_MMINTRIN_H=1 -DHAVE_EMMINTRIN_H=1 -DHAVE_PMMINTRIN_H=1 -DHAVE_TMMINTRIN_H=1 -DHAVE_SMMINTRIN_H=1 -DHAVE_AVXINTRIN_H=1 -DHAVE_WMMINTRIN_H=1 -DHAVE_SYS_MMAN_H=1 -DNATIVE_LITTLE_ENDIAN=1 -DHAVE_TI_MODE=1 -DHAVE_WEAK_SYMBOLS=1 -DCPU_UNALIGNED_ACCESS=1 -DHAVE_MMAP=1 -DHAVE_MLOCK=1 -DHAVE_MADVISE=1 -DHAVE_MPROTECT=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_GETPID=1 -I. -I./include/sodium -I./include/sodium -mssse3 -maes -mpclmul -O2 -pipe -fomit-frame-pointer -march=btver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mno-movbe -mno-aes -mno-sha -mno-pclmul -mpopcnt -mabm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mlzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mprfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit -mno-mwaitx --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=btver1 -fstack-protector-strong -fvisibility=hidden -fPIC -fno-strict-aliasing -fno-strict-overflow -fstack-protector -Winit-self -Wwrite-strings -Wdiv-by-zero -c crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c  -fPIC -DPIC -o crypto_aead/aes256gcm/aesni/.libs/libaesni_la-aead_aes256gcm_aesni.o
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/immintrin.h:39:0,
                 from crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c:22:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/wmmintrin.h: In function ‘crypto_aead_aes256gcm_beforenm’:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/include/wmmintrin.h:89:10: error: ‘__builtin_ia32_aeskeygenassist128’ needs isa option -m32 -maes
   return (__m128i) __builtin_ia32_aeskeygenassist128 ((__v2di)__X, __C);
          ^
[followed by many further error statements the same or similar in wording - see build log]

I note that during configure there is some apparently wrong detection of crypto instructions:

checking whether C compiler accepts -mavx... yes
checking for AVX instructions set... yes
checking whether C compiler accepts -mavx... (cached) yes
checking whether C compiler accepts -maes... yes
checking whether C compiler accepts -mpclmul... yes
checking for AESNI instructions set and PCLMULQDQ... yes
checking whether C compiler accepts -maes... (cached) yes
checking whether C compiler accepts -mpclmul... (cached) yes

My APU (AMD E2-1800) definitely doesn't have AVX or AESNI.

I've tried flipping the asm and minimal USE flags, disabling distcc and ccache, and restricting to MAKEOPTS="-j1", to no avail.


emerge --info '=dev-libs/libsodium-1.0.8::gentoo'
Portage 2.2.26 (python 3.4.3-final-0, default/linux/amd64/13.0/desktop/plasma, gcc-5.3.0, glibc-2.22-r1, 4.4.0-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.4.0-gentoo-x86_64-AMD_E2-1800_APU_with_Radeon-tm-_HD_Graphics-with-gentoo-2.2
KiB Mem:     3623032 total,   1273312 free
KiB Swap:    9047036 total,   8560040 free
Timestamp of repository gentoo: Sat, 23 Jan 2016 11:45:01 +0000
sh bash 4.3_p42-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
distcc 3.2rc1 x86_64-pc-linux-gnu [enabled]
ccache version 3.2.4 [enabled]
app-shells/bash:          4.3_p42-r1::gentoo
dev-java/java-config:     2.2.0::gentoo
dev-lang/perl:            5.22.1::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.3-r7::gentoo
dev-util/ccache:          3.2.4::gentoo
dev-util/cmake:           3.4.1::gentoo
dev-util/pkgconfig:       0.29::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.20.2::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r1::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.14.1-r1::gentoo, 1.15-r1::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3::gentoo, 5.3.0::gentoo
sys-devel/gcc-config:     1.8::gentoo
sys-devel/libtool:        2.4.6-r1::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r1::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://hazel/gentoo-portage
    priority: -1000

local_overlay
    location: /usr/local/portage
    masters: gentoo
    priority: 0

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=btver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mno-movbe -mno-aes -mno-sha -mno-pclmul -mpopcnt -mabm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mlzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mprfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit -mno-mwaitx --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=btver1 -fstack-protector-strong"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/apache2-php7.0/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cgi-php7.0/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /etc/php/cli-php7.0/ext-active/ /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 -fomit-frame-pointer -march=btver1 -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mno-movbe -mno-aes -mno-sha -mno-pclmul -mpopcnt -mabm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mlzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mprfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-clwb -mno-pcommit -mno-mwaitx --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=btver1 -fstack-protector-strong"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--nospinner --verbose-conflicts --quiet-build=n"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache distcc distlocks ebuild-locks fail-clean fixlafiles merge-sync news preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gentoo.mirrors.ovh.net/gentoo-distfiles/ http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://mirror.leaseweb.com/gentoo/ http://mirrors.linuxant.fr/distfiles.gentoo.org/ http://mirror.netcologne.de/gentoo/"
LANG="en_GB.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j20 -l2.6"
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"
PORTAGE_TMPDIR="/tmp"
USE="X a52 aac acl acpi alsa amd64 bash-completion berkdb bluetooth branding bzip2 cairo cdda cddb cdr cli consolekit cracklib crypt css cups cxx dbus declarative dga djvu dri dts dvd dvdr emboss encode exif fam fbcon ffmpeg firefox flac fortran ftp gd gdbm geoip gif gimp glamor gmp gnutls gphoto2 gpm graphviz gtk hddtemp iconv imagemagick imap inotify java javascript jit jpeg kde kipi lame latex lcms ldap libkms libnotify lm_sensors lzma lzo mad maildir matroska mbox mmap mmx mmxext mng modules mp3 mp4 mpeg mplayer mtp multilib musicbrainz mysql ncurses nls nptl nsplugin ocamlopt offensive ofx ogg opengl openmp pam pango pcre pda pdf perl phonon php plasma png policykit posix postscript ppds qml qt3support qt4 qt5 quicktime radius raw readline rss rtc samba scanner sdl seccomp session sharedmem smp snmp sockets socks5 sound spell sqlite sqlite3 sse sse2 ssl startup-notification subversion svg syslog tcpd theora threads tidy tiff tk tokenizer touchpad truetype udev udisks ukit unicode upnp upnp-av upower usb v4l vaapi vcd vdpau vhosts vnc vorbis widgets wifi wmf wps wxwidgets x264 xa xattr xcb xcomposite xft xine xinerama xml xpm xscreensaver xv xvid xvmc 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="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext popcnt sse sse2 sse3 sse4a ssse3" ELIBC="glibc" ENLIGHTENMENT_MODULES="backlight battery clock comp conf-applications conf-dialogs conf-display conf-edgebindings conf-interaction conf-intl conf-keybindings conf-menus conf-paths conf-performance conf-randr conf-shelves conf-theme conf-window-manipulation conf-window-remembers connman cpufreq dropshadow everything fileman fileman-opinfo gadman ibar ibox mixer msgbus notification pager quickaccess shot start syscon systray tasks temperature tiling winlist wizard xkbswitch" 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 multiboot" INPUT_DEVICES="keyboard mouse evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_GB" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby23" SANE_BACKENDS="hp net" USERLAND="GNU" VIDEO_CARDS="radeon r600" 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_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Manuel Rüger (RETIRED) gentoo-dev 2016-02-02 17:20:06 UTC
Could you please report this issue upstream? https://github.com/jedisct1/libsodium

Thanks!
Comment 2 Gilles Dartiguelongue (RETIRED) gentoo-dev 2016-02-19 07:47:25 UTC
Looks like commit https://github.com/jedisct1/libsodium/commit/17248540e3e66296d52ef719b9825b68f63c1dbd might be a solution ?
Comment 3 Michael Weber (RETIRED) gentoo-dev 2016-02-24 15:52:44 UTC
Created attachment 426436 [details]
build.log

No, this is no solution

Portage 2.2.27 (python 2.7.11-final-0, default/linux/amd64/13.0/developer, gcc-5.3.0, glibc-2.22-r2, 4.1.15-gentoo-r1-headless.0 x86_64)
=================================================================
System uname: Linux-4.1.15-gentoo-r1-headless.0-x86_64-Intel_Core_2_Duo_P9xxx_-Penryn_Class_Core_2-with-gentoo-2.2
KiB Mem:     7974892 total,    993696 free
KiB Swap:    2097148 total,   2079840 free
sh bash 4.3_p42-r2
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
distcc 3.2rc1 x86_64-pc-linux-gnu [disabled]
ccache version 3.2.4 [enabled]
app-shells/bash:          4.3_p42-r2::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.22.1::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.3-r7::gentoo, 3.5.1-r2::gentoo
dev-util/ccache:          3.2.4::gentoo
dev-util/cmake:           3.4.3::gentoo
dev-util/pkgconfig:       0.29::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.20.5::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r1::gentoo
sys-devel/automake:       1.10.3::gentoo, 1.11.6-r1::gentoo, 1.12.6::gentoo, 1.13.4::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3::gentoo, 5.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r2::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: git://git.gentoo.org/repo/gentoo.git
    priority: -1000

ceres
    location: /etc/portage/overlay
    masters: gentoo
    priority: 0

fslmude
    location: /var/lib/layman/fslmude
    sync-type: git
    sync-uri: git+ssh://git@git.fs.lmu.de/roots/fslmude-repository.git
    masters: gentoo
    priority: 50

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

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

lorem_ipsum
    location: /var/lib/layman/lorem_ipsum
    sync-type: git
    sync-uri: git://github.com/lorem-ipsum/ebuilds.git
    masters: gentoo
    priority: 50

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

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

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

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=core2 -mcx16 -msahf -mno-movbe -mno-aes -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mno-lzcnt -mno-rdrnd -mno-f16c -mno-fsgsbase --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=core2"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/bin/trivdm /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt /var/bind /var/lib/hsqldb /var/spool/munin-async/.ssh"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.0/ext-active/ /etc/php/cgi-php7.0/ext-active/ /etc/php/cli-php7.0/ext-active/ /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=core2 -mcx16 -msahf -mno-movbe -mno-aes -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mno-lzcnt -mno-rdrnd -mno-f16c -mno-fsgsbase --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=core2"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS=" --buildpkg y"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg ccache collision-protect compress-build-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms sign split-log strict test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="https://lore.xmw.de/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/var/cache/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="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 berkdb bluray branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx djvu dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif glamor gpm gtk iconv ipv6 jack jbig jpeg jpeg2k lcms ldap libnotify mad mmx mmxext mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt3support qt4 raw readline sdl seccomp session snmp spell sse sse2 ssl ssse3 startup-notification svg tcpd threads tiff truetype udev udisks unicode upower usb vim-syntax vorbis wxwidgets x264 xattr xcb xml xv xvid zlib zsh-completion" ABI_X86="64" ALSA_CARDS="intel-hda" 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="ptp2" 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 itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de en en_US en_GB" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4 python3_5" RUBY_TARGETS="ruby23" USERLAND="GNU" VIDEO_CARDS="i965 intel nvidia radeon" 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_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 4 Michael Weber (RETIRED) gentoo-dev 2016-06-17 12:37:17 UTC
There are non-optional configure check whether or not -mmmx, -msse2, -msse3, -mssse3, -msse4.1, -mavx, -mavx2, -maes, and -mpclmul work and the result is stored in HAVE_WMMINTRIN_H et al.

I have a i7 build box/vm and cross compile for core2duo.
Due this constellation, -msse4.1 works as gcc flag on the build box during src_configure, my supplied CFLAGS=-no-sse4.1 during src_compile prevent the compiler from accepting the respective #ifdefined HAVE_WMMINTRIN_H code segments.

This needs a proper fix, CPU_FLAGS_X86 and overrides of HAVE_WMMINTRIN_H.

I fixed aesni and sse4.1 for now.

commit faf6a5dea44a39636633495e64450175b369e419
Author: Michael Weber <xmw@gentoo.org>
Date:   Fri Jun 17 14:36:26 2016 +0200

    dev-libs/libsodium: Add IUSE="cpu_flags_x86_sse4_1 cpu_flags_x86_aes"
    
    Package-Manager: portage-2.2.28

dev-libs/libsodium/files/libsodium-1.0.10-cpuflags.patch
dev-libs/libsodium/libsodium-1.0.10.ebuild
Comment 5 Manuel Rüger (RETIRED) gentoo-dev 2016-06-19 18:16:49 UTC
@Michael, thanks for your contribution.

I usually have no problem with other developers touching packages I maintain, but I expect them to cooperate with upstream if they apply patches on a distribution-level. I don't want to maintain extra patches downstream and therefore ask you to take action to get this patch upstream. Otherwise, it might be possible that the patch will be dropped in a future version bump, if it does not apply cleanly anymore.
Comment 6 Pacho Ramos gentoo-dev 2019-11-19 09:22:47 UTC
What is pending here with libsodium-1.0.18?
Comment 7 Ted Marston 2019-12-16 19:47:38 UTC
libsodium-1.0.18 configure overrides CFLAGS set in the environment. When CPU_FLAGS_X86="3dnow 3dnowext mmx mmxext sse no-aes no-sse2 no-sse3 no-ssse3 no-sse4 no-sse4.1 no-sse4.2 no-avx", configure still enables some of the disabled flags.

This results in a build failure on an Athlon i686 cpu without SS2 etc. extensions.
The build error log states:

In file included from /u4/tmp/portage/dev-libs/libsodium-1.0.18/work/libsodium-1.0.18/src/libsodium/include/sodium/private/sse2_64_32.h:14,
                 from /u4/tmp/portage/dev-libs/libsodium-1.0.18/work/libsodium-1.0.18/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c:8:
/u4/tmp/portage/dev-libs/libsodium-1.0.18/work/libsodium-1.0.18/src/libsodium/include/sodium/private/sse2_64_32.h: In function â<80><98>sodium__mm_set_epi64xâ<80><99>:
/usr/lib/gcc/i686-pc-linux-gnu/9.2.0/include/emmintrin.h:602:1: error: inlining failed in call to always_inline â<80><98>_mm_set_epi32â<80>
<99>: target specific option mismatch
  602 | _mm_set_epi32 (int __q3, int __q2, int __q1, int __q0)
      | ^~~~~~~~~~~~~
In file included from /u4/tmp/portage/dev-libs/libsodium-1.0.18/work/libsodium-1.0.18/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c:8:
/u4/tmp/portage/dev-libs/libsodium-1.0.18/work/libsodium-1.0.18/src/libsodium/include/sodium/private/sse2_64_32.h:24:12: note: called from here
   24 |     return _mm_set_epi32(x1.as32[1], x1.as32[0], x0.as32[1], x0.as32[0]);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is a similar bug and fix in bugs.gentoo.org/702554
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-04-16 04:05:04 UTC
Please try libsodium-1.0.18_p20210508?
Comment 9 Robin Bankhead 2021-04-16 14:29:46 UTC
Eh, sorry but this bug lasted longer than the affected hardware did :(

Current available CPUs if any help for testing:

Intel(R) Xeon(R) E-2224 CPU @ 3.40GHz
Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz

They seem to have every instruction known to man so probably will not be helpful here (if I understand the nature of the issue correctly) but just let me know.