4

Asio (without Boost) is supposed to be usable with just the headers only right?

By default, Asio is a header-only library. (http://think-async.com)

I understand that internally Asio still depends on Boost.

This is my setup.

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE        := gatelib
LOCAL_SRC_FILES     := gatelib.cpp
LOCAL_C_INCLUDES    += /cygdrive/l/asio-1.5.3/include
LOCAL_C_INCLUDES    += /cygdrive/l/boost/boost_1_49_0

include $(BUILD_SHARED_LIBRARY)

Application.mk

APP_STL := stlport_static
APP_CFLAGS += -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB

gatelib.cpp

#include <jni.h>
#include <asio.hpp>

#ifdef __cplusplus
extern "C" 
{
#endif
    // rest of code ...

#ifdef __cplusplus
}
#endif

Build script

@echo on

@set BASHPATH="L:\cygwin\bin\bash"
@set PROJECTDIR="/cygdrive/l/AsioAndroid/AsioDemo"
@set NDKDIR="/cygdrive/l/android-ndk-r8c/ndk-build"

%BASHPATH% --login -c "cd %PROJECTDIR% && %NDKDIR%

@pause:

Output

http://pastebin.com/XiJjvNmp

So basically, what I am trying to achieve is, get Asio working on Android (via NDK). Yes, just Asio itself, not the Asio included with Boost. The problems are presented in the output. I have no clue at all..

PS. There's no Asio tag, so I guess Boost-Asio tag will have to do for now.

Sam Miller
  • 23,808
  • 4
  • 67
  • 87
ains
  • 1,436
  • 4
  • 18
  • 33

1 Answers1

5

Here's what I did.

Application.mk

APP_STL := gnustl_static
APP_CFLAGS += -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB
APP_CPPFLAGS += -fexceptions

The clues and hints were all over Stack Overflow. Once pieced together, it worked!

Sam Miller
  • 23,808
  • 4
  • 67
  • 87
ains
  • 1,436
  • 4
  • 18
  • 33