On my system, I installed libfl
by running the following command, which should be easier than manually cross-compiling flex.
sudo xapt -a armhf -m libfl-dev
In order to fix the cannot run test program while cross compiling
problem, you can either build Thrift without libevent support (if that is an option for you) by passing --without-libevent
to configure
, or you can modify aclocal/ax_lib_event.m4
by replacing the use of AC_RUN_IFELSE
with AC_LINK_IFELSE
. Note that you will have to make a similar change in aclocal/ax_lib_zlib.m4
unless you pass --without-zlib
to configure
. Don't forget to run autoconf
after modifying the files in aclocal
.
After making these changes you will likely encounter these compile errors:
/usr/arm-linux-gnueabihf/include/c++/4.6.3/cstdlib:119:11: error: '::malloc' has not been declared
/usr/arm-linux-gnueabihf/include/c++/4.6.3/cstdlib:127:11: error: '::realloc' has not been declared
IMO, the easiest way to fix this is by removing the following lines from configure.ac
:
AC_FUNC_MALLOC
AC_FUNC_REALLOC
Again, you'll have to run autoconf
after deleting the lines from configure.ac
.
Finally, you can re-run configure
with your chosen options. On my system, I ran:
./configure --host=arm-linux-gnueabihf --with-cpp --without-tests \
--without-qt4 --without-c_glib --without-ruby --without-python
You will need the --without-tests
option to avoid problems caused by the build attempting to run armhf test binaries on your x86 build machine.
I passed the remaining --without-*
options to avoid having to install extra dependencies. If you don't require QT, Glib, Ruby, and Python support, I recommend you do the same to simplify your build.