Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 504544 - media-libs/harfbuzz and >=media-libs/freetype-2.5.3 circular dependency and linker loop
Summary: media-libs/harfbuzz and >=media-libs/freetype-2.5.3 circular dependency and l...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Multilib team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-14 02:57 UTC by Patrick Lauer
Modified: 2014-03-21 05:25 UTC (History)
6 users (show)

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


Attachments
freetype-2.5.3-r1.ebuild.diff (freetype-2.5.3-r1.ebuild.diff,1.69 KB, patch)
2014-03-14 07:47 UTC, Lars Wendler (Polynomial-C) (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Lauer gentoo-dev 2014-03-14 02:57:48 UTC
$ lddtree /usr/lib64/libharfbuzz.so.0.926.0
/usr/lib64/libharfbuzz.so.0.926.0 (interpreter => None)
    libglib-2.0.so.0 => /usr/lib64/libglib-2.0.so.0
        libpthread.so.0 => /lib64/libpthread.so.0
            ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2
    libfreetype.so.6 => /usr/lib64/libfreetype.so.6
        libz.so.1 => /lib64/libz.so.1
        libbz2.so.1 => /lib64/libbz2.so.1
        libpng16.so.16 => /usr/lib64/libpng16.so.16
            libm.so.6 => /lib64/libm.so.6
        libharfbuzz.so.0 => /usr/lib64/libharfbuzz.so.0
        libfreetype.so.6 => !!! circular loop !!!
    libgraphite2.so.3 => /usr/lib64/libgraphite2.so.3
    libc.so.6 => /lib64/libc.so.6

"Circular loop" doesn't sound like a good idea to me ...

Portage 2.2.8-r1 (default/linux/amd64/13.0/desktop/kde, gcc-4.8.2, glibc-2.18-r1, 3.13.6-gentoo x86_64)
=================================================================
System uname: Linux-3.13.6-gentoo-x86_64-AMD_Phenom-tm-_II_X4_965_Processor-with-gentoo-2.2
KiB Mem:     7919204 total,    745292 free
KiB Swap:   25165812 total,  25165812 free
Timestamp of tree: Unknown
ld GNU ld (GNU Binutils) 2.24
app-shells/bash:          4.2_p45-r1
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.6, 3.2.5-r3, 3.3.4
dev-util/cmake:           2.8.12.2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.13.4, 1.14.1
sys-devel/binutils:       2.24-r2
sys-devel/gcc:            4.8.2
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           4.0-r1
sys-kernel/linux-headers: 3.13 (virtual/os-headers)
sys-libs/glibc:           2.18-r1
Repositories: gentoo
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /var/lib/hsqldb"
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 -O2 -pipe -ggdb"
DISTDIR="/chroot/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build=n"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs cgroup compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirrors.sohu.com/gentoo/"
INSTALL_MASK="/lib/systemd /lib32/systemd /lib64/systemd /usr/lib/systemd /usr/lib32/systemd /usr/lib64/systemd /etc/systemd"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6"
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"
PORTAGE_TMPDIR="/chroot/build"
PORTDIR="/home/pl/code/gentoo-x86"
PORTDIR_OVERLAY=""
USE="X a52 aac acpi alsa amd64 bash-completion berkdb bluetooth branding bzip2 cairo cdda cdr cjk cli compat consolekit crypt cups curl cxx dbus declarative dri dts dvd dvdr dvdread emboss encode exif expat fam ffmpeg firefox flac foomaticdb fortran ftp gcj gd gdbm gif gmp gnutls gpm gtk iconv icq idn imagemagick imap imlib innodb ipod ipv6 jabber javascript jingle jpeg jpeg2k kde kdehiddenvisibility kipi lame lcms libnotify lzo mad matroska md5sum midi mmap mmx mng modules mp3 mp4 mpeg mplayer msn multilib musepack musicbrainz mysql ncurses nls nptl nsplugin offensive ogg openal openexr opengl openmp openvg oscar pam pango pcre pdf perl php plasma png policykit ppds python qt3support qt4 quicktime raw rdesktop readline rss samba sdl semantic-desktop session speex spell sqlite sqlite3 sse sse2 sse3 ssl ssse3 startup-notification subversion svg syslog taglib tcpd threads tidy tiff tk truetype udev udisks unicode upower usb vdpau vlc vorbis wifi wmf wxwindows x264 xattr xcb xcomposite xine xinerama xml xmlrpc xpm xscreensaver xulrunner xv xvid zlib" ABI_X86="64" ALSA_CARDS="hda-intel" 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" 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" INPUT_DEVICES="evdev" KERNEL="linux" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_GB de de_DE" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" QEMU_SOFTMMU_TARGETS="x86_64 alpha arm cris i386 lm32 m68k microblaze microblazeel mips mips64 mips64el mipsel or32 ppc ppc64 ppcemb s390x sh4 sh4eb sparc sparc64 unicore32 xtensa xtensaeb" QEMU_USER_TARGETS="alpha arm armeb cris i386 m68k microblaze microblazeel mips mipsel or32 ppc ppc64 ppc64abi32 s390x sh4 sh4eb sparc sparc32plus sparc64 unicore32 x86_64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon r600" 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:  CPPFLAGS, CTARGET, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
Comment 1 Patrick Lauer gentoo-dev 2014-03-14 03:29:16 UTC
Looks like freetype is to "blame":

2014-03-01  Werner Lemberg  <wl@gnu.org>

        Add configure support for HarfBuzz.

So there's a circular loopenating *if* they are both installed already and getting rebuilt.
Comment 2 Patrick Lauer gentoo-dev 2014-03-14 03:34:26 UTC
--- freetype-2.5.3.ebuild       2014-03-14 11:31:39.395176021 +0800
+++ freetype-2.5.3-r1.ebuild    2014-03-14 11:31:10.752430002 +0800
@@ -99,6 +99,7 @@
                --enable-biarch-config
                $(use_with bzip2)
                $(use_with png)
+               --with-harfbuzz=no
 
                # avoid using libpng-config
                LIBPNG_CFLAGS="$($(tc-getPKG_CONFIG) --cflags libpng)"


This patch "fixes" the circular loop. Maybe not the cleanest way to do it; I'm not sure if any relevant functionality is lost that way.
Comment 3 Patrick Lauer gentoo-dev 2014-03-14 03:37:46 UTC
# lddtree /usr/lib64/libfreetype.so.6
/usr/lib64/libfreetype.so.6 (interpreter => None)
    libz.so.1 => /lib64/libz.so.1
    libbz2.so.1 => /lib64/libbz2.so.1
    libpng16.so.16 => /usr/lib64/libpng16.so.16
        libm.so.6 => /lib64/libm.so.6
    libc.so.6 => /lib64/libc.so.6
        ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2

No more automagic dependency like this. Me like!
Comment 4 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-03-14 03:49:54 UTC
Take a look at http://git.savannah.gnu.org/cgit/freetype/freetype2.git/diff/docs/INSTALL.UNIX?id=86026a47b345a8c254dd5e6be77bf116737cdafb :

freetype upstream knows about the dependency loop, and apparently recommends building freetype with --with-harfbuzz to allow the autohinter to hint opentype fonts.

So, freetype maintainers, how do we handle this?
Comment 5 Patrick Lauer gentoo-dev 2014-03-14 06:32:43 UTC
Ok, as far as I can tell there's two ways to fix this:

1) unconditionally disable harfbuzz in freetype
2) only allow to depend on harfbuzz[-freetype]

