Kevin Parker
Kevin Parker

Reputation: 17206

Problems compiling VLC for Android - libvlcjni.so

After a day and a half of modification I've finally gotten the VLC project to almost compile under OS X. I get the following error when its just about to link libvlcjni.so. There are roughly 100 more undefined references, but most are to few functions:

std::__stl_throw_length_error(char const*) std::__node_alloc::_M_deallocate(void*, unsigned int)

Has anyone got any pointers?

Compile thumb : vlcjni <= aout.c Compile thumb : vlcjni <= pthread-condattr.c Compile thumb : vlcjni <= pthread-rwlocks.c Compile thumb : vlcjni <= eventfd.c Compile thumb : vlcjni <= sem.c SharedLibrary : libvlcjni.so ../vlc/android/modules/demux/mkv/.libs/libmkv_plugin.a(libmkv_plugin_la-mkv.o): In function std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_compare(char const*, char const*, char const*, char const*)': /Android/ndk/sources/cxx-stl/stlport/stlport/stl/_string.h:1076: undefined reference tostd::__stl_throw_out_of_range(char const*)'

Application.mk

APP_PLATFORM := android-9
ifeq ($(NO_NEON),)
APP_ABI := armeabi-v7a
else ifneq ($(TEGRA2),)
APP_ABI := armeabi-v7a
else
APP_ABI := armeabi
endif

APP_STL := gnustl_static
APP_PLATFORM := android-9
APP_ABI := armeabi-v7a

Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

ifeq ($(NO_NEON),)
ARCH=armeabi-v7a
LOCAL_MODULE    := libvlcjni
else ifneq ($(TEGRA2),)
ARCH=armeabi-v7a
LOCAL_MODULE    := libvlcjni-tegra2
else
ARCH=armeabi
LOCAL_MODULE    := libvlcjni
endif

LOCAL_SRC_FILES := libvlcjni_danmaku.c aout.c pthread-condattr.c pthread-rwlocks.c eventfd.c sem.c

LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/include

ifeq ($(NO_NDK_V7),1)
CPP_STATIC=$(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/libs/$(ARCH)/libstdc++.a
else
CPP_STATIC=$(ANDROID_NDK)/sources/cxx-stl/stlport/libs/$(ARCH)/libstlport_static.a
endif

LOCAL_CFLAGS := -std=gnu99
LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
    $(VLC_MODULES) \
    $(VLC_BUILD_DIR)/lib/.libs/libvlc.a \
    $(VLC_BUILD_DIR)/src/.libs/libvlccore.a \
    $(VLC_BUILD_DIR)/compat/.libs/libcompat.a \
    -ldl -lz -lm -llog \
    -ldvbpsi -lebml -lmatroska -ltag \
    -logg -lFLAC -ltheora \
    -lmpeg2 -ldca -la52 \
    -lavformat -lavcodec -lswscale -lavutil -lpostproc -lgsm -lopenjpeg \
    -lliveMedia -lUsageEnvironment -lBasicUsageEnvironment -lgroupsock \
    -lspeex -lspeexdsp \
    -lxml2 -lpng -lgnutls -lgcrypt -lgpg-error -lfreetype -liconv \
    $(CPP_STATIC) 

include $(BUILD_SHARED_LIBRARY)


include $(CLEAR_VARS)

LOCAL_MODULE     := libiomx-gingerbread
LOCAL_SRC_FILES  := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/modules/codec/omxil $(ANDROID_SYS_HEADERS_GINGERBREAD)/frameworks/base/include $(ANDROID_SYS_HEADERS_GINGERBREAD)/system/core/include
LOCAL_LDLIBS     := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder

include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE     := libiomx-hc
LOCAL_SRC_FILES  := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/modules/codec/omxil $(ANDROID_SYS_HEADERS_HC)/frameworks/base/include $(ANDROID_SYS_HEADERS_HC)/frameworks/base/native/include $(ANDROID_SYS_HEADERS_HC)/system/core/include $(ANDROID_SYS_HEADERS_HC)/hardware/libhardware/include
LOCAL_LDLIBS     := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder

include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE     := libiomx-ics
LOCAL_SRC_FILES  := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/modules/codec/omxil $(ANDROID_SYS_HEADERS_ICS)/frameworks/base/include $(ANDROID_SYS_HEADERS_ICS)/frameworks/base/native/include $(ANDROID_SYS_HEADERS_ICS)/system/core/include $(ANDROID_SYS_HEADERS_ICS)/hardware/libhardware/include
LOCAL_LDLIBS     := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder

include $(BUILD_SHARED_LIBRARY)

Upvotes: 2

Views: 3952

Answers (1)

Viktor Latypov
Viktor Latypov

Reputation: 14467

Try to include these lines into your Application.mk:

APP_CPPFLAGS += -frtti 
APP_CPPFLAGS += -fexceptions

You have to explicitly enable the RTTI and Exceptions handling.

EDIT (response to your modifications):

# These are your lines in Application.mk
APP_PLATFORM := android-9
ifeq ($(NO_NEON),)
APP_ABI := armeabi-v7a
else ifneq ($(TEGRA2),)
APP_ABI := armeabi-v7a
else
APP_ABI := armeabi
endif

# Add these lines:
APP_CPPFLAGS += -frtti 
APP_CPPFLAGS += -fexceptions
#  I haven't seen them

Upvotes: 2

Related Questions