microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.89k stars 6.32k forks source link

[ffmpeg] Build failure when building for arm64-android #33963

Open OmidNejadabbasi opened 1 year ago

OmidNejadabbasi commented 1 year ago

Package: ffmpeg[avcodec,avdevice,avfilter,avformat,core,swresample,swscale]:arm64-android -> 5.1.2#9

Host Environment

To Reproduce

vcpkg install --host-triplet=arm64-android ffmpeg Failure logs

-- Using cached ffmpeg-ffmpeg-n5.1.2.tar.gz.
-- Cleaning sources at C:/Users/omidne/.vcpkg-clion/vcpkg/buildtrees/ffmpeg/src/n5.1.2-f84158df2a.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/Users/omidne/.vcpkg-clion/vcpkg/downloads/ffmpeg-ffmpeg-n5.1.2.tar.gz
-- Applying patch 0001-create-lib-libraries.patch
-- Applying patch 0002-fix-msvc-link.patch
-- Applying patch 0003-fix-windowsinclude.patch
-- Applying patch 0004-fix-debug-build.patch
-- Applying patch 0005-fix-nasm.patch
-- Applying patch 0006-fix-StaticFeatures.patch
-- Applying patch 0007-fix-lib-naming.patch
-- Applying patch 0009-Fix-fdk-detection.patch
-- Applying patch 0011-Fix-x265-detection.patch
-- Applying patch 0012-Fix-ssl-110-detection.patch
-- Applying patch 0013-define-WINVER.patch
-- Applying patch 0015-Fix-xml2-detection.patch
-- Applying patch 0020-fix-aarch64-libswscale.patch
-- Applying patch 0022-fix-iconv.patch
-- Applying patch 0024-fix-gcc13-binutils.patch
-- Using source at C:/Users/omidne/.vcpkg-clion/vcpkg/buildtrees/ffmpeg/src/n5.1.2-f84158df2a.clean
-- Getting CMake variables for arm64-android
-- Building Options: --enable-pic --disable-doc --enable-debug --enable-runtime-cpudetect --disable-autodetect --target-os=android --cc=clang.exe --cxx=clang++.exe --nm=llvm-nm.exe --ar='llvm-ar.exe' --disable-ffmpeg --disable-ffplay --disable-ffprobe --enable-avcodec --enable-avdevice --enable-avformat --enable-avfilter --disable-postproc --enable-swresample --enable-swscale --disable-alsa --disable-amf --disable-libaom --disable-libass --disable-avisynth --disable-bzlib --disable-libdav1d --disable-libfdk-aac --disable-libfontconfig --disable-libfreetype --disable-libfribidi --disable-iconv --disable-libilbc --disable-lzma --disable-libmp3lame --disable-libmodplug --disable-cuda --disable-nvenc --disable-nvdec  --disable-cuvid --disable-ffnvcodec --disable-opencl --disable-opengl --disable-libopenh264 --disable-libopenjpeg --disable-libopenmpt --disable-openssl --disable-libopus --disable-sdl2 --disable-libsnappy --disable-libsoxr --disable-libspeex --disable-libssh --disable-libtensorflow --disable-libtesseract --disable-libtheora --disable-libvorbis --disable-libvpx --disable-libwebp --disable-libx264 --disable-libx265 --disable-libxml2 --disable-zlib --disable-libsrt --disable-libmfx --enable-cross-compile --pkg-config-flags=--static
-- Building Release Options: --enable-optimizations
-- Building ffmpeg for Release
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
    Command failed: C:/Windows/System32/bash.exe ./build.sh
    Working Directory: C:/Users/omidne/.vcpkg-clion/vcpkg/buildtrees/ffmpeg/arm64-android-rel
    Error code: 2
    See logs for more information:
      C:\Users\omidne\.vcpkg-clion\vcpkg\buildtrees\ffmpeg\build-arm64-android-rel-err.log

Call Stack (most recent call first):
  ports/ffmpeg/portfile.cmake:601 (vcpkg_execute_required_process)
  scripts/ports.cmake:147 (include)
