在VLC中集成OpenMP

时间:2017-06-12 14:02:20

标签: android openmp vlc

我正在尝试使用VLC(Android版本)使OpenMP工作,但没有成功。

根据Google的建议,我将其添加到Android.mk(/ vlc-android / libvlc / jni)文件中:

LOCAL_CFLAGS += -fopenmp
LOCAL_LDFLAGS += -fopenmp

但我一直在接受:

error: undefined reference to 'omp_set_num_threads'
error: undefined reference to 'omp_get_thread_num'
error: undefined reference to 'omp_get_num_threads'

我想知道是否有人可以帮助我克服这个错误。

Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libvlc
ARCH=$(APP_ABI)
LOCAL_SRC_FILES += libvlcjni-modules.c libvlcjni-symbols.c dummy.cpp
LOCAL_LDFLAGS := -L$(VLC_CONTRIB)/lib
LOCAL_LDLIBS := \
    $(VLC_MODULES) \
    $(VLC_BUILD_DIR)/lib/.libs/libvlc.a \
    $(VLC_BUILD_DIR)/src/.libs/libvlccore.a \
    $(VLC_BUILD_DIR)/compat/.libs/libcompat.a \
    $(VLC_CONTRIB_LDFLAGS) \
    -ldl -lz -lm -llog \
    -lliveMedia -lUsageEnvironment -lBasicUsageEnvironment -lgroupsock \
    -la52 -ljpeg \
    -lavcodec -lebml \
    -llua \
    -lgcrypt -lgpg-error \
    $(VLC_LDFLAGS)

include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := libvlcjni

LOCAL_SRC_FILES := libvlcjni.c
LOCAL_SRC_FILES += libvlcjni-mediaplayer.c
LOCAL_SRC_FILES += libvlcjni-vlcobject.c
LOCAL_SRC_FILES += libvlcjni-media.c libvlcjni-medialist.c libvlcjni-mediadiscoverer.c
LOCAL_SRC_FILES += libvlcjni-dialog.c
LOCAL_SRC_FILES += thumbnailer.c
LOCAL_SRC_FILES += std_logger.c

LOCAL_LDLIBS := -llog
LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/include

ARCH=$(APP_ABI)

LOCAL_CFLAGS := -std=c11
ifeq ($(ARCH), armeabi-v7a)
    LOCAL_CFLAGS += -DHAVE_ARMEABI_V7A
endif

LOCAL_SHARED_LIBRARIES:= libvlc

include $(BUILD_SHARED_LIBRARY)

1 个答案:

答案 0 :(得分:0)

对于未来的用户,我设法通过添加:

来解决这个问题
LOCAL_CFLAGS := -std=c99 -fopenmp

和-lgomp到LOCAL_LDLIBS:

LOCAL_LDLIBS := \
    $(VLC_MODULES) \
    $(VLC_BUILD_DIR)/lib/.libs/libvlc.a \
    $(VLC_BUILD_DIR)/src/.libs/libvlccore.a \
    $(VLC_BUILD_DIR)/compat/.libs/libcompat.a \
    $(VLC_CONTRIB_LDFLAGS) \
    -ldl -lz -lm -llog \
    -lliveMedia -lUsageEnvironment -lBasicUsageEnvironment -lgroupsock \
    -la52 -ljpeg \
    -lavcodec -lebml \
    -llua -lgomp \
    -lgcrypt -lgpg-error \
    $(VLC_LDFLAGS)

参考:OpenMP library specification