Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 617312 - [science overlay] sci-libs/openblas-0.2.19 fails to install on multilib system
Summary: [science overlay] sci-libs/openblas-0.2.19 fails to install on multilib system
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo Science Related Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-03 08:22 UTC by Michelangelo Scopelliti
Modified: 2017-08-25 07:00 UTC (History)
1 user (show)

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


Attachments
openblas build log (openblas-0.2.19:20170503-081345.log.gz,323.30 KB, application/gzip)
2017-05-03 08:22 UTC, Michelangelo Scopelliti
Details
Modified patch from tree (openblas-0.2.19-openblas_config_header_same_between_ABIs.patch,1.13 KB, patch)
2017-08-03 10:15 UTC, Igor Poboiko
Details | Diff
Modified ebuild (openblas-0.2.19.ebuild,6.45 KB, text/plain)
2017-08-03 10:17 UTC, Igor Poboiko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michelangelo Scopelliti 2017-05-03 08:22:15 UTC
Created attachment 471556 [details]
openblas build log

sci-libs/openblas-0.2.19 compiles on my systems but fails to install due to a "Header files have changed between ABIs" error.

build log is attached.

emerge -vp openblas

[ebuild     U  ] sci-libs/openblas-0.2.19::science [0.2.15::science] USE="int64 openmp -dynamic -static-libs -threads" ABI_X86="32 (64) (-x32)" 0 KiB

emerge --info

Portage 2.3.5 (python 2.7.13-final-0, default/linux/amd64/13.0, gcc-5.4.0, glibc-2.24-r1, 4.10.13 x86_64)
=================================================================
System uname: Linux-4.10.13-x86_64-AMD_A10-7700K_Radeon_R7,_10_Compute_Cores_4C+6G-with-gentoo-2.3
KiB Mem:     7141988 total,   3356992 free
KiB Swap:   10485744 total,  10485744 free
Timestamp of repository gentoo: Wed, 03 May 2017 05:15:01 +0000
sh bash 4.4_p12
ld GNU ld (Gentoo 2.27 p1.0) 2.27
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1-r1::gentoo
dev-lang/python:          2.7.13::gentoo, 3.5.3::gentoo, 3.6.1-r1::gentoo
dev-util/cmake:           3.8.0-r1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.25::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r3::gentoo
sys-devel/automake:       1.12.6-r1::gentoo, 1.13.4-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            5.4.0-r3::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.24-r1::gentoo
Repositories:

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

kernelpanic
    location: /usr/local/portage/kernelpanic
    masters: gentoo

