Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 550386 - multilib-build.eclass errors on ABI_X86="32 x32 64", ok on "x32 64"
Summary: multilib-build.eclass errors on ABI_X86="32 x32 64", ok on "x32 64"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Multilib team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-25 22:45 UTC by Tiago Marques
Modified: 2015-06-26 20:43 UTC (History)
0 users

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 Tiago Marques 2015-05-25 22:45:30 UTC
I have selected the x32 profile for my system and can build several packages with ABI_X86="x32 64" but not ABI_X86="32 x32 64". Packages are failing with the following error:

-------------------------------------------

libtool: install: (cd /var/tmp/portage/dev-libs/gmp-5.1.3-r1/image//usr/lib && { ln -s -f libgmpxx.so.4.3.3 libgmpxx.so || { rm -f libgmpxx.so && ln -s libgmpxx.so.4.3.3 libgmpxx.so; }; })
libtool: install: /usr/bin/install -c .libs/libgmpxx.lai /var/tmp/portage/dev-libs/gmp-5.1.3-r1/image//usr/lib/libgmpxx.la
libtool: install: warning: remember to run `libtool --finish /usr/lib'
make[3]: Leaving directory '/var/tmp/portage/dev-libs/gmp-5.1.3-r1/work/gmp-5.1.3-abi_x86_32.x86'
make[2]: Leaving directory '/var/tmp/portage/dev-libs/gmp-5.1.3-r1/work/gmp-5.1.3-abi_x86_32.x86'
make[1]: Leaving directory '/var/tmp/portage/dev-libs/gmp-5.1.3-r1/work/gmp-5.1.3-abi_x86_32.x86'
/usr/include/gmp.h
/* Debug output */
MULTILIB_ABI_FLAG: abi_x86_32
CHOST/dir: i686-pc-linux-gnu/
/* End of Debug output */
 ERROR: dev-libs/gmp-5.1.3-r1::gentoo failed (install phase):
 Flag abi_x86_32 not listed in wrapper template (/var/tmp/portage/dev-libs/gmp-5.1.3-r1/image//tmp/multilib-include/gmp.h). Please report a bug to https://bugs.gentoo.org.

 Call stack:
      ebuild.sh, line   93:  Called src_install
    environment, line 3209:  Called multilib-minimal_src_install
    environment, line 2382:  Called multilib_foreach_abi 'multilib-minimal_abi_src_install'
    environment, line 2569:  Called multibuild_foreach_variant '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_install'
    environment, line 2270:  Called _multibuild_run '_multilib_multibuild_wrapper' 'multilib-minimal_abi_src_install'
    environment, line 2268:  Called _multilib_multibuild_wrapper 'multilib-minimal_abi_src_install'
    environment, line  508:  Called multilib-minimal_abi_src_install
    environment, line 2378:  Called multilib_prepare_wrappers
    environment, line 2770:  Called die
  The specific snippet of code:
                            die "Flag ${MULTILIB_ABI_FLAG} not listed in wrapper template (${wrapper}). Please report a bug to https://bugs.gentoo.org.";

--------------------------------------------------------

As above, I have modified the multilib-build.eclass to output the variables in the section that fails. It is returning the following values for abi_x86_64:


MULTILIB_ABI_FLASG => abi_x86_64
CHOST => x86_64-pc-linux-gnu (think it should be x86_64-pc-linux-gnux32 with -m64 flag)

MULTILIB_ABI_FLAG => abi_x86_32
CHOST => i686-pc-linux-gnu (also maybe x86_64-pc-linux-gnux32 with -m32 flag)

It fails trying to install the x86_32 binaries and exits. I also dumped the wrappers (see below). What seems to be happening is that this code is checking for the wrong strings:

---------------
if ! grep -q "${MULTILIB_ABI_FLAG} " "${wrapper}"
then
   die "Flag ${MULTILIB_ABI_FLAG} not listed in wrapper template (${wrapper}). Please report a bug to https://bugs.gentoo.org."
fi
---------------

This doesn't trigger die() on x86_64 because said file has the following lines:

#if defined(__x86_64__) /* amd64 */
#       if defined(__ILP32__) /* x32 ABI */
#               error "abi_x86_x32 not supported by the package."
#       else /* 64-bit ABI */
#               error "abi_x86_64 not supported by the package."
#       endif
#elif defined(__i386__) /* plain x86 */
#       error "abi_x86_32 not supported by the package."

All x86 ABIs are unsupported, but portage continues; whereas the wrapper for x86_32 is:

#if defined(__x86_64__) /* amd64 */
#       if defined(__ILP32__) /* x32 ABI */
#               error "abi_x86_x32 not supported by the package."
#       else /* 64-bit ABI */
#               include <x86_64-pc-linux-gnu/gmp.h>
#       endif
#elif defined(__i386__) /* plain x86 */
#       include <x86_64-pc-linux-gnu/gmp.h>

Since the include line is properly defined for the abi_x86_32 wrapper, it fails here.

We can also see that it is also trying to use 'x86_64-pc-linux-gnu/gmp.h' for x86_32 packages, which will probably be a source of harm. In GMPs case it would be using a gmp.h file without the following #define:

#define _LONG_LONG_LIMB 1 /* which is the same for x86_x32 */

And with

#define __GMP_CC "x86_64-pc-linux-gnux32-gcc -m64 -std=gnu99" /* which should be -m32 */

I also find it strange that it is trying to use the x86_64-pc-linux-gnu for anything in this system (or any x32 stage3 tar), as it could probably be better to just have:

/usr/include/x32
/usr/include/32
/usr/include/64

I tried to compile other packages that have files in /usr/include/x86_64-pc-linux-gun/ and they fail the same way for ABI_X86="32 x32 64".

A fix or pointers on what to do to fix this would be greatly appreciated.

I stumbled upon this when trying to build the system to run on x32 but have 32bit libraries for binaries that don't compile from source yet on x32. I installed a bunch of libraries ok but before I stumbled on these:

1432509379:  ::: completed emerge (1 of 1) x11-libs/libXi-1.7.4 to /
1432509441:  ::: completed emerge (1 of 1) x11-libs/libXcursor-1.1.14 to /
1432511295:  ::: completed emerge (1 of 2) x11-proto/scrnsaverproto-1.2.2-r1 to /
1432511317:  ::: completed emerge (2 of 2) x11-libs/libXScrnSaver-1.2.2-r1 to /
1432511913:  ::: completed emerge (1 of 1) dev-libs/atk-2.14.0 to /
1432511965:  ::: completed emerge (1 of 2) x11-proto/compositeproto-0.4.2-r1 to /
1432511986:  ::: completed emerge (2 of 2) x11-libs/libXcomposite-0.4.4-r1 to /
1432514063:  ::: completed emerge (1 of 1) media-libs/alsa-lib-1.0.28 to /
1432514534:  ::: completed emerge (1 of 2) x11-proto/recordproto-1.14.2-r1 to /
1432514553:  ::: completed emerge (2 of 2) x11-libs/libXtst-1.2.2 to /
1432514604:  ::: completed emerge (1 of 2) x11-proto/randrproto-1.4.0-r1 to /
1432514624:  ::: completed emerge (2 of 2) x11-libs/libXrandr-1.4.2 to /

Reproducible: Always

Steps to Reproduce:
1. eselect profile to x32 abi
2. ABI_X86_32="32 x32 64" emerge gmp
3.
Actual Results:  
Package compiles but fails to install when it wants to isntall abi_x86_32 files.

Expected Results:  
Should install files to the correct directories.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-05-26 10:40:02 UTC
This is because of:

  # Hack for emul-linux-x86 compatibility.
  # It assumes amd64 will come after x86, and will use amd64
  # headers if no specific x86 headers were installed.
  if [[ ${ABI} == amd64 ]]; then
      sed -e "/abi_x86_32 /s&error.*&include <${CHOST}${f}>&" \
          -i "${wrapper}" || die
  fi

I guess the x32 profile you're using doesn't respect the usual x86-then-amd64 order. On the other hand, we can probably remove the hack anyway these days since emul-linux-x86 are no longer supported.
Comment 2 Gary 2015-06-26 17:53:44 UTC
This happens for me on the following packages

media-libs/libogg
dev-libs/gmp
sys-libs/db
media-libs/libjpeg-turbo
dev-libs/openssl
dev-libs/libgpg-error
sys-devel/llvm
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2015-06-26 20:43:36 UTC
+  26 Jun 2015; Michał Górny <mgorny@gentoo.org> multilib-build.eclass:
+  Remove emul-linux-x86 hack, since emul-linux-x86 is no more.

This should fix it. Please try now ;).