All other scenarios I can think of have linking loops or fail to build.
Comment 6 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-03-14 06:36:06 UTC
Why are linking loops bad? (Besides the fact that there is a circular dependency between the two packages.)
Comment 7 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2014-03-14 06:54:08 UTC
The only solution that comes to my mind is to add a "harfbuzz" USE flag to freetype ebuilds and not enabling it by default while letting the user know via elog message that having the flag being disabled results in opentype fonts hinting not being as good as possible.
Comment 8 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-03-14 07:11:36 UTC
I initially thought of building a temporary copy of harfbuzz with all external dependencies disabled in the freetype ebuild. Unfortunately, it won't work: just to make things more fun, it seems that freetype-2.5.3 depends not simply on harfbuzz but on harfbuzz[truetype] because it uses hb_ft_* symbols :/

So a "harfbuzz" USE flag in freetype and elog and a normal dependency might be the way to go.
Comment 9 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2014-03-14 07:47:22 UTC
Created attachment 372638 [details, diff]
freetype-2.5.3-r1.ebuild.diff

Possible fix. Please review as I am not really into this multilib stuff :-/
Comment 10 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2014-03-14 07:56:37 UTC
Oh and for the record... multilib-enabled harfbuzz ebuild still is p.masked.
Comment 11 Ben de Groot (RETIRED) gentoo-dev 2014-03-16 09:36:24 UTC
(In reply to Lars Wendler (Polynomial-C) from comment #9)
> Created attachment 372638 [details, diff] [details, diff]
> freetype-2.5.3-r1.ebuild.diff
> 
> Possible fix. Please review as I am not really into this multilib stuff :-/

This seems to me the best way forward. It doesn't solve the linker loop, but at least it makes stuff installable in the right order.

A couple of improvements I would suggest to the patch:

1) since this is only relevant for the auto-hinter, these useflags should be coupled by REQUIRED_USE
2) the elog message should be handled through readme.gentoo.eclass
Comment 12 Ben de Groot (RETIRED) gentoo-dev 2014-03-16 10:41:25 UTC
+*freetype-2.5.3-r1 (16 Mar 2014)
+
+  16 Mar 2014; Ben de Groot <yngwin@gentoo.org> +freetype-2.5.3-r1.ebuild,
+  metadata.xml:
+  Add harfbuzz useflag to prevent circular dep (bug #504544)

I couldn't implement readme.gentoo.eclass handling as it seems multilib interferes with that.

Re-assigning to multilib, so they can do their thing w.r.t. the harfbuzz dep.
Comment 13 Patrick Lauer gentoo-dev 2014-03-16 11:40:15 UTC
(In reply to Alexandre Rostovtsev from comment #6)
> Why are linking loops bad? (Besides the fact that there is a circular
> dependency between the two packages.)

Apart from breaking prelink and making ldd output unusually suspicious?

Apart from that functionally nothing, but I don't consider critical warnings to be something that can be casually ignored ...
Comment 14 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-03-17 18:10:16 UTC
+  17 Mar 2014; Michał Górny <mgorny@gentoo.org> freetype-2.5.3-r1.ebuild:
+  Add MULTILIB_USEDEP on harfbuzz.

I've added the new freetype version to the multilib mask.

However, doesn't 2.5.3 have automagic dep on harfbuzz now?
Comment 15 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-03-17 18:10:40 UTC
*** Bug 504808 has been marked as a duplicate of this bug. ***
Comment 16 Ben de Groot (RETIRED) gentoo-dev 2014-03-21 05:20:52 UTC
(In reply to Michał Górny from comment #14)
> +  17 Mar 2014; Michał Górny <mgorny@gentoo.org> freetype-2.5.3-r1.ebuild:
> +  Add MULTILIB_USEDEP on harfbuzz.
> 
> I've added the new freetype version to the multilib mask.

This should not have been masked. We need this for security bug #504088.

> However, doesn't 2.5.3 have automagic dep on harfbuzz now?

No, my own tests show no linkage to harfbuzz unless you enable the useflag in 2.5.3-r1.
Comment 17 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-03-21 05:25:36 UTC
(In reply to Ben de Groot from comment #16)
> (In reply to Michał Górny from comment #14)
> > +  17 Mar 2014; Michał Górny <mgorny@gentoo.org> freetype-2.5.3-r1.ebuild:
> > +  Add MULTILIB_USEDEP on harfbuzz.
> > 
> > I've added the new freetype version to the multilib mask.
> 
> This should not have been masked. We need this for security bug #504088.

It was masked because you (according to profiles/package.mask) asked for >=x11-libs/cairo-1.12.16-r1 to be masked for 30 days. Which ended up blocking a whole bunch of other multilibbed packages from being unmasked. So we can't unmask multilib harfbuzz, and can't set freetype's dependencies correctly.

See bug #504808.