libressl
    location: /var/lib/layman/libressl
    sync-type: laymansync
    sync-uri: https://github.com/gentoo/libressl.git
    masters: gentoo
    priority: 50

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

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA @EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /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=native -mtune=native -O2 -pipe"
DISTDIR="/var/portage/distfiles"
FCFLAGS="-march=native -mtune=native -O2 -pipe"
FEATURES="assume-digests binpkg-logs clean-logs compress-build-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms split-elog split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -mtune=native -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="/etc/systemd /usr/lib/systemd /usr/lib64/systemd"
LANG="it_IT.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
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 alsa amd64 ao berkdb blas branding bzip2 cairo caps cdda cli cracklib crypt cups curl cxx dbus djvu dri dts dv dvb dvd encode exif ffmpeg fftw flac fontconfig fortran gcj gdbm gif gimp gmp gpm gsm gstreamer iconv icu inotify ipv6 jbig jpeg jpeg2k lame lapack latex lcms libass libnotify libressl lzma lzo mad matroska mmap mms mng modplug modules mp3 mpeg mpi multilib ncurses nls nptl offensive ogg openexr opengl openmp pam pcre pdf png postscript raw readline scanner seccomp session smp sndfile sound sox speex ssl startup-notification svg theora threads tiff truetype udev unicode usb v4l vaapi vdpau vim-syntax vorbis wavpack wmf wxwidgets x264 xattr xcb xml xmp xpm xscreensaver xv xvid zlib" ABI_X86="32 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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx f16c fma3 fma4 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 xop" CURL_SSL="libressl" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock 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="it en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="it en" LLVM_TARGETS="AMDGPU" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5 python3_6" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby24" SANE_BACKENDS="hp" USERLAND="GNU" VIDEO_CARDS="amdgpu radeon radeonsi" 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, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 François Bissey 2017-05-15 21:10:44 UTC
Header installation that's a hard problem...
make[1]: Leaving directory '/var/tmp/portage/sci-libs/openblas-0.2.19/work/openblas-0.2.19-amd64_int32'
 [31;01m*[0m Header files have changed between ABIs.
 [31;01m*[0m --- /var/tmp/portage/sci-libs/openblas-0.2.19/temp/.multilib_header_cksum	2017-05-03 10:19:18.388717566 +0200
 [31;01m*[0m +++ /var/tmp/portage/sci-libs/openblas-0.2.19/temp/.multilib_header_cksum.new	2017-05-03 10:19:19.292731596 +0200
 [31;01m*[0m @@ -1,3 +1,3 @@
 [31;01m*[0m  3434018749 45648 /var/tmp/portage/sci-libs/openblas-0.2.19/image/usr/include/openblas/cblas.h
 [31;01m*[0m -2404636999 4644 /var/tmp/portage/sci-libs/openblas-0.2.19/image/usr/include/openblas/openblas_config.h
 [31;01m*[0m +3014178069 4642 /var/tmp/portage/sci-libs/openblas-0.2.19/image/usr/include/openblas/openblas_config.h
 [31;01m*[0m  974311865 47356 /var/tmp/portage/sci-libs/openblas-0.2.19/image/usr/include/openblas/f77blas.h
 [31;01m*[0m ERROR: sci-libs/openblas-0.2.19::science failed (install phase):
 [31;01m*[0m   Header checksum mismatch, aborting.
 [31;01m*[0m
Comment 2 Igor Poboiko 2017-08-03 10:15:57 UTC
Created attachment 487780 [details, diff]
Modified patch from tree

It's exactly the same problem that previously was fixed by "openblas-0.2.11-openblas_config_header_same_between_ABIs.patch" from the tree.

The patch just should be slightly modified, so it applies to 0.2.19 version.
Comment 3 Igor Poboiko 2017-08-03 10:17:35 UTC
Created attachment 487782 [details]
Modified ebuild

The ebuild that applies patch I attached above. 
Just a copy-paste from 0.2.15 ebuild.

Tested, it works for me.
Comment 4 Benda Xu gentoo-dev 2017-08-03 12:26:00 UTC
Ah-ha. I have been wondering what the patch does when I was bumping the ebuild.  At that time, no explanation has been attached to the patch.

Now it perfectly makes sense.  Thank you!
Comment 5 François Bissey 2017-08-03 12:47:59 UTC
And I thought that whatever it was it had been fixed upstream. 

That being said this is a very nasty hack. I have PR with openblas 0.20 approved by jlec but still waiting to be merged. I'll see if I can add it there too.
Comment 6 François Bissey 2017-08-03 21:54:39 UTC
@ Benda considering https://github.com/gentoo/sci/pull/800 is replacing openblas 0.2.19 with 0.2.20, should we add the patch as part of the PR (or after it is merged)? Otherwise the PR will have to be rebased.
Comment 7 Benda Xu gentoo-dev 2017-08-04 01:03:57 UTC
Hi François,

(In reply to François Bissey from comment #6)
> @ Benda considering https://github.com/gentoo/sci/pull/800 is replacing
> openblas 0.2.19 with 0.2.20, should we add the patch as part of the PR (or
> after it is merged)? Otherwise the PR will have to be rebased.

Thank you.  I think opening another PR makes more sense.
Comment 8 François Bissey 2017-08-04 02:06:05 UTC
I have spent some time with the patch studying the behavior of things.

I'd rather openblas not be multi build than use the current set up.

The patch doesn't have to be applied just after compilation before regeneration of the headers but I can see why you would want to. That's because you get broken headers.
They will match between ABI but they are broken.

We need to do a minimum fixing to that brokenness before shipping.

This is what happens to the bit that is patched in the final `openblas_config.h`
#define OPENBLAS_SLOCAL_BUFFER_SIZE (SGEMM_DEFAULT_Q
#define OPENBLAS_DLOCAL_BUFFER_SIZE (DGEMM_DEFAULT_Q
#define OPENBLAS_CLOCAL_BUFFER_SIZE (CGEMM_DEFAULT_Q
#define OPENBLAS_ZLOCAL_BUFFER_SIZE (ZGEMM_DEFAULT_Q

Before transformation for the final header, here is what it looks like in `config_last.h`
#define SLOCAL_BUFFER_SIZE	(SGEMM_DEFAULT_Q * SGEMM_DEFAULT_UNROLL_N * 4 * 1 *  sizeof(float))
#define DLOCAL_BUFFER_SIZE	(DGEMM_DEFAULT_Q * DGEMM_DEFAULT_UNROLL_N * 2 * 1 *  sizeof(double))
#define CLOCAL_BUFFER_SIZE	(CGEMM_DEFAULT_Q * CGEMM_DEFAULT_UNROLL_N * 4 * 2 *  sizeof(float))
#define ZLOCAL_BUFFER_SIZE	(ZGEMM_DEFAULT_Q * ZGEMM_DEFAULT_UNROLL_N * 2 * 2 *  sizeof(double))

`openblas_config.h` is generated from `config_last.h` (and a few other things) with an awk statement. Before the patch, instead of expression we have a single value which will survive intact. The patch tries to restore the expression so they match between ABI, unfortunately you end up with truncated expression. It is amazing we didn't get into any trouble with any consumer of openblas.

The other things is that in openblas_config.h, if you don't regenerate `config_last.h` with the section 

		rm -f config.h config_last.h || die
		# Note: prints this spurious warning: make: Nothing to be done for 'config.h'.
		emake config.h
		cp config.h config_last.h || die

The headers will show different target CPU names and slightly different instructions being enabled. I am guessing some are not enabled on x86, but the results from amd64 are the ones that ends up being installed. Again I am wondering if it is wise.

I feel it would be better to drop the patch, install all the openblas_config.h with ABI identifiers and install a wrapper.
Comment 9 Benda Xu gentoo-dev 2017-08-04 02:19:06 UTC
Hi François,

Thanks for the diagnosis.  The bottom line here is to be consistent.  If we decide not to support multilib in openblas, we should drop it entirely.

The present problem is that we pretend to support multilib (by inheriting it) and fails to build 32bit on 64bit ones.
Comment 10 François Bissey 2017-08-04 02:22:40 UTC
I am investigating some more. The header in question should be wrapped by MULTILIB_WRAPPED_HEADERS but for some reason isn't. Wrapping isn't encouraged but I don't feel like it is a choice in the instance.

I am wondering if we have multilib-build.eclass breakage.
Comment 11 François Bissey 2017-08-04 02:54:31 UTC
I think we have a bug in numeric-int64-multibuild.eclass. If I am not mistaken MULTILIB_WRAPPED_HEADERS is not used because MULTILIB_ABI_FLAG is not set by the wrapper from numeric-int64-multibuild.eclass.

I need more time to investigate fully but that's the only reason multilib_prepare_wrappers would skip the wrapping.
Comment 12 François Bissey 2017-08-04 03:44:17 UTC
Yes I am fairly sure 
numeric-int64-multibuild_multilib_wrapper() {
	debug-print-function ${FUNCNAME} "${@}"
	local v="${MULTIBUILD_VARIANT/_${NUMERIC_INT32_SUFFIX}/}"
	local v="${v/_${NUMERIC_INT64_SUFFIX}/}"
	local ABI="${v/_${NUMERIC_STATIC_SUFFIX}/}"
	multilib_toolchain_setup "${ABI}"
	"${@}" || die
}

Needs to define MULTILIB_ABI_FLAG like 
# @FUNCTION: _multilib_multibuild_wrapper
# @USAGE: <argv>...
# @INTERNAL
# @DESCRIPTION:
# Initialize the environment for ABI selected for multibuild.
_multilib_multibuild_wrapper() {
	debug-print-function ${FUNCNAME} "${@}"

	local ABI=${MULTIBUILD_VARIANT#*.}
	local -r MULTILIB_ABI_FLAG=${MULTIBUILD_VARIANT%.*}

	multilib_toolchain_setup "${ABI}"
	readonly ABI
	"${@}"
}

from multilib-build.eclass. 

This is getting complicated because numeric-int64-multibuild.ebuild defines variants not just in ABI but in integer size. So we have three potential headers ABI32_int32, ABI64_int32 and ABI64_int64. ABI64_* have to be identical and ABI64_* and ABI32_int32 have to wrapped.

Anyway adding 
	local -r MULTILIB_ABI_FLAG="${v%.*}"
before 
	multilib_toolchain_setup "${ABI}"
makes the multilib wrapping work so it is definitely the problem.
Comment 13 François Bissey 2017-08-04 10:33:48 UTC
This is now https://github.com/gentoo/sci/pull/802 for fixing the eclass. I pushed more clean up to https://github.com/gentoo/sci/pull/800 for the upgrade to 0.2.20. Once the eclass is fixed 0.2.20 will merge properly out of the box.
Comment 14 Benda Xu gentoo-dev 2017-08-25 04:39:10 UTC
I have a question here.  When I test out the new implementation, none of the cases fill correctly in the wrapper: /usr/include/openblas/openblas_config.h

The abi's defined in numeric-int64-multibuild.eclass are x86_int32, amd64_int32 and amd64 int64. Which is different from what is expected in multilib-build.

#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."
#elif defined(__mips__)
#   if(_MIPS_SIM == _ABIN32) /* n32 */
#       error "abi_mips_n32 not supported by the package."
#   elif(_MIPS_SIM == _ABI64) /* n64 */
#       error "abi_mips_n64 not supported by the package."
#   elif(_MIPS_SIM == _ABIO32) /* o32 */
#       error "abi_mips_o32 not supported by the package."
#   endif
#elif defined(__sparc__)
#       if defined(__arch64__)
#       error "abi_sparc_64 not supported by the package."
#       else
#       error "abi_sparc_32 not supported by the package."
#       endif
#elif defined(__s390__)
#       if defined(__s390x__)
#       error "abi_s390_64 not supported by the package."
#       else
#       error "abi_s390_32 not supported by the package."
#       endif
#elif defined(__powerpc__)
#       if defined(__powerpc64__)
#       error "abi_ppc_64 not supported by the package."
#       else
#       error "abi_ppc_32 not supported by the package."
#       endif
#elif defined(SWIG) /* https://sourceforge.net/p/swig/bugs/799/ */
#       include <x86_64-pc-linux-gnu/openblas/openblas_config.h>
#else
#       error "No ABI matched, please report a bug to bugs.gentoo.org"
#endif
Comment 15 François Bissey 2017-08-25 05:48:57 UTC
Hum... It worked at least once. But you are right there is something off. Now to figure what else I did that I have forgotten.
Comment 16 Benda Xu gentoo-dev 2017-08-25 07:00:05 UTC
Fixed in tree. Thanks Michelangelo, Igor and François.