2017-06-12 54 views
0

我想讓OpenMP與VLC(Android版本)一起工作,但沒有成功。在VLC中集成OpenMP

所建議的谷歌,我已將此添加到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

W hich編譯器(版本)?你在哪個操作系統中編譯? –

+0

操作系統是Ubuntu 16.04,我將make文件添加到我的文章中。謝謝。 – RonTLV

+0

我在發佈的makefile中看不到'LOCAL_LDFLAGS + = -fopenmp',與'LOCAL_CFLAGS + = -fopenmp'一樣,只有分配(':=')比想要的更好? – purplepsycho

回答

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