Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 642316

Summary: toolchain.eclass: Please add slot operator on dev-libs/mpfr atom
Product: Gentoo Linux Reporter: Thomas Deutschmann <whissi>
Component: EclassesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED FIXED    
Severity: critical CC: carlphilippreh, Dessa, frp.bissey, josef64, strogdon
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Thomas Deutschmann gentoo-dev Security 2017-12-26 13:51:52 UTC
!!! existing preserved libs:
>>> package: dev-libs/mpfr-4.0.0
 *  - /usr/lib64/libmpfr.so.4
 *  - /usr/lib64/libmpfr.so.4.1.6
 *      used by /usr/lib64/libmpc.so.3.0.0 (dev-libs/mpc-1.0.3)
 *      used by /usr/libexec/gcc/x86_64-pc-linux-gnu/6.4.0/cc1 (sys-devel/gcc-6.4.0)
 *      used by /usr/libexec/gcc/x86_64-pc-linux-gnu/6.4.0/cc1plus (sys-devel/gcc-6.4.0)
 *      used by 6 other files


...a slot operator on dev-libs/mpfr would allow the package manager to automatically schedule rebuilds for all depending packages.
Comment 1 Matthias Maier gentoo-dev 2017-12-26 16:49:25 UTC
We need a new slot for dev-libs/mpfr-4.0.0.
Otherwise we cannot ensure that users have a clean upgrade path that doesn't break gcc during the upgrade process.

Masking new 4.0.0 package for now to avoid larger fallout.



commit e174da06065cffc1b3cb099298a69338c1a7d7d2 (HEAD -> master, origin/master, origin/HEAD, blubb2)
Author: Matthias Maier <tamiko@gentoo.org>
Date:   Tue Dec 26 10:44:50 2017 -0600

    profiles: Mask dev-libs/mpfr due to soname bump
Comment 2 Ivan 2017-12-26 17:24:08 UTC
Well, it just broke gcc for me.

Just for reference:

ivan@pc ~ $ emerge --info
Portage 2.3.19 (python 3.4.6-final-0, default/linux/amd64/17.1/desktop/plasma, gcc-7.2.0, glibc-2.26-r3, 4.14.9-gentoo x86_64)
=================================================================
System uname: Linux-4.14.9-gentoo-x86_64-Intel-R-_Core-TM-_i5-2500K_CPU_@_3.30GHz-with-gentoo-2.4.1
KiB Mem:    16349496 total,  12314172 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 26 Dec 2017 14:00:01 +0000
Head commit of repository gentoo: 2d8e7e2f7ac4079da53a2f69291c362261c2f964
sh bash 4.4_p12
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
app-shells/bash:          4.4_p12::gentoo
dev-lang/perl:            5.26.1-r1::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.4.6-r1::gentoo
dev-util/cmake:           3.10.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.34.11::gentoo
sys-apps/sandbox:         2.12::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo
sys-devel/gcc:            6.4.0::gentoo, 7.2.0::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r3::gentoo
Repositories:

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

my
    location: /usr/local/my
    masters: gentoo
    priority: 0

c2p-overlay
    location: /var/lib/layman/c2p-overlay
    masters: gentoo
    priority: 50

deadbeef-overlay
    location: /var/lib/layman/deadbeef-overlay
    masters: gentoo
    priority: 50

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

steam-overlay
    location: /var/lib/layman/steam-overlay
    masters: gentoo
    priority: 50

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

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /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"
CXXFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --quiet-build=n"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync metadata-transfer multilib-strict 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://distfiles.gentoo.org"
LANG="ru_RU.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="/tmp"
USE="X a52 aac acl acpi activities aes aften alsa amd64 amr ass audio avx bash-completion branding bzip2 cairo cdda cdr clang cleartype consolekit cracklib crypt css cups cxx dbus declarative device-mapper djvu dri dts dv dvd dvdr egl encode exif faac faad fam fat ffmpeg firefox firmware-loader flac fontconfig gd gif glamor gles gpm gzip iconv icu id3tag ieee1394 imagemagick ipv6 jit jpeg kde keymap ladspa lame lash lcms libass libnotify lm_sensors lzma lzo mad matroska midi mmx mmxext mng modules mp3 mp4 mpeg mplayer mtp mudflap multilib ncurses nls nptl ntfs nvidia ogg opengl openmp opus pam pango pcre pdf phonon pie plasma png policykit popcnt ppds pppd pulseaudio qml qt3support qt5 quicktime rar raw readline scanner sdl seccomp session sse sse2 sse3 sse4_1 sse4_2 ssl ssp ssse3 startup-notification svc svg sysfs tcpd theora threads tiff toolame truetype twolame udev udisks unicode upower usb vaapi vdpau vorbis vpx wav wavpack widgets win32codecs wxwidgets x264 x265 xattr xcb xcomposite xml xorg xscreensaver xulrunner xv xvfb xvid xvmc zip zlib" ABI_X86="64" ALSA_CARDS="emu10k1" 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 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" 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="ru en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="ru en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="nvidia intel i965" 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
Comment 3 Ivan 2017-12-26 17:27:20 UTC
^ in addition to previous comment

checking for the correct version of the gmp/mpfr/mpc libraries... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.
 * ERROR: sys-devel/gcc-7.2.0::gentoo failed (configure phase):
 *   failed to run configure
 * 
 * Call stack:
 *     ebuild.sh, line  124:  Called src_configure
 *   environment, line 3445:  Called toolchain_src_configure
 *   environment, line 4628:  Called die
 * The specific snippet of code:
 *       CONFIG_SHELL="${EPREFIX}/bin/bash" bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure";
 * 
 * If you need support, post the output of `emerge --info '=sys-devel/gcc-7.2.0::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=sys-devel/gcc-7.2.0::gentoo'`.
 * 
 * Please include /tmp/portage/sys-devel/gcc-7.2.0/work/gcc-build-logs.tar.bz2 in your bug report.
 * 
 * The complete build log is located at '/tmp/portage/sys-devel/gcc-7.2.0/temp/build.log'.
 * The ebuild environment file is located at '/tmp/portage/sys-devel/gcc-7.2.0/temp/environment'.
 * Working directory: '/tmp/portage/sys-devel/gcc-7.2.0/work/build'
 * S: '/tmp/portage/sys-devel/gcc-7.2.0/work/gcc-7.2.0'
