Repository: conan-io/conan-center-index

Issue:
[package] ffmpeg/4.4: For cross compilation used default STRIP program
### Package and Environment Details

* Package Name/Version: **ffmpeg/4.4**
* Operating System+version: **Linux Ubuntu 20.04**
* Compiler+version: **GCC 9**
* Conan version: **conan 1.48.0**
* Python version: **Python 3.8.10**


### Conan profile

Configuration for profile nvidia_jetson:

[settings]
os=Linux
arch=armv8
compiler=gcc
compiler.version=9
compiler.libcxx=libstdc++11
build_type=Release
[options]
boost:with_stacktrace_backtrace=False
boost:without_context=True
boost:without_contract=True
boost:without_coroutine=True
boost:without_fiber=True
boost:without_graph=True
boost:without_graph_parallel=True
boost:without_iostreams=True
boost:without_locale=True
boost:without_log=True
boost:without_math=True
boost:without_mpi=True
boost:without_program_options=True
boost:without_python=True
boost:without_random=True
boost:without_regex=True
boost:without_stacktrace=True
boost:without_test=True
boost:without_timer=True
boost:without_type_erasure=True
boost:without_wave=True
ffmpeg:postproc=False
ffmpeg:shared=True
ffmpeg:with_freetype=False
ffmpeg:with_libalsa=False
ffmpeg:with_libfdk_aac=False
ffmpeg:with_libiconv=False
ffmpeg:with_libmp3lame=False
ffmpeg:with_libvpx=False
ffmpeg:with_libwebp=False
ffmpeg:with_libx264=False
ffmpeg:with_libx265=False
ffmpeg:with_lzma=False
ffmpeg:with_openjpeg=False
ffmpeg:with_opus=False
ffmpeg:with_programs=False
ffmpeg:with_pulse=False
ffmpeg:with_vaapi=False
ffmpeg:with_vdpau=False
ffmpeg:with_vorbis=False
ffmpeg:with_vulkan=False
ffmpeg:with_xcb=False
openblas:use_thread=False
[conf]
[build_requires]
[env]
CC=/usr/bin/aarch64-linux-gnu-gcc
CXX=/usr/bin/aarch64-linux-gnu-g++
AS=/usr/bin/aarch64-linux-gnu-as
AR=/usr/bin/aarch64-linux-gnu-ar
LD=/usr/bin/aarch64-linux-gnu-ld
STRIP=/usr/bin/aarch64-linux-gnu-strip
ffmpeg:AS=

### Steps to reproduce

sudo apt install g++-aarch64-linux-gnu
conan install ffmpeg/4.4@ --profile:host aarch64_profile --profile:build ubuntu_20.04 -r conancenter --build=missing

Problem here occurred because 
/usr/bin/aarch64-linux-gnu-strip ignored by the recipe and AutoToolsBuildEnvironment class

According example https://docs.conan.io/en/latest/systems_cross_building/cross_building.html#using-a-profile
environment STRIP used. But I don't see way to set it for ffmpeg recipe 

Note: strip can be set for ffmpeg : 
--strpip  -  https://github.com/FFmpeg/FFmpeg/blob/master/configure#L379
OR
--prefix - https://github.com/FFmpeg/FFmpeg/blob/master/configure#L83

### Logs

<details><summary>Click to expand log</summary>

