Official Boost library support for Android and iOS?

This question is a continuation. Should I choose Boost Asio or Aysnc Socket streams in Android? asked

Boost libraries are intended for widespread use and can be used in a wide range of applications, but so far there is no official support for Android and iOS

  • Is there any specific reason compared to what is not optimized for embedded devices? Or any other reason?
  • Does any body mean any application created using Boost on Android or iOS?
  • Is it advisable to use boost libraries for an intensive application on the network that generates multi-threaded threads for trade-offs?

FYI .. I used the following links to create an example Android application, but so far failed :(

https://github.com/MysticTreeGames/Boost-for-Android

http://www.codexperiments.com/android/2011/05/tips-tricks-building-boost-with-ndk-r5/

Enable Boost C ++ library in android

How to use boost library (including shared_ptr) with Android NDK and STLport

https://sites.google.com/site/fourdollars/android/android-mk

https://groups.google.com/forum/?fromgroups=#!topic/android-ndk/4lxhsKFe7Ho

http://www.crystax.net/trac/ndk/ticket/6

Android NDK R5 and C ++ exception support

Thanks in advance.

+43
android boost ios android-ndk boost-asio
Dec 26 '12 at 5:24
source share
4 answers

Got a response from the developer community. Yes. These platforms are not officially supported because no one has volunteered to regularly conduct regression tests for them.

Boost developer cannot be tested on all platforms. So developers are dependent on the test results of regression tests performed by volunteers. For example, see http://beta.boost.org/development/tests/trunk/developer/summary.html

If no one voluntarily runs tests for a specific platform, this platform is not officially supported.

So, if you want Android or iOS to be officially supported, start regular (preferably daily) regression tests for Boost. See http://beta.boost.org/development/running_regression_tests.html

+23
Dec 27 '12 at 12:17
source share

Check out my cross-platform github tutorial. It shows how to configure Boost and use it between iOS and Android. I had such a terrible time with this, I believe that I will document it so that no one else can understand it. You will notice that this project also uses several other common elements used between the two platforms, for example, CoreFoundation and SQLite.

https://github.com/markshiz/cross-platform-tutorial

Note. My tutorial does not show how to create compiled libraries to enhance. I did this successfully using the instructions you provided:

http://www.codexperiments.com/android/2011/05/tips-tricks-building-boost-with-ndk-r5/

Once you have a static library compiled using the Android include/[NAME OF NEW SUBMODULE] , you can easily link it through a module similar to the include/[NAME OF NEW SUBMODULE] project above. For the Android.mk file in the root of this directory, use something similar to the following:

 include $(CLEAR_VARS) LOCAL_MODULE:= boost_regex LOCAL_SRC_FILES:= ./path/to/built/static/library/libboost_regex-gcc-mt-sa LOCAL_EXPORT_C_INCLUDES := ./path/to/the/directory/that/has/the/boost/headers include $(PREBUILT_STATIC_LIBRARY) 

Finally, import this module, as in the example, inside

 $(call import-module,[NAME OF NEW SUBMODULE]) 

For all other questions - do you know about an application that uses Boost on iOS and Android? Yes, I have done this several times with success and released working applications on the App Store.

Your other question, is it appropriate to use boost for network communication? I'm not sure what you mean here. From what angle? Do you mean philosophically, technically, etc.?

Philosophically, you should ask yourself what are your arguments for importing this library and using it between Android and iOS. It saves code time, maintenance load. If so, I would say that this is a great way to do this. It is clear that there are some obstacles and pain to get such a job. In addition, the IDE features for C ++ are not as great as for Java in Eclipse. I try to be fair and balanced in the presentation of the PDF in the doc/ directory. Give it once.

From a technical point of view, I think that the only thing that bothers me is to make sure that I clean Asio objects correctly when activity is stopped. If you need to do something in the background, use the service instead:

http://developer.android.com/reference/android/app/Service.html

+14
Jan 01 '13 at 18:09
source share

UPDATE:. Apparently, the problem is related to std :: atomic on Android, and since Boost.Asio uses it (by default), in combination with threads, one of them sometimes stalled. Fortunately, Boost.Asio simplifies the transition from Std.Atomic to Boost.Atomic, and this was taken care of in the Boost-for-Android project this commit .

See here for more error information.




We are developing a simple multiplayer game (not yet released) for Android using boost asio, and so far we have not had any problems. This is for question number 2.

What problems do you see?

If the problems are related to compilation and linking, these tips may be useful.

Add the following to your AndroidManifest.xml file:

 <uses-permission android:name="android.permission.INTERNET"></uses-permission> 

Have this in your Application.mk file:

 APP_STL := gnustl_static APP_CPPFLAGS += -frtti -fexceptions 

And use this as a template for your Android.mk file:

 LOCAL_PATH := $(call my-dir) BOOST_VERSION := 1_49 PROJECT_ROOT := $(LOCAL_PATH)/../../../.. BOOST_INCLUDE_PATH := /path/to/boost/headers BOOST_LIB_PATH := /path/to/boost/libraries # Path and name of the STL library. Add this to the *end* of LOCAL_LDLIBS. # Note this is a hack/workaround to prevent linker errors when compiling with # boost. STL_LIBS := -L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi \ -lgnustl_static include $(CLEAR_VARS) LOCAL_MODULE := native-activity LOCAL_C_INCLUDES:= $(BOOST_INCLUDE_PATH) \ $(PROJECT_ROOT)/src \ $(PROJECT_ROOT)/platform/android/jni LOCAL_SRC_FILES := main.cpp LOCAL_LDLIBS := -llog -landroid # The order of these libraries is often important. LOCAL_LDLIBS += -L$(BOOST_LIB_PATH) \ -lboost_system-gcc-mt-$(BOOST_VERSION) \ -lboost_thread-gcc-mt-$(BOOST_VERSION) \ $(STL_LIBS) LOCAL_STATIC_LIBRARIES := android_native_app_glue include $(BUILD_SHARED_LIBRARY) $(call import-module,android/native_app_glue) 

EDIT: How we are stepping up Android support. This is what we have in our Makefile:

 git clone git://github.com/madadam/Boost-for-Android.git ./build-android.sh --boost=1.49.0 --with-libraries=chrono,program_options,system,thread /path/to/ndk 

Please note that we use our own version of Boost-for-Android, this is only because it has a patch for the latest version of NDK r8d. We can also see from the command line that we are using upgrade version 1.49, which is currently the highest supported by Boost-for-Android.

If you want to know which Boost and Android NDK combinations are supported, check out the Boost-for-Android project. It contains directories called patches / boost - < X > / ndk-android < Y >, where X corresponds to the supported version of boost and Y to the supported version of NDK (shameless plugin: our 2 cents to the project :-)).

