Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 840580 - media-libs/openexr-3.1.5: undefined reference to `half_to_float8' (x86)
Summary: media-libs/openexr-3.1.5: undefined reference to `half_to_float8' (x86)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Bernd
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks: 839582
  Show dependency tree
 
Reported: 2022-04-24 10:41 UTC by Joonas Niilola
Modified: 2022-09-28 08:19 UTC (History)
3 users (show)

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


Attachments
buil.dlog (openexr-3.1.5:20220424-103513.log,155.06 KB, text/plain)
2022-04-24 10:41 UTC, Joonas Niilola
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joonas Niilola gentoo-dev 2022-04-24 10:41:47 UTC
Created attachment 774100 [details]
buil.dlog

# emerge --info
Portage 3.0.30 (python 3.9.11-final-0, default/linux/x86/17.0, gcc-11.2.1, glibc-2.34-r10, 5.17.0-pf3 i686)
=================================================================
System uname: Linux-5.17.0-pf3-i686-AMD_Ryzen_7_3700X_8-Core_Processor-with-glibc2.34
KiB Mem:    32855304 total,  31653944 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Sun, 24 Apr 2022 09:34:05 +0000
Head commit of repository gentoo: e0fa7abfd5d788afb11c2c3597081a4ec17436b6

sh bash 5.1_p16
ld GNU ld (Gentoo 2.37_p1 p2) 2.37
app-misc/pax-utils:        1.3.3::gentoo
app-shells/bash:           5.1_p16::gentoo
dev-lang/perl:             5.34.0-r9::gentoo
dev-lang/python:           3.8.13::gentoo, 3.9.11::gentoo, 3.10.3::gentoo
dev-util/cmake:            3.22.2::gentoo
sys-apps/baselayout:       2.7-r3::gentoo
sys-apps/openrc:           0.44.10::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-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc:             11.2.1_p20220115::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.6-r6::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.15-r3::gentoo (virtual/os-headers)
sys-libs/glibc:            2.34-r10::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo
    priority: -1000

ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="*"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--autounmask=y --autounmask-continue --autounmask-use=y --autounmask-write --binpkg-changed-deps=y --buildpkg-exclude virtual --buildpkg-exclude acct-* --buildpkg-exclude sys-kernel --nospinner --jobs=8 --usepkg"
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="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="https://distfiles.gentoo.org"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS=" en en_US en-US fi sv "
MAKEOPTS="-j16"
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="acl bzip2 cli crypt dbus dri elogind fortran gdbm iconv ipv6 libglvnd libtirpc ncurses nptl openmp openrc pam pcre readline seccomp split-usr ssl udev unicode x86 xattr zlib" ABI_X86="32" ADA_TARGET="gnat_2020" 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="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sha sse sse2 sse3 sse4_1 sse4_2 sse4a 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 en_US en-US fi sv" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AMDGPU BPF" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" RUBY_TARGETS="ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi" 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:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SHELL, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Bernd 2022-06-03 08:04:58 UTC
Trying to reproduce this. Don't have a native x86 machine though.

In my chroot, I'm using -march=i686 by default, which leads to a successful build. When I swith to -march=native, which you are using as well, the build fails with the same error.

Could it be, this is an issue with the march setting, or gcc?

When comparing the preprocessor definitions (gcc -dM -E) for both march flags in my chroot, they have quite a few differences, including SIMD #defines not defined with march=i686, although it should have this capabilities (like sse{,2}, mmx).

Also
(chroot32) # echo "" | gcc -march=i686 -v -E - 2>&1 | grep cc1
 /usr/libexec/gcc/i686-pc-linux-gnu/11.3.0/cc1 -E -quiet -v - -march=i686 -dumpbase -
(chroot32) # echo "" | gcc -march=native -v -E - 2>&1 | grep cc1
 /usr/libexec/gcc/i686-pc-linux-gnu/11.3.0/cc1 -E -quiet -v - -march=znver2 -mmmx -mpopcnt -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mavx2 -msse4a -mno-fma4 -mno-xop -mfma -mno-avx512f -mbmi -mbmi2 -maes -mpclmul -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512vbmi -mno-avx512ifma -mno-avx5124vnniw -mno-avx5124fmaps -mno-avx512vpopcntdq -mno-avx512vbmi2 -mno-gfni -mno-vpclmulqdq -mno-avx512vnni -mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -madx -mabm -mno-cldemote -mclflushopt -mclwb -mclzero -mcx16 -mno-enqcmd -mf16c -mfsgsbase -mfxsr -mno-hle -msahf -mno-lwp -mlzcnt -mmovbe -mno-movdir64b -mno-movdiri -mmwaitx -mno-pconfig -mno-pku -mno-prefetchwt1 -mprfchw -mno-ptwrite -mrdpid -mrdrnd -mrdseed -mno-rtm -mno-serialize -mno-sgx -msha -mno-shstk -mno-tbm -mno-tsxldtrk -mno-vaes -mno-waitpkg -mwbnoinvd -mxsave -mxsavec -mxsaveopt -mxsaves -mno-amx-tile -mno-amx-int8 -mno-amx-bf16 -mno-uintr -mno-hreset -mno-kl -mno-widekl -mno-avxvnni --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -mtune=znver2 -dumpbase -
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-03 08:08:06 UTC
It's likely some bad code assumption that when you have certain intrinsics, some other thing is available. Lots of modern intrinsics work for 32-bit code.

