leetaizhu / libyuv

Automatically exported from code.google.com/p/libyuv
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

How can I Build libyuv so for Android x86 ? #402

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I want build libyuv so on android .
armeabi-v7a and armeabi-v8a have succeed,but for x86 will link failed.
I use NDK r10-d,and GCC 4.9.

Below is my andoird.mk and errors:

LOCAL_PATH := $(call my-dir)

common_SRC_FILES := \
    source/compare.cc                   \
    source/compare_common.cc            \
    source/convert.cc                   \
    source/convert_argb.cc              \
    source/convert_from.cc              \
    source/convert_from_argb.cc         \
    source/convert_jpeg.cc              \
    source/convert_to_argb.cc           \
    source/convert_to_i420.cc           \
    source/cpu_id.cc                    \
    source/format_conversion.cc         \
    source/mjpeg_decoder.cc             \
    source/mjpeg_validate.cc            \
    source/planar_functions.cc          \
    source/rotate.cc                    \
    source/rotate_argb.cc               \
    source/row_any.cc                   \
    source/row_common.cc                \
    source/scale.cc                     \
    source/scale_argb.cc                \
    source/scale_common.cc              \
    source/video_common.cc            

common_CFLAGS := -fexceptions

ifeq ($(TARGET_ARCH_ABI), x86)

endif

common_C_INCLUDES = $(LOCAL_PATH)/include

include $(CLEAR_VARS)
LOCAL_MODULE:= libyuv
LOCAL_CPP_EXTENSION := .cc
LOCAL_SRC_FILES := $(common_SRC_FILES)
LOCAL_CFLAGS += $(common_CFLAGS)
LOCAL_LDFLAGS += $(common_LDFLAGS)
LOCAL_C_INCLUDES += $(common_C_INCLUDES)

include $(BUILD_SHARED_LIBRARY)

Below is the errors:

jni/source/compare.cc:168: error: undefined reference to 'SumSquareError_SSE2'
jni/source/convert.cc:286: error: undefined reference to 'SplitUVRow_SSE2'
jni/source/convert.cc:294: error: undefined reference to 'SplitUVRow_AVX2'
jni/source/convert.cc:198: error: undefined reference to 'CopyRow_AVX'
jni/source/convert.cc:203: error: undefined reference to 'CopyRow_ERMS'
jni/source/convert.cc:286: error: undefined reference to 'SplitUVRow_SSE2'
jni/source/convert.cc:193: error: undefined reference to 'CopyRow_SSE2'
jni/source/convert.cc:198: error: undefined reference to 'CopyRow_AVX'
jni/source/convert.cc:424: error: undefined reference to 'CopyRow_AVX'
jni/source/convert.cc:429: error: undefined reference to 'CopyRow_ERMS'
jni/source/convert.cc:429: error: undefined reference to 'CopyRow_ERMS'
........

Do you have any idea ? Is there something wrong with the android.mk?

Original issue reported on code.google.com by happyjor...@gmail.com on 11 Feb 2015 at 1:44

GoogleCodeExporter commented 9 years ago
I'm not set up to test this locally, but will update android.mk with the 
current lst of files at least.

First change:
SumSquareError_SSE2 is from compare_posix.cc
Add that.

Original comment by fbarch...@google.com on 11 Feb 2015 at 7:04

GoogleCodeExporter commented 9 years ago
r1280 adds neon64 but otherwise the android.mk in libyuv is up to date.
https://webrtc-codereview.appspot.com/39109004

the mk file you show is missing the _posix.cc files that contain those 
functions.
Add them and you should be good.

Original comment by fbarch...@google.com on 11 Feb 2015 at 7:43

GoogleCodeExporter commented 9 years ago
no further change on my end for now.
Can you verify that the android.mk in libyuv r1280 works for you?
Here is the content:

# This is the Android makefile for libyuv for both platform and NDK.
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_CPP_EXTENSION := .cc

LOCAL_SRC_FILES := \
    source/compare.cc           \
    source/compare_common.cc    \
    source/compare_neon64.cc    \
    source/compare_posix.cc     \
    source/convert.cc           \
    source/convert_argb.cc      \
    source/convert_from.cc      \
    source/convert_from_argb.cc \
    source/convert_to_argb.cc   \
    source/convert_to_i420.cc   \
    source/cpu_id.cc            \
    source/planar_functions.cc  \
    source/rotate.cc            \
    source/rotate_argb.cc       \
    source/rotate_mips.cc       \
    source/rotate_neon64.cc     \
    source/row_any.cc           \
    source/row_common.cc        \
    source/row_mips.cc          \
    source/row_neon64.cc        \
    source/row_posix.cc         \
    source/scale.cc             \
    source/scale_argb.cc        \
    source/scale_common.cc      \
    source/scale_mips.cc        \
    source/scale_neon64.cc      \
    source/scale_posix.cc       \
    source/video_common.cc

# TODO(fbarchard): Enable mjpeg encoder.
#   source/mjpeg_decoder.cc
#   source/convert_jpeg.cc
#   source/mjpeg_validate.cc

ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
    LOCAL_CFLAGS += -DLIBYUV_NEON
    LOCAL_SRC_FILES += \
        source/compare_neon.cc.neon    \
        source/rotate_neon.cc.neon     \
        source/row_neon.cc.neon        \
        source/scale_neon.cc.neon
endif

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include

LOCAL_MODULE := libyuv_static
LOCAL_MODULE_TAGS := optional

include $(BUILD_STATIC_LIBRARY)

Original comment by fbarch...@google.com on 11 Feb 2015 at 11:10

GoogleCodeExporter commented 9 years ago
Updated android.mk in libyuv
Please test if you can.

Original comment by fbarch...@google.com on 13 Feb 2015 at 6:36