title: How link with static boost libraries for android?
body: <p>I have problem porting and linking the boost libraries to android using Android-ndk-r5b.
  I build boost libraries first (without mpi, python) using these steps:</p>
  
  <h2>1.commented line 53 in boost_1_46_0\libs\thread\build:</h2>
  
  <pre>
  #   if [ os.name ] = "NT" { api = win32 ; }
  </pre>
  
  <h2>2. create the file user-config.jam in boost root directory</h2>
  
  <pre>
  androidNDKRoot = ../android-ndk-r5b ;
  
  using gcc : android4.4.3 : $(androidNDKRoot)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-g++.exe :
      --sysroot=$(androidNDKRoot)/platforms/android-3/arch-arm
      -mthumb
      -Os
      -fno-strict-aliasing
      -O2
      -DNDEBUG
      -g
      -fexceptions
      -frtti
      -lstdc++
      -I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/include
      -I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include
      -D__GLIBC__
      -DBOOST_NO_INTRINSIC_WCHAR_T
      $(androidNDKRoot)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-ar.exe
      $(androidNDKRoot)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-ranlib.exe
      linux
  ;
  </pre>
  
  <h2>3. build boost</h2>
  
  <pre>
  bjam.exe --user-config=user-config.jam --without-python --without-mpi toolset=gcc-android4.4.3 link=static runtime-link=static target-os=linux --stagedir=android > d:\out.txt
  </pre>
  
  <h2>4. Application.mk</h2>
  
  <pre>
  APP_STL := gnustl_static
  APP_PLATFORM := android-3
  APP_CPPFLAGS += -mthumb
  APP_CPPFLAGS += -Os
  APP_CPPFLAGS += -fno-strict-aliasing
  APP_CPPFLAGS += -O2
  APP_CPPFLAGS += -DNDEBUG
  APP_CPPFLAGS += -g
  APP_CPPFLAGS += -fexceptions
  APP_CPPFLAGS += -frtti
  APP_CPPFLAGS += -lstdc++
  APP_CPPFLAGS += -D__GLIBC__
  APP_CPPFLAGS += -DBOOST_NO_INTRINSIC_WCHAR_T
  APP_CPPFLAGS += -L/cygdrive/d/Android/boost_1_46_0/android/lib/
  </pre>
  
  <h2>5. Android.mk</h2>
  
  <pre>
  #   Howto
  #   http://source.android.com/porting/build_cookbook.html
  #
  
  LOCAL_PATH:= $(call my-dir)
  
  # ==============================================================
  # libudt
  # ==============================================================
  
  include $(CLEAR_VARS)
  LOCAL_MODULE            :=  libudt
  LOCAL_C_INCLUDES        +=  /cygdrive/d/Android/boost_1_46_0/
  LOCAL_SRC_FILES         +=  udt.cpp
  LOCAL_STATIC_LIBRARIES  :=  boost_thread-gcc-mt-s-1_46
  
  include $(BUILD_SHARED_LIBRARY)
  </pre>
  
  <h2>6. udt.cpp</h2>
  
  <pre>
  #include "boost/bind.hpp"
  #include "boost/thread.hpp"
  
  void thread_fn (int)
  {
  }
  
  extern "C" int func1 ()
  {
      boost::thread thrd (boost::bind (thread_fn, 1));
      thrd.join ();
      return 0;
  }
  
  </pre>
  
  <h2>7. $NDK/ndk-build</h2>
  
  <pre>
  Compile++ thumb  : udt  > > >':
  D:/Android/boost_1_46_0/boost/thread/detail/thread.hpp:204: undefined reference to `boost::thread::start_thread()'
  D:/Android/boost_link/obj/local/armeabi/objs/udt/udt.o: In function `func1':
  D:/Android/boost_link/jni/udt.cpp:19: undefined reference to `boost::thread::join()'
  D:/Android/boost_link/jni/udt.cpp:20: undefined reference to `boost::thread::~thread()'
  D:/Android/boost_link/jni/udt.cpp:20: undefined reference to `boost::thread::~thread()'
  D:/Android/boost_link/obj/local/armeabi/objs/udt/udt.o:(.data.rel.ro._ZTIN5boost6detail11thread_dataINS_3_bi6bind_tIvPFv
  iENS2_5list1INS2_5valueIiEEEEEEEE[typeinfo for boost::detail::thread_data > > >]+0x8): undefined reference to `typeinfo for boost::detail::thread_data_base'
  collect2: ld returned 1 exit status
  make: *** [/cygdrive/d/Android/boost_link/obj/local/armeabi/libudt.so] Error 1
  </pre>