```
...
fmpeg/4.4: Retrieving from server 'conancenter' 
ffmpeg/4.4: Trying with 'conancenter'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
ffmpeg/4.4: Downloaded recipe revision 17baf237718483a77484f4f19330ce0f
Installing package: ffmpeg/4.4
Requirements
    bzip2/1.0.8 from 'conancenter' - Cache
    ffmpeg/4.4 from 'conancenter' - Downloaded
    openh264/2.1.1 from 'conancenter' - Cache
    openssl/1.1.1o from 'conancenter' - Cache
    zlib/1.2.12 from 'conancenter' - Cache
Packages
    bzip2/1.0.8:1bf30e253eaf58ec1f11c4a2f5077008df38840e - Cache
    ffmpeg/4.4:030641bc9e2e4ec7efa7711b971ea8664ba121bc - Build
    openh264/2.1.1:46f5e3144211054445823306dbcc977b1b4772f5 - Cache
    openssl/1.1.1o:6630c814b09473af72365e9ddf5e657520e07a89 - Cache
    zlib/1.2.12:6630c814b09473af72365e9ddf5e657520e07a89 - Cache
Build requirements
    pkgconf/1.7.4 from 'conancenter' - Cache
Build requirements packages
    pkgconf/1.7.4:24647d9fe8ec489125dfbae4b3ebefaf7581674c - Cache

Cross-build from 'Linux:x86_64' to 'Linux:armv8'
Installing (downloading, building) binaries...
bzip2/1.0.8: Already installed!
bzip2/1.0.8: Appending PATH environment variable: /home/user/.conan/data/bzip2/1.0.8/_/_/package/1bf30e253eaf58ec1f11c4a2f5077008df38840e/bin
openh264/2.1.1: Already installed!
openssl/1.1.1o: Already installed!
pkgconf/1.7.4: Already installed!
pkgconf/1.7.4: Appending PATH env var: /home/user/.conan/data/pkgconf/1.7.4/_/_/package/24647d9fe8ec489125dfbae4b3ebefaf7581674c/bin
pkgconf/1.7.4: Setting PKG_CONFIG env var: /home/user/.conan/data/pkgconf/1.7.4/_/_/package/24647d9fe8ec489125dfbae4b3ebefaf7581674c/bin/pkgconf
pkgconf/1.7.4: Appending AUTOMAKE_CONAN_INCLUDES env var: /home/user/.conan/data/pkgconf/1.7.4/_/_/package/24647d9fe8ec489125dfbae4b3ebefaf7581674c/bin/aclocal
zlib/1.2.12: Already installed!
ffmpeg/4.4: Applying build-requirement: pkgconf/1.7.4
ffmpeg/4.4: Configuring sources in /home/user/.conan/data/ffmpeg/4.4/_/_/source

ffmpeg/4.4: Copying sources to build folder
ffmpeg/4.4: Building your package in /home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc
ffmpeg/4.4: Generator pkg_config created zlib.pc
ffmpeg/4.4: Generator pkg_config created bzip2.pc
ffmpeg/4.4: Generator pkg_config created openh264.pc
ffmpeg/4.4: Generator pkg_config created libcrypto.pc
ffmpeg/4.4: Generator pkg_config created libssl.pc
ffmpeg/4.4: Generator pkg_config created openssl.pc
ffmpeg/4.4: Aggregating env generators
ffmpeg/4.4: Calling build()
ffmpeg/4.4: Calling:
 > source_subfolder/configure '--pkg-config-flags=--static' '--disable-doc' '--enable-cross-compile' '--enable-asm' '--enable-shared' '--disable-static' '--enable-pic' '--enable-avdevice' '--enable-avcodec' '--enable-avformat' '--enable-swresample' '--enable-swscale' '--disable-postproc' '--enable-avfilter' '--enable-bzlib' '--enable-zlib' '--disable-lzma' '--disable-iconv' '--disable-libopenjpeg' '--enable-libopenh264' '--disable-libvorbis' '--disable-libopus' '--disable-libzmq' '--disable-sdl2' '--disable-libx264' '--disable-libx265' '--disable-libvpx' '--disable-libmp3lame' '--disable-libfdk-aac' '--disable-libwebp' '--enable-openssl' '--disable-alsa' '--disable-libpulse' '--disable-vaapi' '--disable-vdpau' '--disable-libxcb' '--disable-libxcb-shm' '--disable-libxcb-shape' '--disable-libxcb-xfixes' '--disable-appkit' '--disable-avfoundation' '--disable-coreimage' '--disable-audiotoolbox' '--disable-videotoolbox' '--disable-securetransport' '--disable-cuda' '--disable-cuvid' '--disable-nonfree' '--disable-gpl' '--disable-vulkan' '--arch=aarch64' '--disable-programs' '--cc=/usr/bin/aarch64-linux-gnu-gcc' '--cxx=/usr/bin/aarch64-linux-gnu-g++' '--target-os=gnu' '--extra-cflags=' '--extra-ldflags=' '--prefix=/home/user/.conan/data/ffmpeg/4.4/_/_/package/030641bc9e2e4ec7efa7711b971ea8664ba121bc' '--bindir=${prefix}/bin' '--libdir=${prefix}/lib' 

----Running------
> source_subfolder/configure '--pkg-config-flags=--static' '--disable-doc' '--enable-cross-compile' '--enable-asm' '--enable-shared' '--disable-static' '--enable-pic' '--enable-avdevice' '--enable-avcodec' '--enable-avformat' '--enable-swresample' '--enable-swscale' '--disable-postproc' '--enable-avfilter' '--enable-bzlib' '--enable-zlib' '--disable-lzma' '--disable-iconv' '--disable-libopenjpeg' '--enable-libopenh264' '--disable-libvorbis' '--disable-libopus' '--disable-libzmq' '--disable-sdl2' '--disable-libx264' '--disable-libx265' '--disable-libvpx' '--disable-libmp3lame' '--disable-libfdk-aac' '--disable-libwebp' '--enable-openssl' '--disable-alsa' '--disable-libpulse' '--disable-vaapi' '--disable-vdpau' '--disable-libxcb' '--disable-libxcb-shm' '--disable-libxcb-shape' '--disable-libxcb-xfixes' '--disable-appkit' '--disable-avfoundation' '--disable-coreimage' '--disable-audiotoolbox' '--disable-videotoolbox' '--disable-securetransport' '--disable-cuda' '--disable-cuvid' '--disable-nonfree' '--disable-gpl' '--disable-vulkan' '--arch=aarch64' '--disable-programs' '--cc=/usr/bin/aarch64-linux-gnu-gcc' '--cxx=/usr/bin/aarch64-linux-gnu-g++' '--target-os=gnu' '--extra-cflags=' '--extra-ldflags=' '--prefix=/home/user/.conan/data/ffmpeg/4.4/_/_/package/030641bc9e2e4ec7efa7711b971ea8664ba121bc' '--bindir=${prefix}/bin' '--libdir=${prefix}/lib' 
-----------------
--- ....... ---
INSTALL	libswresample/libswresample.so
INSTALL	libavformat/libavformat.so
INSTALL	libavdevice/libavdevice.so
INSTALL	libavcodec/libavcodec.so
INSTALL	libavfilter/libavfilter.so
INSTALL	libswscale/libswscale.so
INSTALL	libavutil/libavutil.so
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/libavdevice/avdevice.h
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/libavdevice/version.h
INSTALL	libavdevice/libavdevice.pc
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/libavfilter/avfilter.h
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/libavfilter/buffersink.h
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/libavfilter/buffersrc.h
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/libavfilter/version.h
STRIP	install-libswresample-shared
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/transcoding.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/vaapi_transcode.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/metadata.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/filtering_video.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/muxing.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/extract_mvs.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/encode_audio.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/hw_decode.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/filter_audio.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/decode_video.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/avio_list_dir.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/resampling_audio.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/remuxing.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/filtering_audio.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/http_multiclient.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/avio_reading.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/qsvdec.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/vaapi_encode.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/decode_audio.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/transcode_aac.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/demuxing_decoding.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/encode_video.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/scaling_video.c
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/README
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/doc/examples/Makefile
INSTALL	libavfilter/libavfilter.pc
STRIP	install-libavdevice-shared
strip: Unable to recognise the format of the input file `/home/user/.conan/data/ffmpeg/4.4/_/_/package/030641bc9e2e4ec7efa7711b971ea8664ba121bc/lib/libswresample.so.3.9.100'
strip: Unable to recognise the format of the input file `/home/user/.conan/data/ffmpeg/4.4/_/_/package/030641bc9e2e4ec7efa7711b971ea8664ba121bc/lib/libavdevice.so.58.13.100'
make: *** [/home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/ffbuild/library.mak:104: install-libswresample-shared] Error 1
make: *** Waiting for unfinished jobs....
make: *** [/home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/ffbuild/library.mak:104: install-libavdevice-shared] Error 1
STRIP	install-libswscale-shared
INSTALL	libavformat/libavformat.pc
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/libavformat/avformat.h
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/libavformat/avio.h
INSTALL	home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/libavformat/version.h
strip: Unable to recognise the format of the input file `/home/user/.conan/data/ffmpeg/4.4/_/_/package/030641bc9e2e4ec7efa7711b971ea8664ba121bc/lib/libswscale.so.5.9.100'
make: *** [/home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/ffbuild/library.mak:104: install-libswscale-shared] Error 1
STRIP	install-libavutil-shared
strip: Unable to recognise the format of the input file `/home/user/.conan/data/ffmpeg/4.4/_/_/package/030641bc9e2e4ec7efa7711b971ea8664ba121bc/lib/libavutil.so.56.70.100'
make: *** [/home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/ffbuild/library.mak:104: install-libavutil-shared] Error 1
STRIP	install-libavfilter-shared
strip: Unable to recognise the format of the input file `/home/user/.conan/data/ffmpeg/4.4/_/_/package/030641bc9e2e4ec7efa7711b971ea8664ba121bc/lib/libavfilter.so.7.110.100'
make: *** [/home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/ffbuild/library.mak:104: install-libavfilter-shared] Error 1
STRIP	install-libavformat-shared
strip: Unable to recognise the format of the input file `/home/user/.conan/data/ffmpeg/4.4/_/_/package/030641bc9e2e4ec7efa7711b971ea8664ba121bc/lib/libavformat.so.58.76.100'
make: *** [/home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/ffbuild/library.mak:104: install-libavformat-shared] Error 1
STRIP	install-libavcodec-shared
strip: Unable to recognise the format of the input file `/home/user/.conan/data/ffmpeg/4.4/_/_/package/030641bc9e2e4ec7efa7711b971ea8664ba121bc/lib/libavcodec.so.58.134.100'
make: *** [/home/user/.conan/data/ffmpeg/4.4/_/_/build/030641bc9e2e4ec7efa7711b971ea8664ba121bc/source_subfolder/ffbuild/library.mak:104: install-libavcodec-shared] Error 1
ERROR: ffmpeg/4.4: Error in package() method, line 601
	autotools.install()
	ConanException: Error 2 while executing make install -j16
