Since I’m doing some performance/battery duration tests on my rooted Kindle 4NT, I decided I needed the always useful screen application, so that I could execute tests while connected over SSH, then detach the console and let it run for a while, only to re-attach back later to the same console and see what happened, monitor some logs and so on, all the while without interrupting anything. There are other ways to execute stuff in background, but this remains the most practical of all.
Now, I found out that the ncurses library is already installed on the OS, even if it doesn’t seem to be in the sources archive distributed by Amazon; the version 5.4 is sitting right there in /usr/lib; since it is the only external requirement for screen, I copied the library back to my system and directly into the sysroot created by crosstool, so that the linker could find it easily. Then I downloaded the screen sources.
And there the problems started to arise.
First, the fact that you can specify the target/host/build systems in ./configure is not clear at all, or even documented in the help of the script, so you need to improvise and find out by yourself. The configuration does not work by specifying CC/CFLAGS/LDFLAGS, or at least I could not make it work, the only correct way is to use the –host option.
The second problem was, of course, the neverending source of surprises that is the triptych of commands produced by the autoconf stuff: it sucks beyond belief, and in particular in this case it does not work at all for cross-compilation: there are some tests that cannot be executed, the script tells you that, and then simply stops. So you need to apply a well known patch (for example, I have used this one), which allows the script to output the makefiles regardless of those tests. Then, of course, is not over: the failed tests do not produce the correct options in config.h, so my advice is to execute (separately) a configuration for your own computer, then use the config.h generated for the computer for the Kindle sources too: it will compile fine, and the final binary works without problems on the Kindle.
Leave a Reply