Thursday, 2 August 2007

softfloat rrdtool sequel

Hey, I am back from vacation. I was back on Saturday but I didn't had the time to blog or do Debian work, so hello :-D.

After coming back from my vacation I went back to the softfloat rrdtool thingie I was working on before and I finaly managed to compile a statically linked softfloat uclibc rrdtool. Needless to say that I found that a pain and I ended up:
  • avoiding the Makefile and made the linking manually because:
    • for some unknown reason, the -static option didn't ended up in the final link call
    • libfreetype and libart_lgpl always were added as .so files... - libtool is probably the usual susupect, but I suspect the upstream libraries themselves
  • avoided (completely) using xmerge and used directly the source since:
    • CFLAGS="-Wl,-static" did not do the right thing (it didn't do in raw source, either)
    • I was about to make a static rrdtool, so I didn't needed gentoo's ebuilds at that point

If you are curious about the hideous details, just add a comment or email me and I'll send them or publish them.

So, in the end, I managed to produce a staticlly linked arm-softfloat-uclibc rrdtool which:
  • did not work directly on the .rrd files generated by the debian packaged collectd since they were "generated on another achitecture"; well with debian's rrdtool, 'rrdtool dump' was not that slow, so it was acceptable to dump with debian's rrdtool and restore with the statically linked one
  • generated graphs in about 1 minute (way slower than my amd64 machine, which does in 3s, but at least 100+ times faster than debian's arm rrdtool - remember, I tested the generation and it didn't finish the first graph not even after 50 minutes)
So that was fun. The total round trip for a round of graph generation was about 15 min which was more than cool and fast compared to the slow native variant, whohoo!

Now the downside, I am not through with it. If you look at the picture you'll notice that there is a "small-ish" problem: there are no scales, legends and no letters/glyphs of any kind, so the graphs are still quite useless, but better than nothing:


They should look something like this:




Notice any difference? :-/

Of course, I won't stop here!

I suspect the problems come from the cross compiled libfreetype and libart_lgpl, and I'll probably end up doing some native compiling after all, sigh!

2 comments:

sylvain said...

Quick and dirty way :

./configure --disable-tcl --disable-ruby --disable-python --disable-perl --enable-shared=no --enable-static --prefix=/home/delphine/Desktop/install/ --exec-prefix=${HOME}/install/
make
file src/rrdtool src/rrdcgi src/rrdupdate
src/rrdtool: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.0, dynamically linked (uses shared libs), not stripped
src/rrdcgi: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.0, dynamically linked (uses shared libs), not stripped
src/rrdupdate: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.0, dynamically linked (uses shared libs), not stripped

Bad dynamically linked binaries ! RM them !
rm src/rrdtool src/rrdcgi src/rrdupdate
Add -all-static to CFLAGS variable in src/Makefile :
CFLAGS = -g -O2 -fno-strict-aliasing -Wall -std=gnu99 -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -W -fPIC -DPIC
becomes :

CFLAGS = -all-static -g -O2 -fno-strict-aliasing -Wall -std=gnu99 -pedantic -Wshadow -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline -W -fPIC -DPIC
Compile again after with this new flag (used by libtool, and passed to gcc as -static)

make

file src/rrdtool src/rrdcgi src/rrdupdate
src/rrdtool: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.0, statically linked, not stripped
src/rrdcgi: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.0, statically linked, not stripped
src/rrdupdate: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.0, statically linked, not stripped

COOL ! It works ! :-)

Usual suspects :
* libtool (with its stupid -all-static flag which tell it to pass -static flag to gcc)

and also

* libfreetype6-dev

* libart-2.0-dev

because of those 2 files :

usr/lib/libfreetype.la

/usr/lib/libart_lgpl_2.la

referenced by src/librrd.la and src/librrd_th.la

grep '\.so' /usr/lib/libfreetype.la /usr/lib/libart_lgpl_2.la
/usr/lib/libfreetype.la:dlname='libfreetype.so.6'
/usr/lib/libfreetype.la:library_names='libfreetype.so.6.3.10 libfreetype.so.6 libfreetype.so'

/usr/lib/libart_lgpl_2.la:dlname='libart_lgpl_2.so.2'

/usr/lib/libart_lgpl_2.la:library_names='libart_lgpl_2.so.2.3.17 libart_lgpl_2.so.2 libart_lgpl_2.so'

Bernd Zeimetz said...

Are you using arm or armel? I'd expect that armel rrdtool on is faster than on arm....