From cd393d863a63f956aa3ffa44def0d6b0dffaf840 Mon Sep 17 00:00:00 2001 From: Tom M Date: Wed, 12 May 2021 17:43:35 +0200 Subject: [PATCH] Fix broken SF3 support for Android binaries (#890) Libsndfile was unintentionally compiled without OGG/Vorbis support. That's because libopus was missing. When compiling libsndfile with autotools [you get a nice warning](https://github.com/libsndfile/libsndfile/blob/9349a566e298ef6d6bed6c275dc1f5502bb2e028/configure.ac#L381-L386). When using CMake you don't... Solution: Compile libopus before compiling libsndfile. Now it reports ``` -- The following features have been enabled: * ENABLE_EXTERNAL_LIBS, enable FLAC, Vorbis, and Opus codecs ``` --- .azure/azure-pipelines-android.yml | 24 ++++++++++++++++++++++-- .azure/cmake-android.yml | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.azure/azure-pipelines-android.yml b/.azure/azure-pipelines-android.yml index 7f3b71c7..a5fb01ab 100644 --- a/.azure/azure-pipelines-android.yml +++ b/.azure/azure-pipelines-android.yml @@ -43,6 +43,7 @@ variables: INSTPATCH_VERSION: '1.1.6' VORBIS_VERSION: '1.3.7' OGG_VERSION: '1.3.4' + OPUS_VERSION: '1.3.1' # flac 1.3.3 is completely broken: pkgconfig is incorrectly installed, compilation failure, etc.; use recent master instead FLAC_VERSION: '27c615706cedd252a206dd77e3910dfa395dcc49' @@ -158,12 +159,15 @@ jobs: wget -O flac-${FLAC_VERSION}.tar.gz https://github.com/xiph/flac/archive/${FLAC_VERSION}.tar.gz tar xf flac-${FLAC_VERSION}.tar.gz + wget -O opus-${OPUS_VERSION}.tar.gz https://github.com/xiph/opus/archive/refs/tags/v${OPUS_VERSION}.tar.gz + tar xf opus-${OPUS_VERSION}.tar.gz + displayName: 'Download Dependencies' workingDirectory: $(DEV) - task: Cache@2 inputs: - key: '$(ARCH) | $(DEV)/*.tar.gz | cacheVersion1' + key: '$(ARCH) | $(DEV)/*.tar.gz | cacheVersion2' path: '$(PREFIX)' cacheHitVar: 'CACHE_RESTORED' displayName: 'Cache fluidsynth dependency libraries' @@ -495,6 +499,21 @@ jobs: condition: always() workingDirectory: $(DEV) + # another broken xiph project that doesn't specify the C standard and keeps complaining of you don't have C99 + - template: cmake-android.yml + parameters: + sourceDir: 'opus-$(OPUS_VERSION)' + cmakeArgs: '-DBUILD_PROGRAMS=0 -DOPUS_MAY_HAVE_NEON=1 -DCMAKE_C_STANDARD=99 -DCMAKE_C_STANDARD_REQUIRED=1' + + - script: | + ls -la opus-${OPUS_VERSION}/build/CMakeFiles/ + cat opus-${OPUS_VERSION}/build/CMakeFiles/CMakeError.log + cat opus-${OPUS_VERSION}/build/CMakeFiles/CMakeOutput.log + true + displayName: 'Print OPUS Cmake Error Log' + condition: always() + workingDirectory: $(DEV) + - template: cmake-android.yml parameters: sourceDir: 'libsndfile-$(SNDFILE_VERSION)' @@ -606,6 +625,7 @@ jobs: ls libintl.so ls liboboe.so ls libogg.so + ls libopus.so ls libsndfile.so ls libvorbis.so ls libvorbisenc.so @@ -626,4 +646,4 @@ jobs: pushd build make uninstall popd - displayName: 'Uninstall fluidsynth' \ No newline at end of file + displayName: 'Uninstall fluidsynth' diff --git a/.azure/cmake-android.yml b/.azure/cmake-android.yml index a4e5635c..74cd4099 100644 --- a/.azure/cmake-android.yml +++ b/.azure/cmake-android.yml @@ -33,6 +33,7 @@ steps: cmake -G "Unix Makefiles" \ -DCMAKE_MAKE_PROGRAM=make \ -DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/android.toolchain.cmake \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DANDROID_NATIVE_API_LEVEL=${ANDROID_API} \ -DANDROID_ABI=${ANDROID_ABI_CMAKE} \ -DANDROID_TOOLCHAIN=${CC} \