Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 585846 - =media-libs/openexr-2.2.0[abi_x86_32]: emake failed: IlmImf/ImfSystemSpecific.cpp:51:29: error: inconsistent operand constraints in an ‘asm’
Summary: =media-libs/openexr-2.2.0[abi_x86_32]: emake failed: IlmImf/ImfSystemSpecific...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Media-video project
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: 536078
  Show dependency tree
 
Reported: 2016-06-13 16:27 UTC by Adrian
Modified: 2016-10-11 07:34 UTC (History)
2 users (show)

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


Attachments
openexr-2.2.0-fix-cpuid-on-abi_x86_32.patch (openexr-2.2.0-fix-cpuid-on-abi_x86_32.patch,1.91 KB, patch)
2016-06-13 16:27 UTC, Adrian
Details | Diff
openexr-2.2.0-abi_x86_32-build-fails.log (openexr-2.2.0-abi_x86_32_build-fails.log,102.83 KB, text/plain)
2016-06-13 16:30 UTC, Adrian
Details
Use-ULL-for-64-bit-literals.patch (Use-ULL-for-64-bit-literals.patch,1.93 KB, patch)
2016-08-29 09:54 UTC, Jonathan Scruggs (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian 2016-06-13 16:27:06 UTC
Created attachment 437388 [details, diff]
openexr-2.2.0-fix-cpuid-on-abi_x86_32.patch

I am unable to build openexr-2.2.0 with abi_x86_32, but it works with abi_x86_64

Under abi_x86_32 it fails to compile with
/var/tmp/portage/media-libs/openexr-2.2.0/work/openexr-2.2.0/IlmImf/ImfSystemSpecific.cpp:51:29: error: inconsistent operand constraints in an ‘asm‘

I believe this is related to the upstream bug https://github.com/openexr/openexr/issues/128 but had to add a define for #include <cpuid.h> to get it to work.

As the comments on that page note, this requires >=gcc 4.3 which may be why they have not integrated it upstream. I don't think this is an issue for us as gcc-4.9.3 is stable.
Comment 1 Adrian 2016-06-13 16:30:36 UTC
Created attachment 437390 [details]
openexr-2.2.0-abi_x86_32-build-fails.log

This is the build log when I use ABI_X86="32 64" in make.conf and don't have media-libs/openexr -abi_x86_32 in /etc/portage/package.use
Comment 2 Adrian 2016-06-13 16:33:47 UTC
Portage 2.2.28 (python 2.7.11-final-0, default/linux/amd64/13.0, gcc-4.9.3, glibc-2.22-r4, 4.6.2-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.6.2-gentoo-x86_64-Intel-R-_Core-TM-_i7-4800MQ_CPU_@_2.70GHz-with-gentoo-2.2
KiB Mem:    16350504 total,   7273016 free
KiB Swap:   18828176 total,  18828176 free
Timestamp of repository gentoo: Mon, 13 Jun 2016 12:30: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 [disabled]
app-shells/bash:          4.3_p42-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.4::gentoo, 3.5.1-r3::gentoo
dev-util/cmake:           3.3.1-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.19.1::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers)
sys-libs/glibc:           2.22-r4::x-portage
Repositories:

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

sublime-text
    location: /var/lib/layman/sublime-text
    masters: gentoo
    priority: 0

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 1

Installed sets: @steam
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=corei7-avx -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/grs/systems.conf /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/easy-rsa /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 /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=corei7-avx -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch 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://ftp.swin.edu.au/gentoo ftp://ftp.swin.edu.au/gentoo"
LANG="en_AU.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j17"
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="/var/tmp"
USE="X a52 aac acl acpi alsa amd64 berkdb bluetooth bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus declarative dri dts dvd exif expat ffmpeg fftw flac fontconfig fortran gcj gdbm gif git gpm gstreamer gtk iconv icu ieee1394 introspection ipv6 jack java jpeg jpeg2k kipi kontact latex lcms ldap libnotify mmx mmxext mng modules mp3 mpeg multilib mysql ncurses networkmanager nls nptl ogg openal openexr opengl openmp pam pango pch pcre pdf phenon plasma png policykit python qml qt3support qt5 raw readline screensaver sdl seccomp semantic-desktop session sndfile spell sqlite sse sse2 ssl startup-notification svg tcpd theora threads tiff truetype udev udisks unicode usb v4l vdpau vorbis webkit widgets wxwidgets x264 xattr xcb xcomposite xine xinerama xml xscreensaver xv xvid zlib" ABI_X86="64 32" 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="krita" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 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" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="synaptics evdev wacom" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4 python3_5" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="nvidia intel" 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_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

=================================================================
                        Package Settings
=================================================================

media-libs/openexr-2.2.0::gentoo was built with the following:
USE="-examples -static-libs" ABI_X86="32 64 -x32"
Comment 3 Adrian 2016-06-13 16:35:04 UTC
emerge -pqv says

[ebuild   R   ] media-libs/openexr-2.2.0  USE="-examples -static-libs" ABI_X86="32 (64) (-x32)"
Comment 4 Jonathan Scruggs (RETIRED) gentoo-dev 2016-08-29 09:54:35 UTC
Created attachment 444376 [details, diff]
Use-ULL-for-64-bit-literals.patch

Since this bug report is about 32 bit compiling, I think this patch may be needed as well. It's a squashed version of the two patches added to upstream post 2.2.0 release. It changed Long to Unsigned Long Long for 32 bit compatibility.
Comment 5 Adrian 2016-08-29 11:48:40 UTC
As long as I use the cpuid patch, I do not receive any error regarding ImfFastHuf.cpp with or without the ULL patch.

I do not think that the ULL patch actually changes the code. Compiling the ImfFastHuf.cpp with and without the patch produces identical object files.

Without the patch I think that GCC implicitly converts the literal to a ULL when storing it as an Int64.

To test this I created a simple program:
int main(void)
{
  unsigned long long base[3];

  base[0] = 0xffffffffffffffffL;
  base[1] = 0xffffffffffffffffLL;
  base[2] = 0xffffffffffffffffULL;
}


which has the disassembly
        .file   "main.cpp"
        .text
        .globl  main
        .type   main, @function
main:
.LFB0:
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        subq    $32, %rsp
        movq    %fs:40, %rax
        movq    %rax, -8(%rbp)
        xorl    %eax, %eax
        movq    $-1, -32(%rbp)
        movq    $-1, -24(%rbp)
        movq    $-1, -16(%rbp)
        movl    $0, %eax
        movq    -8(%rbp), %rdx
        xorq    %fs:40, %rdx
        je      .L3
        call    __stack_chk_fail
.L3:
        leave
        .cfi_def_cfa 7, 8
        ret
        .cfi_endproc
.LFE0:
        .size   main, .-main
        .ident  "GCC: (Gentoo 4.9.3 p1.5, pie-0.6.4) 4.9.3"
        .section        .note.GNU-stack,"",@progbits

Note that the code sets the quad words at rbp-16, rbp-24 and rbp-32 to $-1 (i.e. three 64 bit integers being set to the same value 0xffffffffffffffff).
Comment 6 Adrian 2016-08-29 11:57:36 UTC
Sorry, I got the wrong disassembly file. The 32 bit assembly file for my test program is

       .file   "main.cpp"
        .text
        .globl  main
        .type   main, @function
main:
.LFB0:
        .cfi_startproc
        leal    4(%esp), %ecx
        .cfi_def_cfa 1, 0
        andl    $-16, %esp
        pushl   -4(%ecx)
        pushl   %ebp
        .cfi_escape 0x10,0x5,0x2,0x75,0
        movl    %esp, %ebp
        pushl   %ecx
        .cfi_escape 0xf,0x3,0x75,0x7c,0x6
        subl    $36, %esp
        movl    %gs:20, %eax
        movl    %eax, -12(%ebp)
        xorl    %eax, %eax
        movl    $-1, -40(%ebp)
        movl    $-1, -36(%ebp)
        movl    $-1, -32(%ebp)
        movl    $-1, -28(%ebp)
        movl    $-1, -24(%ebp)
        movl    $-1, -20(%ebp)
        movl    $0, %eax
        movl    -12(%ebp), %edx
        xorl    %gs:20, %edx
        je      .L3
        call    __stack_chk_fail
.L3:
        addl    $36, %esp
        popl    %ecx
        .cfi_restore 1
        .cfi_def_cfa 1, 0
        popl    %ebp
        .cfi_restore 5
        leal    -4(%ecx), %esp
        .cfi_def_cfa 4, 4
        ret
        .cfi_endproc
.LFE0:
        .size   main, .-main
        .ident  "GCC: (Gentoo 4.9.3 p1.5, pie-0.6.4) 4.9.3"
        .section        .note.GNU-stack,"",@progbits

The result is the same, that all three 64 bit integers are set to 0xffffffffffffffff regardless of using L, LL or ULL for the literal, and whether compiling with -m32 or -m64 ABI.
Comment 7 Jonathan Scruggs (RETIRED) gentoo-dev 2016-08-29 12:27:01 UTC
This is the discussion on the reason for the patch:
https://github.com/openexr/openexr/pull/126

I think it's for a pure 32 bit environment if I read it right.
Comment 8 Adrian 2016-08-29 13:34:01 UTC
The ULL patch builds fine in 64 bit mode (gcc -m64 ...) and 32 bit code on a 64 bit machine mode (gcc -m32 ...)

All of my machines have 64 bit processors, so I don't have a pure 32 bit environment to test it.
Comment 9 Jonathan Scruggs (RETIRED) gentoo-dev 2016-08-29 14:22:12 UTC
(In reply to Adrian from comment #8)
> All of my machines have 64 bit processors, so I don't have a pure 32 bit
> environment to test it.

Mine too. I have an old Pentium 4 that's 64 bit. I might be able to get a 32 bit install on that -- maybe...

Only other thing I can think of doing is setting up a 32 bit KVM image and try that.

Though, since no one seems to report that problem, except for the guy in the PR, I don't think many Gentoo users use 32 bit anymore. :P

On the other hand, since it's in upstream, it will be in the next release (whenever that is).
Comment 10 Adrian 2016-08-30 05:52:10 UTC
I have set up the Gentoo LiveDVD to boot as x86 on my machine. I am pretty sure it is a pure 32 bit environment as gcc -m64 complains that the CPU does not support the x86-64 instruction set.

I am able to compile my test program with i686-pc-linux-gnu-g++ -m32, the disassembly has slightly different stack frame setup, but shows that it is also setting all three unsigned long long to the same value.

In order to compile openexr-2.2.0 on the livedvd I needed to:
- unmask openexr and ilmbase
- emerge ilmbase-2.2.0
- (could not emerge openexr-2.2.0 immediately as compilation failed)
- unmerge openexr-2.1.0
- emerge openexr-2.2.0
- then emerge @preserved-rebuild to fix the other installed packages still using ilmbase-2.1.0

I then added both patches for openexr and it also compiled successfully.

This all compiled successfully without either patch. Of note I am using the same computer which required the cpuid patch on my 64 bit multilib gentoo, but compiles successfully without it using the 32 bit gentoo livedvd.

The reason openexr upgrading fails is because it includes /usr/include/OpenEXR when compiling every c++ file. This finds the ilmbase headers it depends on, but also finds the old version of openexr headers which are installed in the same directory.

I am not sure the best way to fix the upgrading process.
* Is there is a way to force unintallation of openexr prior to upgrading from the ebuild?
* We could include the openexr-2.2.0 headers as a separate include directory in the package and include this directory before the ilmbase headers in /usr/include/OpenEXR. 
* We could include the ilmbase-2.2.0 headers as a separate include directory and use it instead of /usr/include/OpenEXR. This would require forcing the user to use openexr-2.2.0 with ilmbase-2.2.0 (currently it depends on >=ilmbase-2.2.0)
* We could install the ilmbase headers to a different directory. This would probably not be workable as then all ilmbase client code (both within gentoo and any 3rd party applications) would need to be updated with the new path.
* Perhaps there is another option?

So to summarise:
* The cpuid patch is required to prevent compilation failure of openexr with abi_x86_32 on a 64 bit multilib gentoo system using gcc>4.3.
* The ULL patch compiles successfully under x86 32 bit, amd64 32 and 64 bit environments. As the patch is included upstream for the next version of openexr and I see no harm in including it.
* Upgrading openexr to 2.2.0 is a complicated process.
Comment 11 David Seifert gentoo-dev 2016-10-11 07:34:13 UTC
commit 9d9485b2bcb02cfd80680e6949a9f7e303687311
Author: Jonathan Scruggs <j.scruggs@gmail.com>
Date:   Sun Oct 9 19:02:45 2016 +0100

    media-libs/openexr: revision bump to fix various build errors
    
    Gentoo-bug: 520648, 585846
    * EAPI=6
    * Port to 'multilib-minimal'
    * Fix build system to not require blocker
    * Remove .la files
    
    Signed off by: Jonathan Scruggs (j.scruggs@gmail.com, irc: Dracwyrm)
    Closes: https://github.com/gentoo/gentoo/pull/2520