Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libx264: Fix Android build #24587

Merged
merged 2 commits into from
Jul 15, 2024

Conversation

uilianries
Copy link
Member

Summary

Changes to recipe: libx264/cci.20220602

Motivation

The issue #23718 reported an error when trying to build for Android. Plus, libx264 is a ffmpeg dependency.

Details

When using Conan android-ndk, most of things are configured already, like ndk_path and sysroot, but still misses the toolchain path (folder level with bin, sysroot, lib, ...). That level is really important because libx264 will ask for strings and same is llvm-strings in Android NDK, it's the executable for strings in the NDK.

The toolchain path looks fragile, but is stable, same adopted in the recipe for Android NDK, and checked locally with Android NDK 26d.

As I needed to execute several builds using Android NDK, I posted the build logs here: https://gist.github.com/uilianries/f3ca036501f9c175312fb7c7df614db2

Related to #24566

fixes #23718


Signed-off-by: Uilian Ries <uilianries@gmail.com>
@conan-center-bot

This comment has been minimized.

Signed-off-by: Uilian Ries <uilianries@gmail.com>
@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 4 (198109594967ea30a36d3da19c74fc161db7b0ca):

  • libx264/cci.20220602:
    All packages built successfully! (All logs)

  • libx264/cci.20240224:
    All packages built successfully! (All logs)

  • libx264/20191217:
    All packages built successfully! (All logs)

  • libx264/20190605:
    All packages built successfully! (All logs)


Conan v2 pipeline ✔️

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

All green in build 3 (198109594967ea30a36d3da19c74fc161db7b0ca):

  • libx264/cci.20220602:
    All packages built successfully! (All logs)

  • libx264/20191217:
    All packages built successfully! (All logs)

  • libx264/cci.20240224:
    All packages built successfully! (All logs)

  • libx264/20190605:
    All packages built successfully! (All logs)

@conan-center-bot conan-center-bot merged commit 0964d75 into conan-io:master Jul 15, 2024
24 checks passed
@elvisdukaj
Copy link
Contributor

elvisdukaj commented Jul 16, 2024

Trying to build this package from windows I have compile-time errors:

Logs
======== Exporting recipe to the cache ========
libx264/cci.20220602: Exported: libx264/cci.20220602#84ac3bad6c78a5ed594cfa2f3c4cce23 (2024-07-16 07:32:16 UTC)

======== Exporting recipe to the cache ========
libx264/cci.20220602: Exporting package recipe: C:\xrsw\repos\conan-center-index\recipes\libx264\all\conanfile.py
libx264/cci.20220602: exports: File 'conandata.yml' found. Exporting it...
libx264/cci.20220602: Copied 1 '.yml' file: conandata.yml
libx264/cci.20220602: Copied 1 '.py' file: conanfile.py
libx264/cci.20220602: Exported to cache folder: C:\Users\edukaj\.conan2\p\libx23c4e3daabf7c5\e
libx264/cci.20220602: Exported: libx264/cci.20220602#84ac3bad6c78a5ed594cfa2f3c4cce23 (2024-07-16 07:32:17 UTC)

======== Input profiles ========
Profile host:
[settings]
arch=armv8
build_type=Debug
compiler=clang
compiler.cppstd=17
compiler.libcxx=c++_static
compiler.version=14
os=Android
os.api_level=31
[tool_requires]
*: ninja/1.11.1, cmake/3.28.1, android-ndk/r25c
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
tools.env.virtualenv:powershell=False

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
tools.env.virtualenv:powershell=False


======== Computing dependency graph ========
Graph root
    cli
Requirements
    libx264/cci.20220602#84ac3bad6c78a5ed594cfa2f3c4cce23 - Cache
Build requirements
    android-ndk/r25c#760aecc4204a86140c455a890ac312f3 - Cache
    cmake/3.28.1#6a1e0a2ffe43d562b8228c1a5aaaac61 - Cache
    msys2/cci.latest#78b1cbee6b821008ca0f7ec6559266f5 - Cache
    ninja/1.11.1#cd30ca226f2040a979c359ebca4817d5 - Cache

======== Computing necessary packages ========
Requirements
    libx264/cci.20220602#84ac3bad6c78a5ed594cfa2f3c4cce23:73c208ea4372810866cb59b149723d8c56728c8a - Build
Build requirements
    android-ndk/r25c#760aecc4204a86140c455a890ac312f3:522dcea5982a3f8a5b624c16477e47195da2f84f#80ca5a47297c567d4d17ee179e2d17d5 - Cache
    cmake/3.28.1#6a1e0a2ffe43d562b8228c1a5aaaac61:522dcea5982a3f8a5b624c16477e47195da2f84f#29e6903b5006c2b2f81003c9ebf7551b - Cache
    msys2/cci.latest#78b1cbee6b821008ca0f7ec6559266f5:956a88975bda9dfcc485e2861d71e74bd7e2b9a5#a3cd3a7c08d8dbaadd1817bc81c39c94 - Cache
    ninja/1.11.1#cd30ca226f2040a979c359ebca4817d5:723257509aee8a72faf021920c2874abc738e029#1a592c653c6d8742bf921f77d92580f4 - Cache

======== Installing packages ========
android-ndk/r25c: Already installed! (1 of 5)
cmake/3.28.1: Already installed! (2 of 5)
cmake/3.28.1: Appending PATH environment variable: C:\Users\edukaj\.conan2\p\b\cmake658582c322d1b\p\bin
cmake/3.28.1: Appending PATH environment variable: C:\Users\edukaj\.conan2\p\b\cmake658582c322d1b\p\bin
msys2/cci.latest: Already installed! (3 of 5)
ninja/1.11.1: Already installed! (4 of 5)

-------- Installing package libx264/cci.20220602 (5 of 5) --------
libx264/cci.20220602: Building from source
libx264/cci.20220602: Package libx264/cci.20220602:73c208ea4372810866cb59b149723d8c56728c8a
libx264/cci.20220602: Copying sources to build folder
libx264/cci.20220602: Building your package in C:\Users\edukaj\.conan2\p\b\libx28fa659b0e788b\b
libx264/cci.20220602: Calling generate()
libx264/cci.20220602: Generators folder: C:\Users\edukaj\.conan2\p\b\libx28fa659b0e788b\b\build-debug\conan
libx264/cci.20220602: Generating aggregated env files
libx264/cci.20220602: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
libx264/cci.20220602: Calling build()
libx264/cci.20220602: RUN: "/c/users/edukaj/.conan2/p/b/libx28fa659b0e788b/b/src/configure" --enable-static --prefix=/ --bindir=${prefix}/bin --libdir=${prefix}/lib --includedir=${prefix}/include --host=aarch64-linux-android
 --bit-depth=all --disable-cli --enable-pic --enable-debug --cross-prefix=C:\Users\edukaj\.conan2\p\b\androc34b498ce5137\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\llvm- --sysroot=C:\Users\edukaj\.conan2\p\b\androc34b498ce5137\p\bin\toolchains\llvm\prebuilt\windows-x86_64\sysroot --extra-cflags=-fno-finite-math-only 
mkdir: cannot create directory '/dev/shm': Read-only file system

Creating /dev/shm directory failed.
POSIX semaphores and POSIX shared memory will not work

mkdir: cannot create directory '/dev/mqueue': Read-only file system

Creating /dev/mqueue directory failed.
POSIX message queues will not work

No working C compiler found.

libx264/cci.20220602: ERROR:
Package '73c208ea4372810866cb59b149723d8c56728c8a' build failed
libx264/cci.20220602: WARN: Build folder C:\Users\edukaj\.conan2\p\b\libx28fa659b0e788b\b\build-debug
ERROR: libx264/cci.20220602: Error in build() method, line 169
        autotools.configure()
        ConanException: Error 1 while executing
conanautotoolstoolchain.sh
script_folder="C:\Users\edukaj\.conan2\p\b\libx28fa659b0e788b\b\build-debug\conan"
echo "echo Restoring environment" > "$script_folder\deactivate_conanautotoolstoolchain.sh"
for v in CC CXX CPPFLAGS CXXFLAGS CFLAGS LDFLAGS PKG_CONFIG_PATH
do
    is_defined="true"
    value=$(printenv $v) || is_defined="" || true
    if [ -n "$value" ] || [ -n "$is_defined" ]
    then
        echo export "$v='$value'" >> "$script_folder\deactivate_conanautotoolstoolchain.sh"
    else
        echo unset $v >> "$script_folder\deactivate_conanautotoolstoolchain.sh"
    fi
done


export CC="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android31-clang.cmd"
export CXX="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android31-clang++.cmd"
export CPPFLAGS="$CPPFLAGS"
export CXXFLAGS="$CXXFLAGS -fPIC --sysroot C:/Users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/sysroot -g"
export CFLAGS="$CFLAGS -fPIC --sysroot C:/Users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/sysroot -g"
export LDFLAGS="$LDFLAGS --sysroot C:/Users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/sysroot"
export PKG_CONFIG_PATH="/c/users/edukaj/.conan2/p/b/libx28fa659b0e788b/b/build-debug/conan:$PKG_CONFIG_PATH"
conanautotoolstoolchain.sh
script_folder="C:\Users\edukaj\.conan2\p\b\libx28fa659b0e788b\b\build-debug\conan"
echo "echo Restoring environment" > "$script_folder\deactivate_conanbuild_android.sh"
for v in AS
do
    is_defined="true"
    value=$(printenv $v) || is_defined="" || true
    if [ -n "$value" ] || [ -n "$is_defined" ]
    then
        echo export "$v='$value'" >> "$script_folder\deactivate_conanbuild_android.sh"
    else
        echo unset $v >> "$script_folder\deactivate_conanbuild_android.sh"
    fi
done


export AS="C:\Users\edukaj\.conan2\p\b\androc34b498ce5137\p\bin\toolchains\llvm\prebuilt\windows-x86_64\bin\aarch64-linux-android31-clang.cmd"
conanbuildenv-debug-armv8.sh
script_folder="C:\Users\edukaj\.conan2\p\b\libx28fa659b0e788b\b\build-debug\conan"
echo "echo Restoring environment" > "$script_folder\deactivate_conanbuildenv-debug-armv8.sh"
for v in ANDROID_NDK_ROOT ANDROID_NDK_HOME NDK_ROOT CHOST SYSROOT ANDROID_NATIVE_API_LEVEL CC CXX AS LD AR RANLIB STRIP ADDR2LINE NM OBJCOPY OBJDUMP READELF ANDROID_PLATFORM ANDROID_TOOLCHAIN ANDROID_ABI ANDROID_STL PATH MSYS_ROOT MSYS_BIN
do
    is_defined="true"
    value=$(printenv $v) || is_defined="" || true
    if [ -n "$value" ] || [ -n "$is_defined" ]
    then
        echo export "$v='$value'" >> "$script_folder\deactivate_conanbuildenv-debug-armv8.sh"
    else
        echo unset $v >> "$script_folder\deactivate_conanbuildenv-debug-armv8.sh"
    fi
done


export ANDROID_NDK_ROOT="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin"
export ANDROID_NDK_HOME="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin"
export NDK_ROOT="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64"
export CHOST="aarch64-linux-android"
export SYSROOT="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/sysroot"
export ANDROID_NATIVE_API_LEVEL="31"
export CC="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android31-clang.cmd"
export CXX="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android31-clang++.cmd"
export AS="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android31-clang.cmd"
export LD="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/aarch64-linux-android31-clang++.cmd"
export AR="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar.exe"
export RANLIB="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ranlib.exe"
export STRIP="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe"
export ADDR2LINE="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-addr2line.exe"
export NM="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-nm.exe"
export OBJCOPY="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-objcopy.exe"
export OBJDUMP="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-objdump.exe"
export READELF="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-readelf.exe"
export ANDROID_PLATFORM="android-31"
export ANDROID_TOOLCHAIN="clang"
export ANDROID_ABI="arm64-v8a"
export ANDROID_STL="c++_static"
export PATH="/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin:/c/users/edukaj/.conan2/p/b/androc34b498ce5137/p/bin/toolchains/llvm/prebuilt/windows-x86_64/bin:/c/users/edukaj/.conan2/p/b/cmake658582c322d1b/p/bin:/c/users/edukaj/.conan2/p/b/ninjaa01dcbf33dfe3/p/bin:/c/users/edukaj/.conan2/p/msys2498b23cfe9db2/p/bin:/c/users/edukaj/.conan2/p/msys2498b23cfe9db2/p/bin/msys64/usr/bin:$PATH"
export MSYS_ROOT="/c/users/edukaj/.conan2/p/msys2498b23cfe9db2/p/bin/msys64"
export MSYS_BIN="/c/users/edukaj/.conan2/p/msys2498b23cfe9db2/p/bin/msys64/usr/bin"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[package] libx264/cci.2022060: Failed to build for Android
5 participants