Sunday, March 16, 2014

Bird in the Hand

So... previously I managed to get the versatile finch instant messenger program running on IZ2S, but failed to connect to anything with it.  Recompiling and running it with --debug led me to an old uclibc 0.9.29 bug where it defines but does not support some getaddrinfo() hint flags like AI_NUMERICSERV and AI_ADDRCONFIG.  Using them locks up the program (or the thread in the case of finch) on the dns lookup.  I patched the uclibc netdb.h header file to not define the unsupported flags, then hacked the glib resolver function to skip over those flags and instead use IPV4 only on the zipit.  This fixed my glib resolver test program, and got me a working nslookup applet, but failed to fix the finch.  I gave up -- again -- and did some work on the Links browser instead.

Eventually I got the idea to search for the "DNS query queued" debug message inside the finch libpurple code.  Sure enough, despite the fact that finch requires the enormous glib to build, it goes straight to the libc getaddrinfo() function instead of wading through the extra bloat of the glib resolver wrapper.  If only the finch devs would see the light and bypass all of glib then maybe I could build a cut down finch with a subset of plugins that actually fits on the internal zipit flash.  Anyhow, I patched libpurple just like glib, rebuilt everything and the new finch was able to connect to IRC from my IZ2S zipit.  You can see my test session running on the half hidden right side window in this screenshot.
When I configured finch it gave me a warning that some IM protocols would have reduced functionality without gnutls, so I decided to build that while I was still working on the finch executable.  Sadly, I don't remember which IM protocols wanted it so the libgnutls remains untested, but included for completeness.

While building, I also found pkgconfig, which is a nifty slim replacement for the bloated pkg-config program, and will surely make compiling certain large packages with the native IZ2S and openwrt compilers much easier.  It's a clear win over my previous cheesy pkg-config shell script.

Here's the new finch with the patched glib and libpurple shared libraries along with a few other libs that should be enough to get it going on a basic IZ2S zipit.  I included a wrapper script that should also work if you want to boot iz2jffs and run finch from the SD card.

Here's the gnutls libs.

And the nslookup applet.

And finally, I've included the unstripped glib along with the pkgconfig utility as an add on for the native IZ2S compiler.  This stuff should go in the usr/local directory on your SD card if you want to compile with it.

I still need to build an openwrt pkgconfig executable...

No comments:

Post a Comment