```

</details>



Discussion:
> [env]
> PATH=[/usr/aarch64-linux-gnu/bin]

Adding this to the host profile will solve the problem
Is it possible to reopen this Issue? I currently have the same problem but the provided solution is more a workaround rather then a real fix of the issue. I guess the conanfile of ffmpeg is missing to retrieve the STRIP environment variable and put it along the configuration arguments.

Resolving patch:
diff --git a/recipes/ffmpeg/all/conanfile.py b/recipes/ffmpeg/all/conanfile.py
--- a/recipes/ffmpeg/all/conanfile.py
+++ b/recipes/ffmpeg/all/conanfile.py
@@ -536,13 +536,21 @@ def opt_append_disable_if_set(args, what, v):
             ])
         if not self.options.with_programs:
             args.append("--disable-programs")
-        # since ffmpeg"s build system ignores CC and CXX
+        # since ffmpeg"s build system ignores toolchain variables 
+        if tools.get_env("AR"):
+            args.append("--ar={}".format(tools.get_env("AR")))
         if tools.get_env("AS"):
             args.append("--as={}".format(tools.get_env("AS")))
         if tools.get_env("CC"):
             args.append("--cc={}".format(tools.get_env("CC")))
         if tools.get_env("CXX"):
             args.append("--cxx={}".format(tools.get_env("CXX")))
+        if tools.get_env("NM"):
+            args.append("--nm={}".format(tools.get_env("NM")))
+        if tools.get_env("RANLIB"):
+            args.append("--ranlib={}".format(tools.get_env("RANLIB")))
+        if tools.get_env("STRIP"):
+            args.append("--strip={}".format(tools.get_env("STRIP")))
         extra_cflags = []
         extra_ldflags = []
         if is_apple_os(self) and self.settings.os.version:


Test patch: