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

Bug 289180

Summary: emerge @preserved-rebuild fails to remove libs having multiple providers of the same soname, like libffi.so from gcc-4.4.1
Product: Gentoo Linux Reporter: Steffen Hau <steffen>
Component: New packagesAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: arfrever, dschridde+gentoobugs, enrico.tagliavini, esigra, joshua.rich, kanelxake, ssuominen
Priority: High Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 240323    

Description Steffen Hau 2009-10-15 08:57:01 UTC
I've updated my system and gcc was reemerged due to a masking of libffi use flag. After upgrading has finished, emerge told me to run emerge @preserved-rebuild to get rid of the libffi.so former installed by gcc.

!!! existing preserved libs:
>>> package: sys-devel/gcc-4.4.1
 *  - /usr/lib/gcc/i686-pc-linux-gnu/4.4.1/libffi.so
 *  - /usr/lib/gcc/i686-pc-linux-gnu/4.4.1/libffi.so.4
 *  - /usr/lib/gcc/i686-pc-linux-gnu/4.4.1/libffi.so.4.0.1
 *      used by /usr/lib/python2.6/lib-dynload/_ctypes.so (dev-lang/python-2.6.3)
 *      used by /usr/lib/python3.1/lib-dynload/_ctypes.so (dev-lang/python-3.1.1-r1)
Use emerge @preserved-rebuild to rebuild packages using these libraries

After running the above command, the same message appeared again. I took a look what had happened and both mentioned files were again linked again the not wanted libffi. I guess this has happened because of "/usr/lib/gcc/i686-pc-linux-gnu/4.4.1/" beeing in LDPATh before /usr/lib. The only way for me, to get rid of this was to manually delete the mentioned files.

Reproducible: Always

Steps to Reproduce:
1.run emerge @preserved-rebuild after reemerge of gcc
2.
3.

Actual Results:  
libffi.so files from gcc do not get deleted


Portage 2.2_rc46 (default/linux/x86/10.0, gcc-4.4.1, glibc-2.10.1-r0, 2.6.32-rc4-HAUIHAU i686)
=================================================================
System uname: Linux-2.6.32-rc4-HAUIHAU-i686-Intel-R-_Core-TM-2_CPU_T7200_@_2.00GHz-with-gentoo-2.0.1
Timestamp of tree: Wed, 14 Oct 2009 22:30:20 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p33
dev-java/java-config: 2.1.9-r1
dev-lang/python:     2.6.3, 3.1.1-r1
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.5.1
sys-apps/sandbox:    2.1
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer -mfpmath=sse -msse3"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /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 /etc/udev/rules.d"
CXXFLAGS="-march=core2 -O2 -pipe -fomit-frame-pointer -mfpmath=sse -msse3"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests ccache distlocks fakeroot fixpackages metadata-transfer news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo/ "
LANG="de_DE.utf8"
LC_ALL="de_DE.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-znow -Wl,--sort-common -s"
LINGUAS="de"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/sectools /usr/local/portage/layman/gnome /usr/local/portage/layman/hauihau"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aac aalib acl acpi alsa apache2 bash-completion berkdb bidi bluetooth branding bzip2 cairo cdb cdda cddb cdparanoia cdr cli cracklib crypt ctype cups curl dbus dedicated dga directfb doc dri dts dv dvd dvdr dvdread encode examples exif ffmpeg firefox flac fontconfig foomaticdb fortran ftp gdbm gif glitz glut gmp gnome gnome-keyring gnutls gphoto2 gstreamer gtk gtk2 hal htmlhandbook iconv ieee1394 imagemagick imap imlib innodb ipod ipv6 isdnlog java java5 java6 javascript jpeg jpeg2k kde lame lcms ldap libcaca libnotify libsamplerate lua mad mikmod mmap mmx mng modules mono mp3 mpeg mplayer mudflap musepack musicbrainz mysql ncurses nls noseamonkey nptl nptlonly nsplugin offensive ogg openal opengl openmp oscar pam pcmcia pcre pdf perl php plasma png policykit posix ppds pppd python qt4 quicktime readline reflection rss rtc ruby samba sasl sdl session sndfile snmp sockets spell spl sqlite sse sse2 ssl startup-notification subversion svg sysfs tcl tcpd theora threads tiff tk truetype unicode usb userlocales v4l2 vcd vim-syntax visualization vorbis win32codecs x264 x86 xattr xcb xcomposite xine xinerama xml xorg xosd xpm xscreensaver xulrunner xv xvid yahoo zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_ftp proxy_http rewrite setenvif so speling status substitute unique_id userdir usertrack version vhost_alias" APACHE2_MPMS="worker" CAMERAS="canon casio_qv fuji kodak konica minolta mustek panasonic samsung sonydscf1 sonydscf55 toshiba" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="de" USERLAND="GNU" VIDEO_CARDS="radeon radeonhd"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Sebastian Luther (few) 2009-10-15 09:08:26 UTC
Just to make this clear: Do you have libffi.so* in /usr/lib installed by dev-libs/libffi (or some other provider, if there are more)?
Comment 2 Steffen Hau 2009-10-15 09:11:18 UTC
Yes, dev-libs/libffi is installed.

schlepptop ~ # equery f libffi
 * Searching for libffi ...
 * Contents of dev-libs/libffi-3.0.8:
/usr
/usr/lib
/usr/lib/libffi-3.0.8
/usr/lib/libffi-3.0.8/include
/usr/lib/libffi-3.0.8/include/ffi.h
/usr/lib/libffi-3.0.8/include/ffitarget.h
/usr/lib/libffi.la
/usr/lib/libffi.so -> libffi.so.5.0.9
/usr/lib/libffi.so.5 -> libffi.so.5.0.9
/usr/lib/libffi.so.5.0.9

As I said, python gets linked against those libs, if I manually delete the libffi.so* from gcc.
Comment 3 Samuli Suominen (RETIRED) gentoo-dev 2009-10-15 09:49:44 UTC
This ld.so.conf conflict is exactly why I masked the USE libffi for
sys-devel/gcc in the first place.

This is bad, if portage doesn't know howto handle it.
Comment 4 Navid Zamani 2011-01-16 01:44:43 UTC
Guys, I just got the exact same problem with GCC 4.5.2, libffi 3.0.9-r1 and the the following packages not going out of @preserved-rebuild:
dev-java/jna-3.2.4
dev-lang/python-3.1.3
dev-lang/python-2.7.1

I don’t really understand how to properly fix this. I mean so that it will never ever return for anyone who’s using Gentoo. And as a temporary workaround also so that it won’t return for me, without causing any errors. Just deleting those libs sounds like a recipe for disaster.
Comment 5 Fabian Groffen gentoo-dev 2011-01-16 09:51:54 UTC
Maybe we can figure out why the .so (without version) is preserved, as it shouldn't have in the first place.
Comment 6 Kyle Milz 2011-02-03 21:43:49 UTC
Same thing as Comment #4 is happening here also. The libffi use flag mask has been there since 2009, is it really necessary anymore? 
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2011-02-03 21:49:03 UTC
(In reply to comment #6)
> Same thing as Comment #4 is happening here also. The libffi use flag mask has
> been there since 2009, is it really necessary anymore? 
> 

What do you mean? It's there to stay. The USE="libffi" is not supposed to be used at all.

dev-libs/libffi is the maintained copy.
Comment 8 Samuli Suominen (RETIRED) gentoo-dev 2011-02-15 10:21:13 UTC
*** Bug 354903 has been marked as a duplicate of this bug. ***
Comment 9 Dennis Schridde 2011-05-26 15:22:28 UTC
The issue hit me with gcc-4.4.5, too.

Getting rid of the wrong link against libffi.so.4 for python:{2.7,3.2} was easy: I just deleted the offending libraries.

However, icedtea-6.1.10.1 here also linked against libffi.so.4, and deleting that file prevents javac from running, which in turn prevents icedtea:6 from bootstrapping (if gcj is not available). Hence a simple rebuild of icedtea to clear the dep is impossible. I am currently trying to build it with a manually created "libffi.so.4 -> libffi.so.5" symlink, which seems to work rather well.
Comment 10 Dennis Schridde 2011-05-26 15:22:45 UTC
The issue hit me with gcc-4.4.5, too.

Getting rid of the wrong link against libffi.so.4 for python:{2.7,3.2} was easy: I just deleted the offending libraries.

However, icedtea-6.1.10.1 here also linked against libffi.so.4, and deleting that file prevents javac from running, which in turn prevents icedtea:6 from bootstrapping (if gcj is not available). Hence a simple rebuild of icedtea to clear the dep is impossible. I am currently trying to build it with a manually created "libffi.so.4 -> libffi.so.5" symlink, which seems to work rather well.
Comment 11 Dennis Schridde 2011-07-16 12:43:01 UTC
Still true for gcc-4.5.2
Comment 12 Zac Medico gentoo-dev 2011-07-16 18:11:43 UTC
As I understand it, the problem is triggered by the fact that LinkageMapELF.findConsumers() is greedy in identifying consumers of a given library, even though there may be an alternative library file providing the same soname to the identified consumers.

This greedy behavior will be fine as long as we account for it inside the dblink _find_libs_to_preserve and _find_unused_preserved_libs methods. When counting references to libraries, these methods to be aware of alternative library files providing a given soname.
Comment 13 Zac Medico gentoo-dev 2011-07-16 18:16:55 UTC
*** Bug 284944 has been marked as a duplicate of this bug. ***
Comment 14 Zac Medico gentoo-dev 2011-07-16 18:21:58 UTC
*** Bug 305133 has been marked as a duplicate of this bug. ***
Comment 15 Zac Medico gentoo-dev 2011-07-18 05:42:26 UTC
(In reply to comment #12)
> As I understand it, the problem is triggered by the fact that
> LinkageMapELF.findConsumers() is greedy in identifying consumers of a given
> library, even though there may be an alternative library file providing the
> same soname to the identified consumers.

It's fixed to handle this in git:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=296fc63fee262600811520fccf4692f47a39ffba
Comment 16 Zac Medico gentoo-dev 2011-07-19 22:14:49 UTC
This is fixed in 2.2.0_alpha46.
Comment 17 Zac Medico gentoo-dev 2012-05-08 07:51:49 UTC
*** Bug 205531 has been marked as a duplicate of this bug. ***