Could you try narrow down which of the -m* settings cause the failure for you? That'll help quite a bit.

(You've already got the list, but FWIW: https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide#Expand_-march.3Dnative.2C_exact_gcc_version_and_other_system-specific_options)
Comment 3 Bernd 2022-06-03 08:28:34 UTC
Gonna test the -m* settings. The difference in the lists is

(chroot32) # arch=i686; for t in param target; do cmd="gcc -Q -O2 -march=$arch --help=$t"; diff -U0 <(LANG=C $cmd) <(LANG=C $cmd -march=native); done
--- /dev/fd/63  2022-06-03 10:24:17.035104582 +0200
+++ /dev/fd/62  2022-06-03 10:24:17.035104582 +0200
@@ -21 +21 @@
-  --param=avoid-fma-max-bits=<0,512>           0
+  --param=avoid-fma-max-bits=<0,512>           256
@@ -84,3 +84,3 @@
-  --param=l1-cache-line-size=          32
-  --param=l1-cache-size=               8
-  --param=l2-cache-size=               256
+  --param=l1-cache-line-size=          64
+  --param=l1-cache-size=               32
+  --param=l2-cache-size=               512
@@ -224 +224 @@
-  --param=simultaneous-prefetches=     6
+  --param=simultaneous-prefetches=     100
--- /dev/fd/63  2022-06-03 10:24:17.040104630 +0200
+++ /dev/fd/62  2022-06-03 10:24:17.040104630 +0200
@@ -12,2 +12,2 @@
-  -mabm                                [disabled]
-  -maccumulate-outgoing-args           [enabled]
+  -mabm                                [enabled]
+  -maccumulate-outgoing-args           [disabled]
@@ -15,2 +15,2 @@
-  -madx                                [disabled]
-  -maes                                [disabled]
+  -madx                                [enabled]
+  -maes                                [enabled]
@@ -27 +27 @@
-  -march=                              i686
+  -march=                              znver2
@@ -29,2 +29,2 @@
-  -mavx                                [disabled]
-  -mavx2                               [disabled]
+  -mavx                                [enabled]
+  -mavx2                               [enabled]
@@ -52,3 +52,3 @@
-  -mbmi                                [disabled]
-  -mbmi2                               [disabled]
-  -mbranch-cost=<0,5>                  2
+  -mbmi                                [enabled]
+  -mbmi2                               [enabled]
+  -mbranch-cost=<0,5>                  3
@@ -59,3 +59,3 @@
-  -mclflushopt                         [disabled]
-  -mclwb                               [disabled]
-  -mclzero                             [disabled]
+  -mclflushopt                         [enabled]
+  -mclwb                               [enabled]
+  -mclzero                             [enabled]
@@ -64,2 +64,2 @@
-  -mcrc32                              [disabled]
-  -mcx16                               [disabled]
+  -mcrc32                              [enabled]
+  -mcx16                               [enabled]
@@ -69 +69 @@
-  -mf16c                               [disabled]
+  -mf16c                               [enabled]
@@ -74 +74 @@
-  -mfma                                [disabled]
+  -mfma                                [enabled]
@@ -80 +80 @@
-  -mfsgsbase                           [disabled]
+  -mfsgsbase                           [enabled]
@@ -83 +83 @@
-  -mfxsr                               [disabled]
+  -mfxsr                               [enabled]
@@ -107 +107 @@
-  -mlzcnt                              [disabled]
+  -mlzcnt                              [enabled]
@@ -112,2 +112,2 @@
-  -mmmx                                [disabled]
-  -mmovbe                              [disabled]
+  -mmmx                                [enabled]
+  -mmovbe                              [enabled]
@@ -119,2 +119,2 @@
-  -mmwait                              [disabled]
-  -mmwaitx                             [disabled]
+  -mmwait                              [enabled]
+  -mmwaitx                             [enabled]
@@ -127 +127 @@
-  -mno-sse4                            [enabled]
+  -mno-sse4                            [disabled]
@@ -133 +133 @@
-  -mpclmul                             [disabled]
+  -mpclmul                             [enabled]
@@ -137 +137 @@
-  -mpopcnt                             [disabled]
+  -mpopcnt                             [enabled]
@@ -142 +142 @@
-  -mprfchw                             [disabled]
+  -mprfchw                             [enabled]
@@ -145,3 +145,3 @@
-  -mrdpid                              [disabled]
-  -mrdrnd                              [disabled]
-  -mrdseed                             [disabled]
+  -mrdpid                              [enabled]
+  -mrdrnd                              [enabled]
+  -mrdseed                             [enabled]
@@ -159 +159 @@
-  -msha                                [disabled]
+  -msha                                [enabled]
@@ -163,2 +163,2 @@
-  -msse                                [disabled]
-  -msse2                               [disabled]
+  -msse                                [enabled]
+  -msse2                               [enabled]
@@ -166,5 +166,5 @@
-  -msse3                               [disabled]
-  -msse4                               [disabled]
-  -msse4.1                             [disabled]
-  -msse4.2                             [disabled]
-  -msse4a                              [disabled]
+  -msse3                               [enabled]
+  -msse4                               [enabled]
+  -msse4.1                             [enabled]
+  -msse4.2                             [enabled]
+  -msse4a                              [enabled]
@@ -173 +173 @@
-  -mssse3                              [disabled]
+  -mssse3                              [enabled]
@@ -187 +187 @@
-  -mtune=                              i686
+  -mtune=                              znver2
@@ -196 +196 @@
-  -mwbnoinvd                           [disabled]
+  -mwbnoinvd                           [enabled]
@@ -200,4 +200,4 @@
-  -mxsave                              [disabled]
-  -mxsavec                             [disabled]
-  -mxsaveopt                           [disabled]
-  -mxsaves                             [disabled]
+  -mxsave                              [enabled]
+  -mxsavec                             [enabled]
+  -mxsaveopt                           [enabled]
+  -mxsaves                             [enabled]
Comment 4 Bernd 2022-06-03 10:46:17 UTC
Only the -mf16c option fails to build. All other -m* options from the gcc -march=native -E | grep cc1 output in comment #1 when combined individually with -march=i686 build without issues.
Comment 5 Joonas Niilola gentoo-dev 2022-06-03 10:55:00 UTC
In all fairness I should move back to using -march=i686 (this is x86 container) but -march=native has revealed some interesting bugs and it seems to be "authentic" enough to a real x86... I don't know.
Comment 6 Bernd 2022-09-26 06:42:58 UTC
This bug blocks stabilization of openexr-3.1.5 for x86. How shall we continue to handle this? The issue is tied to specific intrinsics used and the use of -march=native.

The gcc (11.3.1) info page lists the problematic F16C intrinsics only for recently enough processors (skylake and later for Intel, bdver2 and later for AMD).

Is this an issue with gcc using wrong assumptions while running in a containerized environment?

Is this an issue to be reported upstream? So far I don't think so
Comment 7 Joonas Niilola gentoo-dev 2022-09-26 14:59:44 UTC
I wonder if we can get away using flag-o-matic here... like replace-cpu-flags (or replace-flags)

if use x86; then;
  replace-cpu-flags -march=native -march=i686
fi

can't say I've ever seen that being done before, but doesn't sound too bad.
Comment 8 Bernd 2022-09-26 17:40:16 UTC
Wasn't aware flag-o-matic has these replace-* functions. Sounds like a way to go. I'll test it and see if it works.
Comment 9 Larry the Git Cow gentoo-dev 2022-09-28 08:19:52 UTC
The bug has been closed via the following commit(s):

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

commit eaa51858d9d2701d98839236338cad3acd3389c1
Author:     Bernd Waibel <waebbl-gentoo@posteo.net>
AuthorDate: 2022-09-27 17:23:45 +0000
Commit:     Joonas Niilola <juippis@gentoo.org>
CommitDate: 2022-09-28 08:19:26 +0000

    media-libs/openexr: fix build issue on x86
    
    The package can fail to build on x86_32 if -march=native is set. This
    sets the -mf16c intrinsic which isn't available on every x86_32 arch.
    The patch replaces -march=native with -march=i686 if x86 is used.
    
    Also disable a failing test for x86.
    
    Closes: https://bugs.gentoo.org/840580
    Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
    Closes: https://github.com/gentoo/gentoo/pull/27498
    Signed-off-by: Joonas Niilola <juippis@gentoo.org>

 ...openexr-3.1.5-drop-failing-testDwaLookups.patch | 29 ++++++++++++++++++++++
 media-libs/openexr/openexr-3.1.5.ebuild            | 10 +++++++-
 2 files changed, 38 insertions(+), 1 deletion(-)