C:\Users\omidne\.vcpkg-clion\vcpkg\buildtrees\ffmpeg\build-arm64-android-rel-err.log ``` ./build.sh: line 2: $'\r': command not found ./build.sh: line 3: set: - : invalid option set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...] ./build.sh: line 4: $'\r': command not found ./build.sh: line 6: $'\r': command not found ./build.sh: line 8: $'\r': command not found ./build.sh: line 9: syntax error near unexpected token `$'{\r'' ./build.sh: line 9: `cygpath() { ' ```
LeenHawk commented 1 year ago

windows android seems fail for a long time... it's path problem. Use msys2 for a try?

dg0yt commented 1 year ago

ffmpeg doesn't use a standard build system, and the android triplets are tested with linux hosts. You may need to give WSL a try instead until this port is fixed.

OmidNejadabbasi commented 1 year ago

@dg0yt I installed ndk on WSL and after running the same command on wsl vcpkg it gave this error :

Computing installation plan...
The following packages will be built and installed:
    ffmpeg[avcodec,avdevice,avfilter,avformat,core,swresample,swscale]:arm64-android -> 5.1.2#9
  * pkgconf:arm64-android -> 1.8.0#5
  * vcpkg-cmake:arm64-android -> 2023-05-04
  * vcpkg-cmake-get-vars:arm64-android -> 2023-03-02
  * vcpkg-pkgconfig-get-modules:arm64-android -> 2023-09-06
  * vcpkg-tool-meson:arm64-android -> 0.63
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet arm64-android...
error: while detecting compiler information:
The log file content at "/home/omidn/vcpkg/buildtrees/detect_compiler/stdout-arm64-android.log" is:
-- Configuring arm64-android-rel
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
    Command failed: /home/omidn/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/bin/cmake /home/omidn/vcpkg/scripts/detect_compiler -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/omidn/vcpkg/packages/detect_compiler_arm64-android -DCMAKE_MAKE_PROGRAM=/home/omidn/vcpkg/downloads/tools/ninja/1.10.2-linux/ninja -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=21 -DBUILD_SHARED_LIBS=OFF -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/home/omidn/vcpkg/scripts/toolchains/android.cmake -DVCPKG_TARGET_TRIPLET=arm64-android -DVCPKG_SET_CHARSET_FLAG=ON -DVCPKG_PLATFORM_TOOLSET=external -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE -DCMAKE_VERBOSE_MAKEFILE=ON -DVCPKG_APPLOCAL_DEPS=OFF -DCMAKE_TOOLCHAIN_FILE=/home/omidn/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON -DVCPKG_CXX_FLAGS= -DVCPKG_CXX_FLAGS_RELEASE= -DVCPKG_CXX_FLAGS_DEBUG= -DVCPKG_C_FLAGS= -DVCPKG_C_FLAGS_RELEASE= -DVCPKG_C_FLAGS_DEBUG= -DVCPKG_CRT_LINKAGE=static -DVCPKG_LINKER_FLAGS= -DVCPKG_LINKER_FLAGS_RELEASE= -DVCPKG_LINKER_FLAGS_DEBUG= -DVCPKG_TARGET_ARCHITECTURE=arm64 -DCMAKE_INSTALL_LIBDIR:STRING=lib -DCMAKE_INSTALL_BINDIR:STRING=bin -D_VCPKG_ROOT_DIR=/home/omidn/vcpkg -DZ_VCPKG_ROOT_DIR=/home/omidn/vcpkg -D_VCPKG_INSTALLED_DIR=/home/omidn/vcpkg/installed -DVCPKG_MANIFEST_INSTALL=OFF -DANDROID_ABI=arm64-v8a
    Working Directory: /home/omidn/vcpkg/buildtrees/detect_compiler/arm64-android-rel
    Error code: 1
    See logs for more information:
      /home/omidn/vcpkg/buildtrees/detect_compiler/config-arm64-android-rel-CMakeCache.txt.log
      /home/omidn/vcpkg/buildtrees/detect_compiler/config-arm64-android-rel-out.log
      /home/omidn/vcpkg/buildtrees/detect_compiler/config-arm64-android-rel-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:344 (vcpkg_execute_required_process)
  scripts/detect_compiler/portfile.cmake:18 (vcpkg_configure_cmake)
  scripts/ports.cmake:147 (include)

error: vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.
/home/omidn/vcpkg/buildtrees/detect_compiler/config-arm64-android-rel-out.log ``` -- The C compiler identification is unknown -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Check for working C compiler: /Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -- Check for working C compiler: /Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang - broken -- Configuring incomplete, errors occurred! ```
LeenHawk commented 1 year ago

@dg0yt I installed ndk on WSL and after running the same command on wsl vcpkg it gave this error :

Computing installation plan...
The following packages will be built and installed:
    ffmpeg[avcodec,avdevice,avfilter,avformat,core,swresample,swscale]:arm64-android -> 5.1.2#9
  * pkgconf:arm64-android -> 1.8.0#5
  * vcpkg-cmake:arm64-android -> 2023-05-04
  * vcpkg-cmake-get-vars:arm64-android -> 2023-03-02
  * vcpkg-pkgconfig-get-modules:arm64-android -> 2023-09-06
  * vcpkg-tool-meson:arm64-android -> 0.63
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet arm64-android...
error: while detecting compiler information:
The log file content at "/home/omidn/vcpkg/buildtrees/detect_compiler/stdout-arm64-android.log" is:
-- Configuring arm64-android-rel
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:112 (message):
    Command failed: /home/omidn/vcpkg/downloads/tools/cmake-3.27.1-linux/cmake-3.27.1-linux-x86_64/bin/cmake /home/omidn/vcpkg/scripts/detect_compiler -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/omidn/vcpkg/packages/detect_compiler_arm64-android -DCMAKE_MAKE_PROGRAM=/home/omidn/vcpkg/downloads/tools/ninja/1.10.2-linux/ninja -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=21 -DBUILD_SHARED_LIBS=OFF -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=/home/omidn/vcpkg/scripts/toolchains/android.cmake -DVCPKG_TARGET_TRIPLET=arm64-android -DVCPKG_SET_CHARSET_FLAG=ON -DVCPKG_PLATFORM_TOOLSET=external -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE -DCMAKE_VERBOSE_MAKEFILE=ON -DVCPKG_APPLOCAL_DEPS=OFF -DCMAKE_TOOLCHAIN_FILE=/home/omidn/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON -DVCPKG_CXX_FLAGS= -DVCPKG_CXX_FLAGS_RELEASE= -DVCPKG_CXX_FLAGS_DEBUG= -DVCPKG_C_FLAGS= -DVCPKG_C_FLAGS_RELEASE= -DVCPKG_C_FLAGS_DEBUG= -DVCPKG_CRT_LINKAGE=static -DVCPKG_LINKER_FLAGS= -DVCPKG_LINKER_FLAGS_RELEASE= -DVCPKG_LINKER_FLAGS_DEBUG= -DVCPKG_TARGET_ARCHITECTURE=arm64 -DCMAKE_INSTALL_LIBDIR:STRING=lib -DCMAKE_INSTALL_BINDIR:STRING=bin -D_VCPKG_ROOT_DIR=/home/omidn/vcpkg -DZ_VCPKG_ROOT_DIR=/home/omidn/vcpkg -D_VCPKG_INSTALLED_DIR=/home/omidn/vcpkg/installed -DVCPKG_MANIFEST_INSTALL=OFF -DANDROID_ABI=arm64-v8a
    Working Directory: /home/omidn/vcpkg/buildtrees/detect_compiler/arm64-android-rel
    Error code: 1
    See logs for more information:
      /home/omidn/vcpkg/buildtrees/detect_compiler/config-arm64-android-rel-CMakeCache.txt.log
      /home/omidn/vcpkg/buildtrees/detect_compiler/config-arm64-android-rel-out.log
      /home/omidn/vcpkg/buildtrees/detect_compiler/config-arm64-android-rel-err.log

Call Stack (most recent call first):
  scripts/cmake/vcpkg_configure_cmake.cmake:344 (vcpkg_execute_required_process)
  scripts/detect_compiler/portfile.cmake:18 (vcpkg_configure_cmake)
  scripts/ports.cmake:147 (include)

error: vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.

/home/omidn/vcpkg/buildtrees/detect_compiler/config-arm64-android-rel-out.log

-- The C compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
-- Check for working C compiler: /Android/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang - broken
-- Configuring incomplete, errors occurred!

Android ndk need to be r25... r26 is not working now. And it seems your android ndk broken. Test with other packages

LeenHawk commented 1 year ago

@LilyWangLL It's really a bug for ffmpeg on windows. I found it last year.

OmidNejadabbasi commented 1 year ago

@LeenHawk Version 25.2.9519653 of ndk had the same issue. "clang is broken"

have you had any successful build on windows for android ?

LeenHawk commented 1 year ago

@LeenHawk Version 25.2.9519653 of ndk had the same issue. "clang is broken"

have you had any successful build on windows for android ?

emm,I have successfully built yesterday… I’m sure that your ndk has something wrong on wsl.

LeenHawk commented 1 year ago

@LeenHawk Version 25.2.9519653 of ndk had the same issue. "clang is broken"

have you had any successful build on windows for android ?

Make sure you can build some other package like gsl…

github-actions[bot] commented 11 months ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

github-actions[bot] commented 10 months ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

dg0yt commented 2 months ago

Adding ffmpeg CI testing for android in #39703.