Fix libgmp for Android
authorest31 <MTest31@outlook.com>
Fri, 15 May 2015 03:02:19 +0000 (05:02 +0200)
committerest31 <MTest31@outlook.com>
Fri, 15 May 2015 03:08:59 +0000 (05:08 +0200)
Android terminated immediately after start since commit
181f7baa453c58d4070de7196fd74663110946a8
because library wasn't loaded, and libminetest.so required
libgmp.so.10 instead of libgmp.so.

The second issue has been solved by the linker flags.

build/android/Makefile
build/android/src/net/minetest/minetest/MtNativeActivity.java

index 898968bed537f7f6db13d3ca214ff0ae23b5412e..b11d739720dcad52d973f46dd28fff67d48ae1e2 100644 (file)
@@ -120,7 +120,7 @@ CURL_URL_HTTP = http://curl.haxx.se/download/curl-${CURL_VERSION}.tar.bz2
 
 GMP_VERSION = 6.0.0
 GMP_DIR = $(ROOT)/deps/gmp-$(GMP_VERSION)
-GMP_LIB = $(GMP_DIR)/usr/lib/libgmp.la
+GMP_LIB = $(GMP_DIR)/usr/lib/libgmp.so
 GMP_TIMESTAMP = $(GMP_DIR)/timestamp
 GMP_TIMESTAMP_INT = $(ROOT)/deps/gmp_timestamp
 GMP_URL_HTTP = https://gmplib.org/download/gmp/gmp-$(GMP_VERSION).tar.bz2
@@ -602,6 +602,8 @@ $(GMP_LIB): $(GMP_TIMESTAMP)
        export PATH="$${TOOLCHAIN}/bin:$${PATH}";                                  \
        export CC=${CROSS_PREFIX}gcc;                                              \
        export CXX=${CROSS_PREFIX}g++;                                             \
+       export LIBGMP_LDFLAGS="-avoid-version";                                    \
+       export LIBGMPXX_LDFLAGS="-avoid-version";                                  \
        ./configure --disable-static --host=${TARGET_HOST} --prefix=/usr;          \
        $(MAKE) install DESTDIR=/${GMP_DIR} || exit 1;                             \
        touch ${GMP_TIMESTAMP};                                                    \
index 2bfcef93c287337721ffc72c4aa6ea188211952f..5c1f44d17624406c6923f75a4513d20d62de1a65 100644 (file)
@@ -86,6 +86,12 @@ public class MtNativeActivity extends NativeActivity {
                System.loadLibrary("vorbis");
                System.loadLibrary("ssl");
                System.loadLibrary("crypto");
+               System.loadLibrary("gmp");
+
+               // We don't have to load libminetest.so ourselves,
+               // but if we do, we get nicer logcat errors when
+               // loading fails.
+               System.loadLibrary("minetest");
        }
        
        private int m_MessagReturnCode;