22/06/2008
The quest for a better rxvt-unicode on Gentoo
Today, while studying I decided to manually run a prelink on my system. For no good reason. Just boredom I guess. The results were pretty interesting though.
Among the output there was a line that made a very big impression to me.
prelink: /usr/bin/urxvt: Cannot prelink against non-PIC shared library //usr//lib/opengl/nvidia/lib/libGL.so.1
Why oh why is libGL.so.1 inside the shared libraries of a terminal ???
I decided to take a closer look to the urxvt executable.
# ldd /usr/bin/urxvt
linux-gate.so.1 => (0xffffe000)
libXft.so.2 => /usr/lib/libXft.so.2 (0x45df1000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x43839000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x45f4b000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x4b995000)
libAfterImage.so.0 => /usr/lib/libAfterImage.so.0 (0x4f62d000)
libperl.so.1 => /usr/lib/libperl.so.1 (0x43a60000)
libpthread.so.0 => /lib/libpthread.so.0 (0x4c408000)
libdl.so.2 => /lib/libdl.so.2 (0x4c2f4000)
libc.so.6 => /lib/libc.so.6 (0x4c19a000)
/lib/ld-linux.so.2 (0x4c17c000)
libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1 (0x4c52f000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x46414000)
libz.so.1 => /lib/libz.so.1 (0x4368c000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0x4c4b1000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x4cda8000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x4c401000)
librsvg-2.so.2 => /usr/lib/librsvg-2.so.2 (0x4bb34000)
libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0x4afc4000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x4af3a000)
libGL.so.1 => //usr//lib/opengl/nvidia/lib/libGL.so.1 (0x4bbb8000)
libm.so.6 => /lib/libm.so.6 (0x4c2cc000)
libnsl.so.1 => /lib/libnsl.so.1 (0x4cc4e000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x4cc8c000)
libutil.so.1 => /lib/libutil.so.1 (0x4cc67000)
libgsf-1.so.114 => /usr/lib/libgsf-1.so.114 (0x4baff000)
libcroco-0.6.so.3 => /usr/lib/libcroco-0.6.so.3 (0x4bac7000)
libxml2.so.2 => /usr/lib/libxml2.so.2 (0x43f9e000)
libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0x4afde000)
libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0x4b009000)
libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0x4af85000)
libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0x4af77000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x4ae68000)
libcairo.so.2 => /usr/lib/libcairo.so.2 (0x475c9000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x43750000)
libGLcore.so.1 => //usr//lib/opengl/nvidia/lib/libGLcore.so.1 (0x4b1e8000)
libnvidia-tls.so.1 => //usr//lib/opengl/nvidia/lib/libnvidia-tls.so.1 (0x4b991000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x4ba86000)
libbz2.so.1 => /lib/libbz2.so.1 (0x4db01000)
libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0x4762f000)
# ldd /usr/bin/urxvt | wc -l
40
That’s the time when someone can scream! 40 shared libraries for jsut a terminal ??? Why why why?
Ok it was time to check on the dependencies of the rxvt-unicode ebuild
From http://sources.gentoo.org/viewcvs.py/gentoo-x86/x11-terms/rxvt-unicode/rxvt-unicode-9.02-r1.ebuild?view=markup
IUSE="truetype perl iso14755"
# see bug #115992 for modular x deps
RDEPEND="x11-libs/libX11
x11-libs/libXft
media-libs/libafterimage
x11-libs/libXrender
perl? ( dev-lang/perl )"
DEPEND="${RDEPEND}
dev-util/pkgconfig
x11-proto/xproto"
Now what’s that libaferimage ?
# eix libafterimage
[I] media-libs/libafterimage
Available versions: ~1.07 1.15 {examples gif jpeg mmx nls png tiff}
Installed versions: 1.15(00:35:13 06/22/08)(mmx -examples -gif -jpeg -nls -png -tiff)
Homepage: http://www.afterstep.org/afterimage/index.php
Description: Afterstep's standalone generic image manipulation library
I don’t use any images on my terminal, so why am I not given the option not to have that dependency as a USE flag ? Without losing any more time I copied the /usr/portage/x11-terms/rxvt-unicode/ to my /usr/local/portage/ directory, and modified the ebuild a bit:
diff -uN /usr/portage/x11-terms/rxvt-unicode/rxvt-unicode-9.02-r1.ebuild /usr/local/portage/x11-terms/rxvt-unicode/rxvt-unicode-9.02-r2.ebuild
--- /usr/portage/x11-terms/rxvt-unicode/rxvt-unicode-9.02-r1.ebuild 2008-05-05 23:39:36.000000000 +0300
+++ /usr/local/portage/x11-terms/rxvt-unicode/rxvt-unicode-9.02-r2.ebuild 2008-06-22 00:55:04.000000000 +0300
@@ -11,18 +11,16 @@
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 hppa ~ia64 ppc ppc64 sparc x86 ~x86-fbsd"
-IUSE="truetype perl iso14755"
-
+IUSE="afterimage truetype perl iso14755"
# see bug #115992 for modular x deps
RDEPEND="x11-libs/libX11
x11-libs/libXft
- media-libs/libafterimage
+ afterimage? (media-libs/libafterimage)
x11-libs/libXrender
perl? ( dev-lang/perl )"
DEPEND="${RDEPEND}
dev-util/pkgconfig
x11-proto/xproto"
-
src_unpack() {
unpack ${A}
cd "${S}"
@@ -35,14 +33,12 @@
"s~@TIC@ \(\$(srcdir)/etc/rxvt\)~@TIC@ -o ${D}/${tdir} \1~" \
doc/Makefile.in
}
-
src_compile() {
myconf=''
-
use iso14755 || myconf='--disable-iso14755'
-
econf \
--enable-everything \
+ $(use_enable afterimage afterimage) \
$(use_enable truetype xft) \
$(use_enable perl) \
--disable-text-blink \
I re-emerged urxvt using the new ebuild from my local portage and I was shocked at the results:
# ldd /usr/bin/urxvt
linux-gate.so.1 => (0xffffe000)
libXft.so.2 => /usr/lib/libXft.so.2 (0x45df1000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x43839000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x45f4b000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x4b995000)
libperl.so.1 => /usr/lib/libperl.so.1 (0x43a60000)
libpthread.so.0 => /lib/libpthread.so.0 (0x4c408000)
libdl.so.2 => /lib/libdl.so.2 (0x4c2f4000)
libc.so.6 => /lib/libc.so.6 (0x4c19a000)
/lib/ld-linux.so.2 (0x4c17c000)
libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1 (0x4c52f000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x46414000)
libz.so.1 => /lib/libz.so.1 (0x4368c000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0x4c4b1000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x4cda8000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x4c401000)
libnsl.so.1 => /lib/libnsl.so.1 (0x4cc4e000)
libm.so.6 => /lib/libm.so.6 (0x4c2cc000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x4cc8c000)
libutil.so.1 => /lib/libutil.so.1 (0x4cc67000)
# ldd /usr/bin/urxvt | wc -l
20
100% less shared libraries!!!
What about memory usage ? I had not closed my 4 previously opened urxvt terms so a “ps auxww | grep urxvt” was just enough to check the differences:
user 3594 0.0 0.8 25920 10796 ? Ss 19:02 0:00 urxvt
user 6416 0.0 0.8 26820 11564 ? Ss 18:12 0:00 urxvt
user 6519 0.1 0.9 27132 12040 ? Ss 18:13 0:08 urxvt
user 15484 0.0 0.7 25356 10332 ? S 19:42 0:00 urxvt -fn xft:Dejavu Sans Mono:size=9:style=book -b 0 -embed 10485763 -name yeahconsole
user 27957 1.0 0.4 9628 5652 ? Ss 19:50 0:00 urxvt
Amazing ? Almost 1/3 VSZ and 1/2 of RSS!! For someone who has constantly more than 4-5 terms open the benefits are more than great 😀
This is going to be a great improvement for the next version of iloog too.
Being more than happy with my resource savings I decided to take a look at the Gentoo bugzilla to see if someone else had the same “problem” with me. Apparently I am not the only one asking for that USE flag since there’s already an open bug. http://bugs.gentoo.org/show_bug.cgi?id=221835
One lesson learned. When bumping into a problem with a Gentoo ebuild next time I’ll take a look at the Gentoo bugzilla before doing anything else by myself since there’s always some other crazy guy who has probably already bumped into the same bug and has already reported it. 🙂
*Update*
The USE flag has been enabled in the latest rxvt-unicode ebuild for version 9.05. That happened just yesterday. Take a look at: http://bugs.gentoo.org/show_bug.cgi?id=198944
Filed by kargig at 01:09 under Gentoo,Linux
6 Comments | 10,402 views
Δεν φταίει το gentoo, εσύ φταις που είσαι γερολαδάς και νομίζεις ότι με 256 ΜΒ RAM μπορείς να τρέξεις Linux. Βάε ρε παιδάκι μου 4 GB, πάτα και 2 reboot ημερησίως, και όλα θα πάνε μια χαρά
Άσχετο, αλλά ανυπομονώ να δω Suse 11. Απορώ πόσα GB θα θέλει για να κάνει τα out-of-the-box Compiz κλπ..
Και μετά κράζετε εμένα που έβαλα 4 GB να παίζω WoW… Α ρε νεολαία…
Έλα μωρέ, απλά έχουμε διαφορετικά hobby. Εγώ είμαι ακόμα σε φάση που ασχολούμαι με την διανομή μου ενώ εσύ είσαι στην φάση που παίζεις κουβάδες…..εεεεε…στοίχημα ήθελα να πω 😛
Καλή η προσθήκη περισσότερης RAM συνέχεια…αλλά κάπου πρέπει να υπάρχει και ένα μέτρο για τα applications. Δεν γίνεται για να δείχνουν μια εικονούλα παραπάνω να διπλασιάζουν το memory usage.
Το Ubuntu, από την έκδοση 7.10 και μετά, δε χρειάζεται prelinking, καθώς χρησιμοποιεί τον linking mechanism που ονομάζεται DT_GNU_HASH, ο οποίος αυξάνει την ταχύτητα του loading των προγραμμάτων, χωρίς τη χρήση του prelink.
http://gentoo-wiki.com/HOWTO_Hashstyle
To Gentoo κάνει το ίδιο πια. Απλά όπως είπα “For no good reason. Just boredom I guess.” 🙂
It’s interesting.
interesting:-)