Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid NDK: Including boost c++ library
    text
    copied!<p>I am trying to use a boost library inside my android application, using the NDK. I have found a couple of success stories <a href="http://www.codexperiments.com/android/2011/05/tips-tricks-building-boost-with-ndk-r5/comment-page-1/#comment-336" rel="nofollow noreferrer">here</a> and <a href="https://stackoverflow.com/questions/4882714/port-boost-to-android/4883976#4883976">here</a>, but I can't say the same about me. I am specifically trying to use the library in <a href="http://www.boost.org/doc/libs/1_35_0/libs/math/doc/sf_and_dist/html/math_toolkit/toolkit/internals1/roots2.html" rel="nofollow noreferrer">this link</a>, as well as the boost thread library. In the code below, I am only trying to include the thread library, not the math library. The process I used to build the boost libraries is pretty much the same as the first link I attached.</p> <p>So far, it seems I have successfully built the boost libraries, but when I run <code>ndk-build</code>, I get the following error:</p> <pre><code>Prebuilt : libboost_thread.a &lt;= &lt;NDK&gt;/sources/ cp: omitting directory `path/to/ndk/sources/boost' make: *** [obj/local/armeabi/libboost_thread.a] Error 1 </code></pre> <p>Obviously the <code>cp: omitting directory...</code> is not exactly an error. But the only thing I'm getting other than that is the next line, which doesn't really mean anything. <code>Error 1</code></p> <p>Here's my Android.mk file:</p> <pre><code>LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_STATIC_LIBRARIES := boost_thread LOCAL_LDLIBS := lboost_system-gcc-md lboost_thread-gcc-md -lgnustl_static LOCAL_LDLIBS += lboost_system-gcc-md lboost_thread-gcc-md \ -L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi \ -lgnustl_static LOCAL_SRC_FILES := #cpp_sources LOCAL_MODULE := com_example_ndkFile_CppMethods include $(BUILD_SHARED_LIBRARY) $(call import-module,boost) </code></pre> <p>And there's also an Android.mk file in <code>path/to/ndk/sources/boost/</code>:</p> <pre><code>LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE:= boost_thread LOCAL_SRC_FILES:= android/lib/libboost_thread.a LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) include $(PREBUILT_STATIC_LIBRARY) </code></pre> <p>And my humble Application.mk file:</p> <pre><code>APP_ABI := armeabi armeabi-v7a APP_STL := gnustl_static APP_CPPFLAGS = -fexceptions </code></pre> <p>I built the boost libraries using <code>bjam</code>. All of the <code>libboost_###.a</code> files are in the <code>sources/boost/android/lib</code> folder.</p> <p>What is the error I'm getting?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload