yasea icon indicating copy to clipboard operation
yasea copied to clipboard

adition of x86_64

Open lucasxvirtual opened this issue 4 years ago • 5 comments

Hey dude, great lib, I'm just wondering if you could add the x86_64 ABI for suport on 64 bit devices as google play is now demanding for it

lucasxvirtual avatar Jun 21 '20 14:06 lucasxvirtual

Can you build out x86_64 library with the same build script of x86 like android_build_x86.sh with your own native tool chain?

begeekmyfriend avatar Jun 22 '20 02:06 begeekmyfriend

Hi, I'm sorry for the late response. I don't really know how to build it as I'm not used to work with cpp, but I assume it would be something like this

#!/bin/sh

ANDROID_NDK=$HOME/Android/android-ndk-r14b
SYSROOT=$ANDROID_NDK/platforms/android-21/arch-x86_64
CROSS_PREFIX=$ANDROID_NDK/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/x86_64-linux-android-
EXTRA_CFLAGS="-D__ANDROID__ -D__x86_64__"
EXTRA_LDFLAGS="-nostdlib"
PREFIX=`pwd`/libs/x86_64

./configure --prefix=$PREFIX \
        --host=i686-linux \
        --sysroot=$SYSROOT \
        --cross-prefix=$CROSS_PREFIX \
        --extra-cflags="$EXTRA_CFLAGS" \
        --extra-ldflags="$EXTRA_LDFLAGS" \
        --enable-pic \
        --enable-static \
        --enable-strip \
        --disable-cli \
        --disable-win32thread \
        --disable-avs \
        --disable-swscale \
        --disable-lavf \
        --disable-ffms \
        --disable-gpac \
        --disable-lsmash \
        --disable-opencl \
        --disable-asm

make clean
make STRIP= -j8 install || exit 1

cp -f $PREFIX/lib/libx264.a $PREFIX
rm -rf $PREFIX/include $PREFIX/lib $PREFIX/pkgconfig

Can you build it and upload a new version to github? or maybe help me at building my own so I can create a pull request? Thank you in advance

lucasxvirtual avatar Jun 24 '20 22:06 lucasxvirtual

You'd better build libx264 on Windows or Linux NDK platform for the default C compiler of x264 is GCC instead of Clang. Or you need to find some way to build x264 with Clang. See your config.log output and you would get what need to be done.

begeekmyfriend avatar Jun 25 '20 12:06 begeekmyfriend

as I said, I have no idea of how to do it, when I try

gcc -shared -o libenc.so -I$JAVA_HOME/include -I$JAVA_HOME/include/darwin -fPIC libenc.cc

I get:

Undefined symbols for architecture x86_64:
  "_ConvertFromI420", referenced from:
      libenc_RGBAToNV12(JNIEnv_*, _jobject*, _jbyteArray*, int, int, unsigned char, int) in libenc-1eb3cd.o
      libenc_ARGBToNV12Scaled(JNIEnv_*, _jobject*, _jintArray*, int, int, unsigned char, int, int, int, int, int) in libenc-1eb3cd.o
      libenc_ARGBToNV12(JNIEnv_*, _jobject*, _jintArray*, int, int, unsigned char, int) in libenc-1eb3cd.o
      libenc_NV21ToNV12Scaled(JNIEnv_*, _jobject*, _jbyteArray*, int, int, unsigned char, int, int, int, int, int) in libenc-1eb3cd.o
  "_ConvertToI420", referenced from:
      convert_to_i420(unsigned char*, int, int, unsigned char, int, int) in libenc-1eb3cd.o
      convert_to_i420_with_crop_scale(unsigned char*, int, int, int, int, int, int, unsigned char, int, int) in libenc-1eb3cd.o
  "_I420Scale", referenced from:
      convert_to_i420(unsigned char*, int, int, unsigned char, int, int) in libenc-1eb3cd.o
      convert_to_i420_with_crop_scale(unsigned char*, int, int, int, int, int, int, unsigned char, int, int) in libenc-1eb3cd.o
  "_x264_encoder_close", referenced from:
      libenc_closeSoftEncoder(JNIEnv_*, _jobject*) in libenc-1eb3cd.o
  "_x264_encoder_delayed_frames", referenced from:
      libenc_closeSoftEncoder(JNIEnv_*, _jobject*) in libenc-1eb3cd.o
  "_x264_encoder_encode", referenced from:
      libenc_closeSoftEncoder(JNIEnv_*, _jobject*) in libenc-1eb3cd.o
      x264_encode(YuvFrame*, long long) in libenc-1eb3cd.o
  "_x264_encoder_headers", referenced from:
      encode_global_nal_header() in libenc-1eb3cd.o
  "_x264_encoder_open_152", referenced from:
      libenc_openSoftEncoder(JNIEnv_*, _jobject*) in libenc-1eb3cd.o
  "_x264_param_apply_profile", referenced from:
      libenc_openSoftEncoder(JNIEnv_*, _jobject*) in libenc-1eb3cd.o
  "_x264_param_default_preset", referenced from:
      libenc_openSoftEncoder(JNIEnv_*, _jobject*) in libenc-1eb3cd.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

lucasxvirtual avatar Jul 01 '20 00:07 lucasxvirtual

clang: error: linker command failed with exit code 1 (use -v to see invocation)

In fact the gcc is just a bias name of clang in MacOS, try on windows or Linux platform please;-)

begeekmyfriend avatar Jul 01 '20 06:07 begeekmyfriend