+11
Dec 30 '12 at 10:31
source share

Below is another (very useful) information received from the boost community:

  • Is there any specific reason for this (for example, not optimized for embedded devices)? Or any other reason?

Boost works great on Android. Since there is an NDK (proprietary development kit) with pretty decent gcc (4.6) you just need to configure boost build to use the right gcc. Although this all works, it takes a little to properly configure the settings. But then again, in principle, there is not much difference in creating Boost for Android or any other Linux distribution.

  1. Are there (generally) any known problems if we use boost libraries for network and thread synchronization for Smartphone development applications? Would it be nice to use BOOST ASIO for the same?

It is perfectly normal to use Boost.Thread or Boost.Asio. They work great on ARM devices. There is even support for more platform-specific hackers such as boost.atomic and boost.context.

FYI - found links https://github.com/MysticTreeGames/Boost-for-Android http://www.codexperiments.com/android/2011/05/tips-tricks-building-boost-with-ndk-r5/

Boosting growth with the Android NDK is even easier than boost.build directly. I put together a bunch of Android build scripts that can be found here: https://github.com/STEllAR-GROUP/HPXAndroid/tree/master/modules Look at boost _ $ {module} for various boost libraries. This is not a complete list. Just what I need. In addition, you may need a love of 1.53. All different libraries did not need special treatment with the android (modulo some minor errors when the compiler did not agree with other versions of gcc)

I hope it will be useful for others too! Thank!

+9
Jan 03 '13 at 12:17
source share



All Articles