cisco / openh264

Open Source H.264 Codec
BSD 2-Clause "Simplified" License
5.56k stars 1.8k forks source link

Shared library not created when building for android on macOS using NDKr21d #3356

Open joeygo opened 3 years ago

joeygo commented 3 years ago

Hello, I'm trying to build OpenH264 but only static library is created. When clang++ is trying to link the so I'm getting the following error:

/tmp/android-ndk-r21d/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ -shared -o libopenh264.so codec/encoder/core/src/au_set.o codec/encoder/core/src/deblocking.o codec/encoder/core/src/decode_mb_aux.o codec/encoder/core/src/encode_mb_aux.o codec/encoder/core/src/encoder.o codec/encoder/core/src/encoder_data_tables.o codec/encoder/core/src/encoder_ext.o codec/encoder/core/src/get_intra_predictor.o codec/encoder/core/src/md.o codec/encoder/core/src/mv_pred.o codec/encoder/core/src/nal_encap.o codec/encoder/core/src/paraset_strategy.o codec/encoder/core/src/picture_handle.o codec/encoder/core/src/ratectl.o codec/encoder/core/src/ref_list_mgr_svc.o codec/encoder/core/src/sample.o codec/encoder/core/src/set_mb_syn_cabac.o codec/encoder/core/src/set_mb_syn_cavlc.o codec/encoder/core/src/slice_multi_threading.o codec/encoder/core/src/svc_base_layer_md.o codec/encoder/core/src/svc_enc_slice_segment.o codec/encoder/core/src/svc_encode_mb.o codec/encoder/core/src/svc_encode_slice.o codec/encoder/core/src/svc_mode_decision.o codec/encoder/core/src/svc_motion_estimate.o codec/encoder/core/src/svc_set_mb_syn_cabac.o codec/encoder/core/src/svc_set_mb_syn_cavlc.o codec/encoder/core/src/wels_preprocess.o codec/encoder/core/src/wels_task_base.o codec/encoder/core/src/wels_task_encoder.o codec/encoder/core/src/wels_task_management.o codec/encoder/plus/src/welsEncoderExt.o codec/encoder/core/arm/intra_pred_neon.o codec/encoder/core/arm/intra_pred_sad_3_opt_neon.o codec/encoder/core/arm/memory_neon.o codec/encoder/core/arm/pixel_neon.o codec/encoder/core/arm/reconstruct_neon.o codec/encoder/core/arm/svc_motion_estimation.o codec/decoder/core/src/au_parser.o codec/decoder/core/src/bit_stream.o codec/decoder/core/src/cabac_decoder.o codec/decoder/core/src/deblocking.o codec/decoder/core/src/decode_mb_aux.o codec/decoder/core/src/decode_slice.o codec/decoder/core/src/decoder.o codec/decoder/core/src/decoder_core.o codec/decoder/core/src/decoder_data_tables.o codec/decoder/core/src/error_concealment.o codec/decoder/core/src/fmo.o codec/decoder/core/src/get_intra_predictor.o codec/decoder/core/src/manage_dec_ref.o codec/decoder/core/src/memmgr_nal_unit.o codec/decoder/core/src/mv_pred.o codec/decoder/core/src/parse_mb_syn_cabac.o codec/decoder/core/src/parse_mb_syn_cavlc.o codec/decoder/core/src/pic_queue.o codec/decoder/core/src/rec_mb.o codec/decoder/core/src/wels_decoder_thread.o codec/decoder/plus/src/welsDecoderExt.o codec/decoder/core/arm/block_add_neon.o codec/decoder/core/arm/intra_pred_neon.o codec/processing/src/adaptivequantization/AdaptiveQuantization.o codec/processing/src/backgrounddetection/BackgroundDetection.o codec/processing/src/common/memory.o codec/processing/src/common/WelsFrameWork.o codec/processing/src/common/WelsFrameWorkEx.o codec/processing/src/complexityanalysis/ComplexityAnalysis.o codec/processing/src/denoise/denoise.o codec/processing/src/denoise/denoise_filter.o codec/processing/src/downsample/downsample.o codec/processing/src/downsample/downsamplefuncs.o codec/processing/src/imagerotate/imagerotate.o codec/processing/src/imagerotate/imagerotatefuncs.o codec/processing/src/scenechangedetection/SceneChangeDetection.o codec/processing/src/scrolldetection/ScrollDetection.o codec/processing/src/scrolldetection/ScrollDetectionFuncs.o codec/processing/src/vaacalc/vaacalcfuncs.o codec/processing/src/vaacalc/vaacalculation.o codec/processing/src/arm/adaptive_quantization.o codec/processing/src/arm/down_sample_neon.o codec/processing/src/arm/pixel_sad_neon.o codec/processing/src/arm/vaa_calc_neon.o codec/common/src/cpu-features.o codec/common/src/common_tables.o codec/common/src/copy_mb.o codec/common/src/cpu.o codec/common/src/crt_util_safe_x.o codec/common/src/deblocking_common.o codec/common/src/expand_pic.o codec/common/src/intra_pred_common.o codec/common/src/mc.o codec/common/src/memory_align.o codec/common/src/sad_common.o codec/common/src/utils.o codec/common/src/welsCodecTrace.o codec/common/src/WelsTaskThread.o codec/common/src/WelsThread.o codec/common/src/WelsThreadLib.o codec/common/src/WelsThreadPool.o codec/common/arm/copy_mb_neon.o codec/common/arm/deblocking_neon.o codec/common/arm/expand_picture_neon.o codec/common/arm/intra_pred_common_neon.o codec/common/arm/mc_neon.o -march=armv7-a -Wl,--fix-cortex-a8 --sysroot=/tmp/android-ndk-r21d/platforms/android-19/arch-arm -target armv7-none-linux-androideabi -gcc-toolchain -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Wl,-z,relro -Wl,-z,now -Wl,-soname,libopenh264.so ld: unknown option: --sysroot=/tmp/android-ndk-r21d/platforms/android-19/arch-arm clang++: error: linker command failed with exit code 1 (use -v to see invocation)

OpenH264: v2.1.1 OS: macOS Big Sur 11.0.1 JAVA: jdk1.8.0_211.jdk SDK_TOOLS_VERSION=r25.2.5 NDK: r21d NDKLEVEL: 19 TARGET: android-19

make OS=android NDKROOT=/tmp/android-ndk-r21d TARGET=android-19 NDKLEVEL=19 NDK_TOOLCHAIN_VERSION=clang ARCH=arm clean

make OS=android NDKROOT=/tmp/android-ndk-r21d TARGET=android-19 NDKLEVEL=19 NDK_TOOLCHAIN_VERSION=clang ARCH=arm install

Any help would be much appreciated.

Thanks, Joey

alexcohn commented 3 years ago

see https://github.com/cisco/openh264/pull/3261

GuangweiWang commented 3 years ago

@joeygo does it work now?