On my system, I installed libfl by running the following command, which should be simpler than manually cross-compiling flex.
sudo xapt -a armhf -m libfl-dev
To fix the problem cannot run test program while cross compiling , you can either build Thrift without libevent support (if this is an option for you) by moving --without-libevent to configure , or you can change aclocal/ax_lib_event.m4 , replacing using AC_RUN_IFELSE with AC_LINK_IFELSE . Note that you will need to make a similar change to aclocal/ax_lib_zlib.m4 if you do not go --without-zlib to configure . Remember to run autoconf after changing files in aclocal .
After making these changes, you are likely to come across these compilation errors:
/usr/arm-linux-gnueabihf/include/++/4.6.3/cstdlib: 119: 11: error: ':: malloc' not declared / usr / arm -linux-gnueabihf / include / c ++ / 4.6.3 / cstdlib: 127: 11: error: ':: realloc' was not declared
IMO, the easiest way to fix this is to remove the following lines from configure.ac :
AC_FUNC_MALLOC AC_FUNC_REALLOC
Again, you need to run autoconf after deleting the lines from configure.ac .
Finally, you can re-run configure with the options you selected. 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 a failure trying to run armhf test binaries on your x86 build machine.
I passed the remaining options --without-* to avoid having to install additional dependencies. If you do not require support for QT, Glib, Ruby, and Python, I recommend that you do the same to simplify the build.