Comment 4 Matthias Maier gentoo-dev 2017-12-26 17:39:55 UTC
(In reply to Ivan from comment #2)
> Well, it just broke gcc for me.


I am sorry to hear that.

The easiest fix for this situation is to recover
  /usr/lib64/libmpfr.so.4 and /usr/lib64/libmpfr.so.4.*
from a backup.

If that doesn't work I verified that the following dirty hack works:

  [ !! Only do this if you cannot resurrect libmpfr.so.4.* from a backup !! ]
  # ln -s /usr/lib64/libmpfr.so.6.0.0 /usr/lib64/libmpfr.so.4
  # emerge -1 gcc
  # rm /usr/lib64/libmpfr.so.4
Comment 5 Matthias Maier gentoo-dev 2017-12-26 19:24:47 UTC
(In reply to Ivan from comment #2)
> Well, it just broke gcc for me.
> 
> Just for reference:
> 
> FEATURES="[…] preserve-libs […]"

(In reply to Ivan from comment #3)
> ^ in addition to previous comment
> 
> checking for the correct version of the gmp/mpfr/mpc libraries... no
> configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.

Ah, that comment came a moment too late.

For all with FEATURES="preserve-libs" - your gcc works just fine. Just downgrade mpfr to the latest stable version (that has libmpfr.so.4 as soname). No need to recompile or temporarily symlink a library.
Comment 6 Anthony Basile gentoo-dev 2017-12-26 19:28:57 UTC
As a first step, I've committed the patch below.  For slotting in the eclass to work, we need EAPI=5.  Currently gcc-4.7.4, 4.8.5 and 5.4.0-r3 are on EAPI=4.

I'm going to test bumping those versions of gcc to EAPI=5 and then add slotting to the eclass.


commit f928b8697a9a7dbcac313bc350c76e5967febfea (HEAD -> master)
Author: Anthony G. Basile <blueness@gentoo.org>
Date:   Tue Dec 26 14:24:33 2017 -0500

    dev-libs/mpfr: add preserve_old_lib, bug #642316
    
    For people that have FEATURES=-preserve-libs, we don't want the toolchain
    to break as the so name is bumped from libmpfr.so.4 to libmpfr.so.6.
    
    Package-Manager: Portage-2.3.13, Repoman-2.3.3

diff --git a/dev-libs/mpfr/mpfr-4.0.0.ebuild b/dev-libs/mpfr/mpfr-4.0.0-r1.ebuild
similarity index 90%
rename from dev-libs/mpfr/mpfr-4.0.0.ebuild
rename to dev-libs/mpfr/mpfr-4.0.0-r1.ebuild
index d74928dff90..fa5e936f499 100644
--- a/dev-libs/mpfr/mpfr-4.0.0.ebuild
+++ b/dev-libs/mpfr/mpfr-4.0.0-r1.ebuild
@@ -50,3 +50,11 @@ multilib_src_install_all() {
        rm "${ED}"/usr/share/doc/"${P}"/COPYING*
        use static-libs || find "${ED}"/usr -name '*.la' -delete
 }
+
+pkg_preinst() {
+       preserve_old_lib /usr/$(get_libdir)/libmpfr$(get_libname 4)
+}
+
+pkg_postinst() {
+       preserve_old_lib_notify /usr/$(get_libdir)/libmpfr$(get_libname 4)
+}
Comment 7 Attila Tóth 2017-12-26 22:10:35 UTC
Might be an interesting commit I've came accross:
https://bugs.gentoo.org/attachment.cgi?id=511700

I also attached an updated ebuild for mpc with some additional cherry-picked patched. Feel free to employ!
Comment 8 Anthony Basile gentoo-dev 2018-01-02 11:03:27 UTC
toolchain.eclass is now up to EAPI=5 which allows for slots.  i'll try adding the slot operators in a couple days and testing.
Comment 9 François Bissey 2018-01-12 20:03:42 UTC
(In reply to Attila Tóth from comment #7)
> Might be an interesting commit I've came accross:
> https://bugs.gentoo.org/attachment.cgi?id=511700
> 
> I also attached an updated ebuild for mpc with some additional cherry-picked
> patched. Feel free to employ!

Note that a new version of mpc (1.1.0) compatible with mpfr-4.0.0 has now been released. https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
Comment 10 Anthony Basile gentoo-dev 2018-01-12 20:04:30 UTC
(In reply to François Bissey from comment #9)
> (In reply to Attila Tóth from comment #7)
> > Might be an interesting commit I've came accross:
> > https://bugs.gentoo.org/attachment.cgi?id=511700
> > 
> > I also attached an updated ebuild for mpc with some additional cherry-picked
> > patched. Feel free to employ!
> 
> Note that a new version of mpc (1.1.0) compatible with mpfr-4.0.0 has now
> been released. https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz

you didn't look in the tree ;)
Comment 11 François Bissey 2018-01-12 20:06:04 UTC
(In reply to Anthony Basile from comment #10)
> (In reply to François Bissey from comment #9)
> > (In reply to Attila Tóth from comment #7)
> > > Might be an interesting commit I've came accross:
> > > https://bugs.gentoo.org/attachment.cgi?id=511700
> > > 
> > > I also attached an updated ebuild for mpc with some additional cherry-picked
> > > patched. Feel free to employ!
> > 
> > Note that a new version of mpc (1.1.0) compatible with mpfr-4.0.0 has now
> > been released. https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
> 
> you didn't look in the tree ;)

Sorry for the noise, my sync is 12 hours behind. Thank you :)
Comment 12 Anthony Basile gentoo-dev 2018-01-12 20:13:05 UTC
(In reply to François Bissey from comment #11)
> (In reply to Anthony Basile from comment #10)
> > (In reply to François Bissey from comment #9)
> > > (In reply to Attila Tóth from comment #7)
> > > > Might be an interesting commit I've came accross:
> > > > https://bugs.gentoo.org/attachment.cgi?id=511700
> > > > 
> > > > I also attached an updated ebuild for mpc with some additional cherry-picked
> > > > patched. Feel free to employ!
> > > 
> > > Note that a new version of mpc (1.1.0) compatible with mpfr-4.0.0 has now
> > > been released. https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
> > 
> > you didn't look in the tree ;)
> 
> Sorry for the noise, my sync is 12 hours behind. Thank you :)

You'll notice I added slots/sublots to dev-libs/mpc.  The other libraries already have them: dev-libs/mpfr, dev-libs/cloog, dev-libs/isl.
Comment 13 François Bissey 2018-01-30 00:22:05 UTC
The slot operator worked quite well with my mathematical packages that depends on mpfr. But with libmpfr.so.3 being preserved, gcc (at least 7.2.0) is susceptible to ICE until rebuilt against the new mpfr. This simple code leads to an ICE when compiled with g++

#include <complex>
auto inf = 1.0 / std::complex<double>();

This is infact due to the rebuild of mpc without changing the soname. So gcc has direct link to libmpfr.so.3 and an indirect one to libmpfr.so.4 courtesy of an immediately rebuilt mpc. See a concrete example over at https://trac.sagemath.org/ticket/24599
Comment 14 Anthony Basile gentoo-dev 2018-01-30 11:13:39 UTC
(In reply to François Bissey from comment #13)
> The slot operator worked quite well with my mathematical packages that
> depends on mpfr. But with libmpfr.so.3 being preserved, gcc (at least 7.2.0)
> is susceptible to ICE until rebuilt against the new mpfr. This simple code
> leads to an ICE when compiled with g++
> 
> #include <complex>
> auto inf = 1.0 / std::complex<double>();
> 
> This is infact due to the rebuild of mpc without changing the soname. So gcc
> has direct link to libmpfr.so.3 and an indirect one to libmpfr.so.4 courtesy
> of an immediately rebuilt mpc. See a concrete example over at
> https://trac.sagemath.org/ticket/24599

Thanks for the testing and research.  I was afraid of something like this.  We're going to have to be more clever about how we make use of the slot/subslot operators.
Comment 15 François Bissey 2018-01-31 01:49:16 UTC
I don't think it is that bad. It is certainly inconvenient. For info I maintain the sage-on-gentoo overlay, the next release of sage is using mpfr-4 (beta release have already switched which is why I am having fun with this right now). So a number of users will unmask mpfr-4, if it isn't already, probably sometimes towards the end of February.

I will pass the message to end users as well as I can, fortunately the compiler is not totally broken in most cases, I just may have a number of duplicate issues about ICE while rebuilding giac.
Comment 16 Larry the Git Cow gentoo-dev 2018-02-01 23:55:27 UTC
The bug has been closed via the following commit(s):

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

commit a5a55ab97b8ed6c250b86aa2e6c91a329bd3d3a1
Author:     Matthias Maier <tamiko@gentoo.org>
AuthorDate: 2017-12-26 16:38:23 +0000
Commit:     Matthias Maier <tamiko@gentoo.org>
CommitDate: 2018-02-01 23:54:35 +0000

    eclass/toolchain.eclass: Add := operators to a number of critical deps
    
    We should annotate a number of critical library dependencies of the
    compiler with := operators to ensure that the compiler gets rebuilt in
    time.
    
    TODO: We should also check for FEATURES=preserve-libs / print a warning
    before attempting to upgrade a library with soname change. Otherwise,
    users might be off to a rocky ride.
    
    Closes: https://bugs.gentoo.org/642316

 eclass/toolchain.eclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Comment 17 François Bissey 2018-05-06 01:44:07 UTC
Any clues on when a mpfr-4.x.x will leave package.mask?