Some fixes to allow building on 32-bit and with dependencies in weird
places.

Change-Id: I06b89fde2623617ed108455f5900aa39eb7e1d89
Signed-off-by: Rob Adams <readams@readams.net>