[Android] [PATCH 8/8] contrib: Prevent __gxx_personality_v0 errors in certain C++ libs

Edward Wang edward.c.wang at compdigitec.com
Wed Jul 25 04:51:47 CEST 2012


Modplug and taglib refuse to compile without explicitly disabling exceptions:

CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o:(.data.DW.ref.__gxx_personality_v0[DW.ref.__gxx_personality_v0]+0x0):
  undefined reference to `__gxx_personality_v0'
---
 contrib/src/modplug/rules.mak |   10 +++++++++-
 contrib/src/taglib/rules.mak  |   10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/contrib/src/modplug/rules.mak b/contrib/src/modplug/rules.mak
index 674ae7f..33a444c 100644
--- a/contrib/src/modplug/rules.mak
+++ b/contrib/src/modplug/rules.mak
@@ -19,7 +19,15 @@ libmodplug: libmodplug-$(MODPLUG_VERSION).tar.gz .sum-modplug
 	$(call pkg_static,"libmodplug.pc.in")
 	$(MOVE)
 
+MODPLUG_EXTRA_CXXFLAGS = ""
+ifdef HAVE_ANDROID
+ifeq ($(ANDROID_ABI), x86)
+# Prevent undefined reference to `__gxx_personality_v0'
+MODPLUG_EXTRA_CXXFLAGS = CXXFLAGS="${CXXFLAGS} -frtti -fno-exceptions"
+endif
+endif
+
 .modplug: libmodplug
-	cd $< && $(HOSTVARS) ./configure $(HOSTCONF)
+	cd $< && $(HOSTVARS) $(MODPLUG_EXTRA_CXXFLAGS) ./configure $(HOSTCONF)
 	cd $< && $(MAKE) install
 	touch $@
diff --git a/contrib/src/taglib/rules.mak b/contrib/src/taglib/rules.mak
index c3ccfb8..ead0c73 100644
--- a/contrib/src/taglib/rules.mak
+++ b/contrib/src/taglib/rules.mak
@@ -20,8 +20,16 @@ ifdef HAVE_WIN32
 endif
 	$(MOVE)
 
+TAGLIB_EXTRA_CXXFLAGS = ""
+ifdef HAVE_ANDROID
+ifeq ($(ANDROID_ABI), x86)
+# Prevent undefined reference to `__gxx_personality_v0'
+TAGLIB_EXTRA_CXXFLAGS = CXXFLAGS="${CXXFLAGS} -fno-exceptions"
+endif
+endif
+
 .taglib: taglib toolchain.cmake
-	cd $< && $(HOSTVARS_PIC) $(CMAKE) \
+	cd $< && $(HOSTVARS_PIC) $(TAGLIB_EXTRA_CXXFLAGS) $(CMAKE) \
 		-DENABLE_STATIC:BOOL=ON \
 		-DWITH_ASF:BOOL=ON \
 		-DWITH_MP4:BOOL=ON .
-- 
1.7.5.4



More information about the Android mailing list