[Android] [PATCH] android: build gnutls

Rafaël Carré funman at videolan.org
Sun Mar 4 22:10:07 CET 2012


Le 2012-03-04 04:31, 某因幡 a écrit :
> 2012/3/4 Rafaël Carré <funman at videolan.org>:
>> On Sat, 3 Mar 2012 21:28:36 +0800
>> 某因幡 <tewilove at gmail.com> wrote:
>>
>>> From 25d84d422ad961e2403ac0530baa599ebd36fcda Mon Sep 17 00:00:00 2001
>>> From: tewilove <tewilove at gmail.com>
>>> Date: Fri, 2 Mar 2012 23:27:45 -0800
>>> Subject: [PATCH] android: build gnutls
>>>
>>> ---
>>>  contrib/src/gnutls/no-create-time-h.patch |   11 +++++++++++
>>>  contrib/src/gnutls/rules.mak              |    9 +++++++--
>>>  2 files changed, 18 insertions(+), 2 deletions(-)
>>>  create mode 100644 contrib/src/gnutls/no-create-time-h.patch
>>>
>>> diff --git a/contrib/src/gnutls/no-create-time-h.patch b/contrib/src/gnutls/no-create-time-h.patch
>>> new file mode 100644
>>> index 0000000..ac6fe66
>>> --- /dev/null
>>> +++ b/contrib/src/gnutls/no-create-time-h.patch
>>> @@ -0,0 +1,11 @@
>>> +--- gnutls/lib/gl/Makefile.am        2011-04-07 17:30:44.000000000 -0700
>>> ++++ gnutls/lib/gl/Makefile.am        2012-03-02 19:51:53.576555217 -0800
>>> +@@ -891,7 +891,7 @@ EXTRA_DIST += sys_stat.in.h
>>> +
>>> + ## begin gnulib module time
>>> +
>>> +-BUILT_SOURCES += time.h
>>> ++#BUILT_SOURCES += time.h
>>> +
>>> + # We need the following in order to create <time.h> when the system
>>> + # doesn't have one that works with the given compiler.
>>> diff --git a/contrib/src/gnutls/rules.mak b/contrib/src/gnutls/rules.mak
>>> index 1e12fc4..12292f4 100644
>>> --- a/contrib/src/gnutls/rules.mak
>>> +++ b/contrib/src/gnutls/rules.mak
>>> @@ -19,7 +19,7 @@ ifdef HAVE_WIN32
>>>       $(APPLY) $(SRC)/gnutls/gnutls-win32.patch
>>>  endif
>>>  ifdef HAVE_ANDROID
>>> -     $(APPLY) $(SRC)/gnutls/no-gl.patch
>>
>> What is the problem with the current patch?
>> It skips gl/ entirely while your patch only avoids 2 headers.
>>
>> I am not sure if I tested https but gnutls builds fine already.
>>
> 
> Yes it builds fine but when --enable-gcrypt is specified the android
> build is not linking, already add gnutls and dependencies to LDFLAGS
> in Android.mk, saying some functions (appears in gnutls/lib/gl) cannot
> be found.

gnutls/lib/gl should be skipped entirely and libraries should not link
to it, perhaps you have an old build of gnutls ?

I just try and linking works,

Here is my diff for android:

diff --git a/vlc-android/jni/Android.mk b/vlc-android/jni/Android.mk
index 9fe7b28..4e09b31 100644
--- a/vlc-android/jni/Android.mk
+++ b/vlc-android/jni/Android.mk
@@ -31,7 +31,7 @@ LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
 	-lavformat -lavcodec -lswscale -lavutil -lpostproc -lgsm -lopenjpeg \
 	-lliveMedia -lUsageEnvironment -lBasicUsageEnvironment -lgroupsock \
 	-lspeex -lspeexdsp \
-	-lxml2 -lpng \
+	-lxml2 -lpng -lgnutls -lgcrypt -lgpg-error -llua \
 	$(CPP_STATIC)

 include $(BUILD_SHARED_LIBRARY)

And for vlc:

diff --git a/extras/package/android/configure.sh
b/extras/package/android/configure.sh
index fe687d7..fccb8f2 100755
--- a/extras/package/android/configure.sh
+++ b/extras/package/android/configure.sh
@@ -14,7 +14,7 @@
LDFLAGS="-Wl,-Bdynamic,-dynamic-linker=/system/bin/linker
-Wl,--no-undefined"

 if [ -z "$NO_NEON" ]; then
     CXX_TARGET="armeabi-v7a"
-    CFLAGS="$CFLAGS -mfpu=neon -march=armv7-a -mtune=cortex-a8
-mfloat-abi=softfp -ftree-vectorize -mvectorize-with-neon-quad
-funsafe-math-optimizations"
+    CFLAGS="$CFLAGS -mfpu=neon -march=armv7-a -mtune=cortex-a8
-mfloat-abi=softfp -ftree-vectorize -mvectorize-with-neon-quad
-funsafe-math-optimizations -mthumb -mthumb-interwork"
     LDFLAGS="$LDFLAGS -Wl,--fix-cortex-a8"
     EXTRA_PARAMS=" --enable-neon"
 else
@@ -40,6 +40,7 @@ NM="${CROSS_COMPILE}nm" \
 STRIP="${CROSS_COMPILE}strip" \
 RANLIB="${CROSS_COMPILE}ranlib" \
 AR="${CROSS_COMPILE}ar" \
+PKG_CONFIG_PATH="" \
 sh $VLC_SOURCEDIR/configure --host=arm-linux-androideabi
--build=x86_64-unknown-linux $EXTRA_PARAMS \
                 --enable-live555 --enable-realrtsp \
                 --enable-avformat \
@@ -53,8 +54,7 @@ sh $VLC_SOURCEDIR/configure
--host=arm-linux-androideabi --build=x86_64-unknown-
                 --disable-vlc --disable-shared \
                 --disable-vlm --disable-sout \
                 --disable-dbus \
-                --disable-lua \
-                --disable-libgcrypt \
+                --enable-lua \
                 --disable-vcd \
                 --disable-v4l2 \
                 --disable-gnomevfs \
@@ -100,4 +100,5 @@ sh $VLC_SOURCEDIR/configure
--host=arm-linux-androideabi --build=x86_64-unknown-
                 --disable-goom \
                 --disable-projectm \
                 --enable-iomx \
+                --enable-gnutls \
                 $*


I have enabled lua and thumb code but it shoudln't matter.


Can you paste your diff and the linking error ?

Also you can force rebuilding only gnutls by cd contrib/android; rm -fr
gnutls; make -j4 .gnutls


More information about the Android mailing list