From 89fbc2e73b78fb7aaaf3cfbe95185d5f8f1e3cf1 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 7 Aug 2013 23:29:05 +0200 Subject: Fix compiling with Android NDK r9 --- doc/README.txt | 2 +- jni/Android.mk | 2 +- jni/Application.mk | 7 ++++--- jni/dummy.cpp | 8 ++++++++ src/de/blinkt/openvpn/core/NativeUtils.java | 1 + src/de/blinkt/openvpn/core/OpenVpnManagementThread.java | 7 +------ 6 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 jni/dummy.cpp diff --git a/doc/README.txt b/doc/README.txt index 7dac5c05..d3b385ab 100644 --- a/doc/README.txt +++ b/doc/README.txt @@ -10,7 +10,7 @@ svn co http://google-breakpad.googlecode.com/svn/trunk/ google-breakpad - Install sdk -- Install ndk (Versions 8c+ give strange linker errors, use 8b for now) +- Install ndk (Version r9 is tested and used by me) - Make sure that ndk-build is in your build path. Do ./misc/build-native.(sh|bat) in the root directory of the project. diff --git a/jni/Android.mk b/jni/Android.mk index ab989813..58cfa757 100644 --- a/jni/Android.mk +++ b/jni/Android.mk @@ -36,7 +36,7 @@ include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_LDLIBS := -lz -lc LOCAL_SHARED_LIBRARIES := libssl libcrypto openvpn -LOCAL_SRC_FILES:= minivpn.c +LOCAL_SRC_FILES:= minivpn.c dummy.cpp LOCAL_MODULE = minivpn include $(BUILD_EXECUTABLE) diff --git a/jni/Application.mk b/jni/Application.mk index 5670b6e3..b69669ac 100644 --- a/jni/Application.mk +++ b/jni/Application.mk @@ -1,7 +1,8 @@ APP_ABI := all -NDK_TOOLCHAIN_VERSION=4.4.3 -#APP_PLATFORM := android-14 -APP_STL:=stlport_static +APP_PLATFORM := android-14 + +APP_STL:=stlport_shared +#APP_STL:=gnustl_shared #APP_OPTIM := release diff --git a/jni/dummy.cpp b/jni/dummy.cpp new file mode 100644 index 00000000..58466656 --- /dev/null +++ b/jni/dummy.cpp @@ -0,0 +1,8 @@ +/*#include +#include + +void dummy() +{ + std::cout << "I am a dummy function to help compile on Android NDK r9" << std::endl; +} +*/ diff --git a/src/de/blinkt/openvpn/core/NativeUtils.java b/src/de/blinkt/openvpn/core/NativeUtils.java index 42d0b583..a2c4796d 100644 --- a/src/de/blinkt/openvpn/core/NativeUtils.java +++ b/src/de/blinkt/openvpn/core/NativeUtils.java @@ -7,6 +7,7 @@ public class NativeUtils { static native void jniclose(int fdint); static { + System.loadLibrary("stlport_shared"); System.loadLibrary("opvpnutil"); } } diff --git a/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java index 2cb6dfe3..e2ac1526 100644 --- a/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java +++ b/src/de/blinkt/openvpn/core/OpenVpnManagementThread.java @@ -92,11 +92,6 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement { } - - static { - System.loadLibrary("opvpnutil"); - } - public void managmentCommand(String cmd) { if(mSocket!=null) { try { @@ -162,7 +157,7 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement { private void protectFileDescriptor(FileDescriptor fd) { Exception exp; try { - Method getInt = FileDescriptor.class.getDeclaredMethod("getInt$"); + Method getInt = FileDescriptor.class.getDeclaredMethod("getInt$"); int fdint = (Integer) getInt.invoke(fd); // You can even get more evil by parsing toString() and extract the int from that :) -- cgit v1.2.3