Android, day one (and an half)

So, I finally got my Android smartphone AND tablet. I’ve been toying with them for about a day now and I wanted to share some toughts and some thing I learned.

  • Don’t plug Asus Transformer USB charger on your UPS, it didn’t play well for me (bad smell, I tought it burned but it works fine on a wall plug)
  • Android doesn’t connect to wifi network if the SSID contains spaces
  • Most Android devices doesn’t work out-of-the-box on wifi channel 13 (this sucks)
  • Android is marketed as “open”, but most “apps” on the market are closed source and the App Market model isnt open at all. Also, the “app” model isn’t open.
  • Many web sites recognize mobile browsers. Sadly, most fail to check the screen resolution: what’s the point in providing a mobile version on a 1280×800 pixel screen (tablet)?
  • Flash runs smooth. Better than on my desktop. Adobe, you fail badly.
  • Skype sucks also on mobile.
  • Problem is: GTalk sucks too. Maybe in ten years we all will be using GNU Free Call. But I want it now.

Updates will follow.

Compiling Pound 2.6e with openssl-1.0.0d on CentOS 5.6

More Pound compiling! Seems like the memory leak was in openssl, not Pound, so, here’s how to compile the newest openssl and Pound:

# extract sources
root[~]$ tar zxvf ../openssl-1.0.0d.tar.gz
root[~]$ tar zxvf ../Pound-2.6e.tgz
root[~]$ cd openssl-1.0.0d/
# configure openssl
root[~/openssl-1.0.0d]$ ./config --prefix=/opt/openssl_1d/ \
  --openssldir=/opt/openssl_1d/ \
  threads zlib shared
[...]
# compile
root[~/openssl-1.0.0d]$ time make &> compilation-output.log
# install (as root)
root[~/openssl-1.0.0d]$ su
password:
root[~/openssl-1.0.0d]# make install
# add the lib to ldconfig
root[~/openssl-1.0.0d]# echo '/opt/openssl_1d/lib' > \
  /etc/ld.so.conf.d/openssl-1d.conf
root[~/openssl-1.0.0d]# ldconfig -v | grep ssl
[...]
/opt/openssl-1d/lib:
 libssl.so.1.0.0 -> libssl.so.1.0.0
 libssl.so.6 -> libssl.so.0.9.8e
 libssl.so.6 -> libssl.so.0.9.8e
 libgnutls-openssl.so.13 -> libgnutls-openssl.so.13.0.6
 libssl3.so -> libssl3.so
 libgnutls-openssl.so.13 -> libgnutls-openssl.so.13.0.6
 libssl3.so -> libssl3.so
[...]
root[~/openssl-1.0.0d]# exit
root[~/openssl-1.0.0d]$ 
# move to pound source dir
root[~/openssl-1.0.0d]$ cd ../Pound-2.6e/
# fix pound configure for old gcc
root[~/Pound-2.6e]$ sed -i -e 's#-Wno-unused-result##g' configure
# configure pound
root[~/Pound-2.6e]$ ./configure --with-ssl=/opt/openssl_1d/ \
  --prefix=/opt/pound
[...]
# compile
root[~/Pound-2.6e]$ make
[...]
root[~/Pound-2.6e]$ su -c 'make install'
[...]

If you have GCC 4.4 on CentOS, you’ll get an error compiling pound:

root[~/Pound-2.6e]$ make
[...]
pound.o: In function `put_thr_arg':
/usr/src/Pound-2.6e/pound.c:131: undefined reference to `rpl_malloc'
[...]

To fix this, you should export this before compiling (found here):

root[~/Pound-2.6e]$ export ac_cv_func_malloc_0_nonnull=yes
root[~/Pound-2.6e]$ make
[...]

Compiling Pound 2.6e on CentOS 5.x

Quick fix: edit configure, at row 3235 delete -Wno-unused-result from the CPPFLAGS (found on pound mailing list).

Explanation

Today I had to compile Pound reverse proxy on a CentOS 5.6 host. Initially, the configure process failed to find ssl libs, or any other lib:

$ ./configure 
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: *** Checking for threads library and/or flags ***
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... no
checking whether pthreads work with -pthreads... no
checking whether pthreads work with -mthreads... no
checking for the pthreads library -lpthread... no
checking whether pthreads work with --thread-safe... no
checking whether pthreads work with -mt... no
checking for pthread-config... no
configure: *** Parsing options ***
configure: *** Checking for libraries ***
checking for dlopen in -ldl... no
checking for socket in -lsocket... no
checking for hstrerror in -lresolv... no
checking for BIO_new in -lcrypto... no
Missing OpenSSL (-lcrypto) - aborted

After some fiddling and much googling, I found out that there was no problem with the compile environment, instead the configure script was using a particular flag, -Wno-unused-result, that is not supported by the old GCC version installed in CentOS 5.x.

You can verify by compiling any C file:

$ gcc -Wno-unused-result -o my-gcc-is-old http.c 
cc1: error: unrecognized command line option "-Wno-unused-result"

So, GCC is failing to compile the sample programs that configure uses to determine if a lib (or some function in a lib) is available, hence configure aborts lamenting the absence of the library.