[question] ffmpeg/6.1.1 dependancies and PKG_CONFIG
Describe the bug
Hello All,
I am using the conan-center version of the ffmpeg lib specifically ffmpeg/6.1.1
my project uses this code to consume it:
#ffmpeg gives PKG_CONFIG_PATH ERRORS currently when finding it's interdependancies.
self.requires("ffmpeg/6.1.1",options={"with_libaom": False, \
"with_libdav1d": False, \
"with_openh264": False, \
"with_openjpeg": False, \
"with_opus": False, \
"with_libsvtav1": False, \
"with_vorbis": False, \
"with_libvpx": False, \
"with_libwebp": False, \
"with_libx264": False, \
"with_libx265": False})
On windows I have had to disable the above libs because of PKG_CONFIG related errors. Is this currently expected? Is there a way to link with the missing packages by linking to the libs through version provided by msys?
https://github.com/conan-io/conan-center-index/tree/master/recipes/ffmpeg
Thanks for any tips, suggestions, help -Trevor
How to reproduce it
conan install . --build=missing
Hi @TrevorCash
Thanks for your question.
Could you please clarify a bit more #ffmpeg gives PKG_CONFIG_PATH ERRORS?
What are the errors that you are seeing? Maybe you can post some output logs that show those errors. If it happens in some specific dependency of ffmpeg, maybe it can be reduced to that single dependency with a single self.requires() to that dependency?
Hi @memsharded ,
Here is the error I get when enabling libx265. I initially had nothing disabled and continued to see a pkg-config error like this. So I disabled from the top of the list to the bottom untill I could get a error -free build:
-------- Installing package ffmpeg/6.1.1 (25 of 25) --------
ffmpeg/6.1.1: Building from source
ffmpeg/6.1.1: Package ffmpeg/6.1.1:3e9dfae047842b87427ebcfc96724d1df3eceecf
ffmpeg/6.1.1: Copying sources to build folder
ffmpeg/6.1.1: Building your package in C:\Users\tcash\.conan2\p\b\ffmpe95cbbfa0f10b1\b
ffmpeg/6.1.1: Calling generate()
ffmpeg/6.1.1: Generators folder: C:\Users\tcash\.conan2\p\b\ffmpe95cbbfa0f10b1\b\build-debug\conan
ffmpeg/6.1.1: Generating aggregated env files
ffmpeg/6.1.1: Generated aggregated env files: ['conanbuild.sh', 'conanbuild.bat']
ffmpeg/6.1.1: Calling build()
ffmpeg/6.1.1: apply_conandata_patches(): No patches defined in conandata
ffmpeg/6.1.1: RUN: "/c/users/tcash/.conan2/p/b/ffmpe95cbbfa0f10b1/b/src/configure" --enable-shared --disable-static --prefix=/ --bindir=${prefix}/bin --libdir=${prefix}/lib --pkg-config-flags=--static --disable-doc --disable-cross-compile --enable-asm --enable-shared --disable-static --enable-pic --enable-avdevice --enable-avcodec --enable-avformat --enable-swresample --enable-swscale --enable-postproc --enable-avfilter --enable-bzlib --enable-zlib --enable-lzma --enable-iconv --disable-libopenjpeg --disable-libopenh264 --disable-libvorbis --disable-libopus --disable-libzmq --disable-sdl2 --disable-libx264 --enable-libx265 --disable-libvpx --enable-libmp3lame --enable-libfdk-aac --disable-libwebp --disable-libaom --enable-openssl --disable-alsa --disable-libpulse --disable-vaapi --disable-libdrm --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-vulkan --disable-libdav1d --disable-jni --disable-mediacodec --disable-xlib --disable-cuda --disable-cuvid --enable-nonfree --enable-gpl --disable-libsvtav1 --arch=x86_64 --disable-optimizations --disable-mmx --disable-stripping --enable-debug --cc=cl.exe --cxx=cl.exe --pkg-config=/c/users/tcash/.conan2/p/pkgcoe6fcefd89afdc/p/bin/pkgconf.exe --toolchain=msvc "--extra-cflags=-MDd -Zi -Ob0 -Od -FS" --extra-ldflags=-debug
conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.4
[vcvarsall.bat] Environment initialized for: 'x64'
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
ERROR: x265 not found using pkg-config
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.libera.chat.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
ffmpeg/6.1.1: ERROR:
Package '3e9dfae047842b87427ebcfc96724d1df3eceecf' build failed
ffmpeg/6.1.1: WARN: Build folder C:\Users\tcash\.conan2\p\b\ffmpe95cbbfa0f10b1\b\build-debug
ERROR: ffmpeg/6.1.1: Error in build() method, line 728
autotools.configure()
ConanException: Error 1 while executing
Ok, thanks for the feedback.
It would be nice to see your full profile info, also, any other special configuration that you might be using (is it a regular terminal?) Because in my current Windows, msvc 2022, there are binary packages in ConanCenter, so I don't need to build from source.
So basically conan install --requires=ffmpeg/6.1.1 --build=missing gives you that error? Did the other packages, all the transitive dependencies of ffmpeg build without issues?
I use a gitbash terminal. The other dependancies built locally without issue.
I first call conan profile detect to get the default profile: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=14 compiler.runtime=dynamic compiler.version=194 os=Windows
The command I run is actually this from within a bash script:
conan install .. --output-folder=. --build=missing -s build_type=$BUILD_TYPE
using a clean terminal I get the error when specifying build_type=Debug. build_type=Release runs without errors like you say - so I guess this is a Debug specific issue.
$ conan install --requires=ffmpeg/6.1.1 --build=missing -s build_type=Debug
======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Debug
compiler.version=194
os=Windows
Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=14
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Windows
======== Computing dependency graph ========
Graph root
cli
Requirements
brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519 - Cache
bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache
cpuinfo/cci.20231129#15e94782b128bee8bfd047f6102a4d21 - Cache
dav1d/1.4.3#5e2459e132c77183bd16d23d12fd8f4a - Cache
ffmpeg/6.1.1#8a78efc06468bfc8b00a78926dcc6363 - Cache
freetype/2.13.2#7934d59c447d72edcd56025dc60e1aeb - Cache
libaom-av1/3.6.1#a2b22c70d6fce43887881431808ab8a6 - Cache
libfdk_aac/2.0.3#0115f6598be7303e042684e3a846b12d - Cache
libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache
libmp3lame/3.100#44b12d19316eb2b223d98d3e75dae438 - Cache
libpng/1.6.43#c219d8f01983bac10c404fc613605eef - Cache
libsvtav1/2.1.0#d8c1783004eefc3980710bbc72ba8a4f - Cache
libvpx/1.14.1#3b2a56aea1e29b9a8f7753030c620f38 - Cache
libwebp/1.3.2#52f69c4a31c5cf033fdd9230d77a8e38 - Cache
libx264/cci.20240224#3c88c23b44dfb42c6d5ccbc5c04900c7 - Cache
libx265/3.4#719e50b2b2c3fd1b9133fea12da42c62 - Cache
ogg/1.3.5#062626875f5c8c59f069f76f148098ef - Cache
openh264/2.4.1#f65570895428516317d5236ac3bc5360 - Cache
openjpeg/2.5.2#6f7b733e151d1bbf5ed05cbabb846828 - Cache
openssl/3.3.1#279e86dc2a7dded8c1fe8512e775bdb1 - Cache
opus/1.4#54631f551fc450783fb2df8cd63f80a2 - Cache
vorbis/1.3.7#37e58f52e59a6232199b34ef402714a6 - Cache
xz_utils/5.4.5#51e5a6e6564f4ea3afd79def01f035ad - Cache
zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache
Build requirements
cmake/3.30.1#6d832cf2d46f6ec969ca5ed5b41f91eb - Cache
meson/1.2.2#29cf77c283f6af08818f6fd8068c37e8 - Cache
meson/1.3.2#726f715cfedf3f94cc4d30a5d5d9c281 - Cache
meson/1.4.0#d04d88a761cf81e05206dbbe0f1bfea2 - Cache
meson/1.4.1#d1b27e4988cfee59b212addebb1474d5 - Cache
msys2/cci.latest#f6bb451a181a3f452024ea43ca744061 - Cache
nasm/2.15.05#058c93b2214a49ca1cfe9f8f26205568 - Cache
nasm/2.16.01#d0aebbd20ccbb6ad9c9c753ab708098c - Cache
ninja/1.12.1#fd583651bf0c6a901943495d49878803 - Cache
pkgconf/2.1.0#27f44583701117b571307cf5b5fe5605 - Cache
pkgconf/2.2.0#6462942a22803086372db44689ba825f - Cache
strawberryperl/5.32.1.1#707032463aa0620fa17ec0d887f5fe41 - Cache
yasm/1.3.0#fb800a15413dca19bfaef9e4b5d50694 - Cache
Resolved version ranges
cmake/[>=3.16 <4]: cmake/3.30.1
libpng/[>=1.6 <2]: libpng/1.6.43
ninja/[>=1.10.2 <2]: ninja/1.12.1
openssl/[>=1.1 <4]: openssl/3.3.1
zlib/[>=1.2.11 <2]: zlib/1.3.1
======== Computing necessary packages ========
bzip2/1.0.8: Checking 1 compatible configurations
bzip2/1.0.8: Main binary package 'dd62ce301c6ef0d8f7729c263acbaf3a11b7c621' missing. Using compatible package '7bde698069de06159da4d4f7bb174ecdafdbc48b': compiler.version=193
zlib/1.3.1: Checking 1 compatible configurations
zlib/1.3.1: Main binary package '8b7e35f91e516e42ed736c6dd52a9263da3a5dad' missing. Using compatible package 'ed44dacde2751b398e4bf9441ff992a70c913c00': compiler.version=193
libiconv/1.17: Checking 1 compatible configurations
libiconv/1.17: Main binary package '8b7e35f91e516e42ed736c6dd52a9263da3a5dad' missing. Using compatible package 'ed44dacde2751b398e4bf9441ff992a70c913c00': compiler.version=193
ffmpeg/6.1.1: Checking 1 compatible configurations
ffmpeg/6.1.1: Compatible configurations not found in cache, checking servers
ffmpeg/6.1.1: '86df87b5cae595df0c177e5be34bb567550b4e9c': compiler.version=193
Requirements
brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519:e61b328c57a7dac78df341bc28d447e08bf608e7#1480f793b5ba870d19a9c1f6ae47b947 - Cache
bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4:7bde698069de06159da4d4f7bb174ecdafdbc48b#a59b7e025c48dc10bacb5c71ef1b5d72 - Cache
cpuinfo/cci.20231129#15e94782b128bee8bfd047f6102a4d21:65090431ebf7c956d369b2d263a55d423da01016#90154a41b16404ea9be4ee1fc717302d - Cache
dav1d/1.4.3#5e2459e132c77183bd16d23d12fd8f4a:3c6f013c62611b113eee0f142c9264ed813ff0e8#048b67bfb87959f5a175d38b4fd5d2ce - Cache
ffmpeg/6.1.1#8a78efc06468bfc8b00a78926dcc6363:a5a0e6255e50f4267ff4283e8760908e3fd42c91 - Build
freetype/2.13.2#7934d59c447d72edcd56025dc60e1aeb:8c8e819f72bf238a61323610becf843e3fd7289a#bc0ce2cdd9f0448265531579bf196e77 - Cache
libaom-av1/3.6.1#a2b22c70d6fce43887881431808ab8a6:d161847d794c090c6b2347a492617e6cfe149cf3#e501cb22f60295bc5b97323c815bd051 - Cache
libfdk_aac/2.0.3#0115f6598be7303e042684e3a846b12d:4631f2a20e70ab5c624ced8299b9b57d4e967722#5261dbe37d850b5dbf2b598a4b06c44f - Cache
libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd:ed44dacde2751b398e4bf9441ff992a70c913c00#f6a7ae60206a6967de92199ed9457817 - Cache
libmp3lame/3.100#44b12d19316eb2b223d98d3e75dae438:8b7e35f91e516e42ed736c6dd52a9263da3a5dad#d851a2dcfa4e44b7edcd5de79af3b1a6 - Cache
libpng/1.6.43#c219d8f01983bac10c404fc613605eef:34b444759868b4ce4f04f81d4ad4927bd78d7d3e#7b05dba89b14e1695577a84904bdf308 - Cache
libsvtav1/2.1.0#d8c1783004eefc3980710bbc72ba8a4f:ed2105a1e8c89cfcb33e0e691b2673c21050a9e0#a7811d93950448700d95d33b888c6733 - Cache
libvpx/1.14.1#3b2a56aea1e29b9a8f7753030c620f38:27388023a2e5e6540b87427f946edfb9b4586f97#adcc7c8a82dcbfedc421460fcb2d20c9 - Cache
libwebp/1.3.2#52f69c4a31c5cf033fdd9230d77a8e38:95a60f3a0ed7a5980349d2d7d573f4b84fe14961#762b63ea22a804d7e8557ed9f70da24c - Cache
libx264/cci.20240224#3c88c23b44dfb42c6d5ccbc5c04900c7:2f6e92487da796acf684d4224dffc7481faf5524#dc2ef2b25400fcfaf2e507804a52440f - Cache
libx265/3.4#719e50b2b2c3fd1b9133fea12da42c62:1d1bdf97d2f04035facc45dbbd9367689c72c5e8#29fa55363411c0882f987ac37ee74021 - Cache
ogg/1.3.5#062626875f5c8c59f069f76f148098ef:8b7e35f91e516e42ed736c6dd52a9263da3a5dad#447311a8e1e57245cd2b2985ae7b805d - Cache
openh264/2.4.1#f65570895428516317d5236ac3bc5360:4631f2a20e70ab5c624ced8299b9b57d4e967722#aa0b5385bc31d6cb3880cfe3779f412a - Cache
openjpeg/2.5.2#6f7b733e151d1bbf5ed05cbabb846828:8b7e35f91e516e42ed736c6dd52a9263da3a5dad#ade482c7030d29a3653dfdbeb38ea754 - Cache
openssl/3.3.1#279e86dc2a7dded8c1fe8512e775bdb1:c6796611a63334e83ec731d8adba99e6f1492955#33b211c8ad40ecf28c0dbec48a6ed652 - Cache
opus/1.4#54631f551fc450783fb2df8cd63f80a2:2aa11e8db72dd0cb3a383cc0b2b78c12506511d3#97909a6149b9acde003351126631f3dd - Cache
vorbis/1.3.7#37e58f52e59a6232199b34ef402714a6:bb6071f9f2be46b80f5a89df16ef8b448ccb8a9e#1b7296247a9d86dec213f072611d7f72 - Cache
xz_utils/5.4.5#51e5a6e6564f4ea3afd79def01f035ad:8b7e35f91e516e42ed736c6dd52a9263da3a5dad#58324cd10db66993e2fb967315b7bea1 - Cache
zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:ed44dacde2751b398e4bf9441ff992a70c913c00#f8fd19b864e677bea9973dd860c33fa8 - Cache
Build requirements
msys2/cci.latest#f6bb451a181a3f452024ea43ca744061:956a88975bda9dfcc485e2861d71e74bd7e2b9a5#a4d094e33a7cec3c59a0489115a170c6 - Cache
pkgconf/2.1.0#27f44583701117b571307cf5b5fe5605:43771b8671ac44479c188dd72670e2eb2d7918a6#302b4a47f55f982ddf140855abd5bf1f - Cache
yasm/1.3.0#fb800a15413dca19bfaef9e4b5d50694:723257509aee8a72faf021920c2874abc738e029#68bb37bc24509a0529e3363ecac8f9e3 - Cache
Skipped binaries
cmake/3.30.1, meson/1.2.2, meson/1.3.2, meson/1.4.0, meson/1.4.1, nasm/2.15.05, nasm/2.16.01, ninja/1.12.1, pkgconf/2.2.0, strawberryperl/5.32.1.1
======== Installing packages ========
brotli/1.1.0: Already installed! (1 of 27)
bzip2/1.0.8: Already installed! (2 of 27)
cpuinfo/cci.20231129: Already installed! (3 of 27)
libfdk_aac/2.0.3: Already installed! (4 of 27)
libmp3lame/3.100: Already installed! (5 of 27)
libwebp/1.3.2: Already installed! (6 of 27)
msys2/cci.latest: Already installed! (7 of 27)
ogg/1.3.5: Already installed! (8 of 27)
openjpeg/2.5.2: Already installed! (9 of 27)
opus/1.4: Already installed! (10 of 27)
xz_utils/5.4.5: Already installed! (11 of 27)
yasm/1.3.0: Already installed! (12 of 27)
yasm/1.3.0: Appending PATH environment variable: C:\Users\tcash\.conan2\p\yasm78b751d76798d\p\bin
zlib/1.3.1: Already installed! (13 of 27)
libaom-av1/3.6.1: Already installed! (14 of 27)
libiconv/1.17: Already installed! (15 of 27)
libvpx/1.14.1: Already installed! (16 of 27)
dav1d/1.4.3: Already installed! (17 of 27)
libx264/cci.20240224: Already installed! (18 of 27)
libx265/3.4: Already installed! (19 of 27)
pkgconf/2.1.0: Already installed! (20 of 27)
pkgconf/2.1.0: WARN: The use of 'unix_path_legacy_compat' is deprecated in Conan 2.0 and does not perform path conversions. This is retained for compatibility with Conan 1.x and will be removed in a future version.
openh264/2.4.1: Already installed! (21 of 27)
libpng/1.6.43: Already installed! (22 of 27)
vorbis/1.3.7: Already installed! (23 of 27)
libsvtav1/2.1.0: Already installed! (24 of 27)
openssl/3.3.1: Already installed! (25 of 27)
freetype/2.13.2: Already installed! (26 of 27)
-------- Installing package ffmpeg/6.1.1 (27 of 27) --------
ffmpeg/6.1.1: Building from source
ffmpeg/6.1.1: Package ffmpeg/6.1.1:a5a0e6255e50f4267ff4283e8760908e3fd42c91
ffmpeg/6.1.1: Copying sources to build folder
ffmpeg/6.1.1: Building your package in C:\Users\tcash\.conan2\p\b\ffmpea8c93cb0c406b\b
ffmpeg/6.1.1: Calling generate()
ffmpeg/6.1.1: Generators folder: C:\Users\tcash\.conan2\p\b\ffmpea8c93cb0c406b\b\build-debug\conan
ffmpeg/6.1.1: Generating aggregated env files
ffmpeg/6.1.1: Generated aggregated env files: ['conanbuild.sh', 'conanbuild.bat']
ffmpeg/6.1.1: Calling build()
ffmpeg/6.1.1: apply_conandata_patches(): No patches defined in conandata
ffmpeg/6.1.1: RUN: "/c/users/tcash/.conan2/p/b/ffmpea8c93cb0c406b/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --libdir=${prefix}/lib --pkg-config-flags=--static --disable-doc --disable-cross-compile --enable-asm --disable-shared --enable-static --enable-pic --enable-avdevice --enable-avcodec --enable-avformat --enable-swresample --enable-swscale --enable-postproc --enable-avfilter --enable-bzlib --enable-zlib --enable-lzma --enable-iconv --enable-libopenjpeg --enable-libopenh264 --enable-libvorbis --enable-libopus --disable-libzmq --disable-sdl2 --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libfdk-aac --enable-libwebp --enable-libaom --enable-openssl --disable-alsa --disable-libpulse --disable-vaapi --disable-libdrm --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-vulkan --enable-libdav1d --disable-jni --disable-mediacodec --disable-xlib --disable-cuda --disable-cuvid --enable-nonfree --enable-gpl --enable-libsvtav1 --arch=x86_64 --disable-optimizations --disable-mmx --disable-stripping --enable-debug --cc=cl.exe --cxx=cl.exe --pkg-config=/c/users/tcash/.conan2/p/pkgcoe6fcefd89afdc/p/bin/pkgconf.exe --toolchain=msvc "--extra-cflags=-MDd -Zi -Ob0 -Od -FS" --extra-ldflags=-debug
conanvcvars.bat: Activating environment Visual Studio 17 - amd64 - winsdk_version=None - vcvars_ver=14.4
[vcvarsall.bat] Environment initialized for: 'x64'
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
ERROR: aom >= 1.0.0 not found using pkg-config
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.libera.chat.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
ffmpeg/6.1.1: ERROR:
Package 'a5a0e6255e50f4267ff4283e8760908e3fd42c91' build failed
ffmpeg/6.1.1: WARN: Build folder C:\Users\tcash\.conan2\p\b\ffmpea8c93cb0c406b\b\build-debug
ERROR: ffmpeg/6.1.1: Error in build() method, line 728
autotools.configure()
ConanException: Error 1 while executing
Thanks very much for the feedback, it helps, interesting that it happens only in Debug (but this could make more sense, ConanCenter build less Debug configurations than Release ones, so this case might not have been covered maybe?)
I use a gitbash terminal.
Can you please try running the same command from a regular cmd terminal?
running
conan install --requires=ffmpeg/6.1.1 --build=missing -s build_type=Debug
In standard cmd terminal completed a full build! I think the msys enviroment was detected in this case.
Did you define tools.microsoft.bash:active=True and tools.microsoft.bash:subsystem=msys2 config since you are running conan from git bash? (you may also have to define tools.microsoft.bash:path since conancenter recipes rely on this config to determine whether msys2 recipe should be injected or not in tools requirements when a bash environment is required on Windows in order to build a recipe).
@SpaceIm Thanks, I specified all three config options in my global.conf file. Now I get the following on both git bash terminal and cmd terminal after removing and cleaning the ffmpeg package, and then re-installing:
-------- Installing package ffmpeg/6.1.1 (26 of 26) --------
ffmpeg/6.1.1: Building from source
ffmpeg/6.1.1: Package ffmpeg/6.1.1:a5a0e6255e50f4267ff4283e8760908e3fd42c91
ffmpeg/6.1.1: Copying sources to build folder
ffmpeg/6.1.1: Building your package in C:\Users\tcash\.conan2\p\b\ffmped290be4573166\b
ffmpeg/6.1.1: Calling generate()
ffmpeg/6.1.1: Generators folder: C:\Users\tcash\.conan2\p\b\ffmped290be4573166\b\build-debug\conan
ffmpeg/6.1.1: Generating aggregated env files
ffmpeg/6.1.1: Generated aggregated env files: ['conanbuild.sh', 'conanbuild.bat']
ffmpeg/6.1.1: Calling build()
ffmpeg/6.1.1: apply_conandata_patches(): No patches defined in conandata
ffmpeg/6.1.1: ERROR:
Package 'a5a0e6255e50f4267ff4283e8760908e3fd42c91' build failed
ffmpeg/6.1.1: WARN: Build folder C:\Users\tcash\.conan2\p\b\ffmped290be4573166\b\build-debug
ERROR: ffmpeg/6.1.1: Error in build() method, line 728
autotools.configure()
ConanException: Cannot wrap command with different envs,['C:\\Users\\tcash\\.conan2\\p\\b\\ffmped290be4573166\\b\\build-debug\\conan\\conanbuild.bat'] - ['C:\\Users\\tcash\\.conan2\\p\\b\\ffmped290be4573166\\b\\build-debug\\conan\\conanbuild.sh']
Is there a way to turn off conanbuild.bat as a generated file?
Is there a way to turn off conanbuild.bat as a generated file?
the problem is that for building with msvc compiler, the activation of vcvars.bat from VS is mandatory.
Conan generates a conanvcvars.bat wrapper to call it, which is called by the conanbuild.bat.
So this conanbuild.bat cannot be dropped, it is really necessary to activate the necessary environment to be able to build with msvc compiler.
From outside a git-bash terminal, Conan knows to activate this .bat first, then call the bash ... commands to build into the bash environment, but being already inside a bash environment makes things more challenging.
I have been able to build ffmpeg inside git bash. This is the (super ugly, totally broken) patch that I had to apply to conan code to make it work:
diff --git a/conan/tools/gnu/autotoolstoolchain.py b/conan/tools/gnu/autotoolstoolchain.py
index e5fed44cb..03fd42588 100644
--- a/conan/tools/gnu/autotoolstoolchain.py
+++ b/conan/tools/gnu/autotoolstoolchain.py
@@ -236,7 +236,7 @@ class AutotoolsToolchain:
env.append("CXXFLAGS", self.cxxflags)
env.append("CFLAGS", self.cflags)
env.append("LDFLAGS", self.ldflags)
- env.prepend_path("PKG_CONFIG_PATH", self._conanfile.generators_folder)
+ env.define_path("PKG_CONFIG_PATH", self._conanfile.generators_folder)
# Issue related: https://github.com/conan-io/conan/issues/15486
if self._is_cross_building and self._conanfile.conf_build:
compilers_build_mapping = (
diff --git a/conans/client/subsystems.py b/conans/client/subsystems.py
index ac7ca25c7..fa853069f 100644
--- a/conans/client/subsystems.py
+++ b/conans/client/subsystems.py
@@ -72,6 +72,7 @@ def _windows_bash_wrapper(conanfile, command, env, envfiles_folder):
if not shell_path:
raise ConanException("The config 'tools.microsoft.bash:path' is "
"needed to run commands in a Windows subsystem")
+ shell_path = shell_path.replace("\\", "/")
env = env or []
if subsystem == MSYS2:
# Configure MSYS2 to inherith the PATH
@@ -100,10 +101,12 @@ def _windows_bash_wrapper(conanfile, command, env, envfiles_folder):
# first and there could be commands that we want to skip
wrapped_user_cmd = environment_wrap_command(env, envfiles_folder, command,
accepted_extensions=("sh", ))
- wrapped_user_cmd = _escape_windows_cmd(wrapped_user_cmd)
+ wrapped_user_cmd = wrapped_user_cmd.replace("\\", "/")
+ #wrapped_user_cmd = _escape_windows_cmd(wrapped_user_cmd)
+ wrapped_user_cmd = wrapped_user_cmd.replace('"', r'\"')
# according to https://www.msys2.org/wiki/Launchers/, it is necessary to use --login shell
# running without it is discouraged
- final_command = '{} --login -c {}'.format(wrapped_shell, wrapped_user_cmd)
+ final_command = '{} --login -c "{}"'.format(wrapped_shell, wrapped_user_cmd)
return final_command
It is clear that things are interpreted differently while running inside a git bash:
- The PKG_CONFIG_PATH is being mixed:
/c/users/memsharded/.conan2/p/b/ffmpec2213b67078f7/b/build-release/conan:C:\ws\PortableGit\mingw64\lib\pkgconfig;C:\ws\PortableGit\mingw64\share\pkgconfig:/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig. For some reason someone is appending thepkgconfigfrom the gitbash - The
bash.exepath needs to be/, not\ - The quoting and escaping is different
At least we have something to start working on, but it seems it will be challenging to make it work smoothly from both gitbash and cmd
Let's start with some low hanging fruit: https://github.com/conan-io/conan/pull/16997
AFter the merge of the above, I have continued to investigate this.
One of the culprits of the errors is git-bash, having a confusing behavior:
$ which python
/c/ws/Python/Python36/python
$ echo $MINGW_MOUNT_POINT
/mingw64
$ echo $PKG_CONFIG_PATH
/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig
$ python
Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.getenv("PKG_CONFIG_PATH")
'C:\\ws\\PortableGit\\mingw64\\lib\\pkgconfig;C:\\ws\\PortableGit\\mingw64\\share\\pkgconfig'
So basically, the PKG_CONFIG_PATH is different when running the Python subprocess in the system, because it returns a native Windows variable-like with ; instead of :, even if you are inside git-bash, and the system expect to have Linux like paths
This is why the above env.define_path("PKG_CONFIG_PATH", self._conanfile.generators_folder) helped to make it work, because using prepend_path() instead concatenates to a broken Windows-like specification $PKG_CONFIG_PATH variable, and it seems there is little Conan can do.
Quick question:
- Are you using Python and Conan installed inside that bash environment, or is it the Python and Conan from the native Windows system?
Oh, I have just checked, git-bash doesn't have pacman or any other package manager that would allow to install more things into git-bash
So this seems a gap or a problem between the git-bash and Python ecosystems. Python is reporting a path inside git-bash with the native Windows format.
At the moment it seems I can make ffmpeg build inside a git-bash terminal with:
- Latest Conan 2.8
- myprofile:
include(default) [buildenv] PKG_CONFIG_PATH=/c/users -
conan create . --version=6.1.1 -pr=myprofile
I have added a /c/users content to make it happy, it happens that an empty variable is also not great here.
Could you please try that on your side and report if it works?
I can confirm that works for me. I launched a new git-bash terminal, created the same myprofile, and called conan create . --version=6.1.1 -pr=myprofile inside a fresh clone of conan-center-index. the command called test_package at the end.
Ok, that is good then, at least there is an almost trivial workaround/solution.
I keep trying to come up with an automated solution, but this seems challenging from Conan point of view, it is not that Conan is managing this var, it is simply writing in a file:
export PKG_CONFIG_PATH=/c/git-bash/style/path:/c/other/gitbash/path:$PKG_CONFIG_PATH
and that unfortunately expands due to the above to the broken
PKG_CONFIG_PATH=/c/git-bash/style/path:/c/other/gitbash/path:C:\ws\PortableGit\mingw64\lib\pkgconfig;C:\ws\PortableGit\mingw64\share\pkgconfig
But Conan doesn't know, define, control or can modify the C:\ws\PortableGit\mingw64\lib\pkgconfig that comes from the combination of Python inside git-bash, and I haven't found anything online about this or how to control this.
Hi @TrevorCash
I was exploring some possible fix in https://github.com/conan-io/conan/pull/17781, but then I learned that the above hack of adding PKG_CONFIG_PATH=/c/users might no longer be needed. Since https://github.com/conan-io/conan-center-index/pull/24590, the ConanCenter msys2 recipe that is used to build ffmpeg does not have issues with the PKG_CONFIG_PATH.
So irrespective of the PR, I think this issue can be closed, would you like to test and confirm? Thanks for the feedback!
Hi @memsharded ,
I started a new git bash terminal. and ran: conan install --requires=ffmpeg/6.1.1 --build=missing -s build_type=Debug
I get the attached output.
fails with: ERROR: aom >= 1.0.0 not found using pkg-config
This is with my global.conf blank. do I still need to add entries to that?
That is gitbash and not strictly msys2 so maybe thats expected. I will try msys2 later
Uhm, that is weird, a bit unexpected, I also tried in git bah and managed to get a successful build. I think I tried with build_type=Release, I'll try with Debug again.
Yes, it also built correctly with build_type=Debug.
Then I realized, you have the old msys2 revision in your cache: msys2/cci.latest#f6bb451a181a3f452024ea43ca744061:956a88975bda9dfcc485e2861d71e74bd7e2b9a5#a4d094e33a7cec3c59a0489115a170c6
the fix was done in the msys2 recipe, so it is needed to update it. Please make sure to update your msys2 (conan remove msys2* -c) then try again.
Then, I am a bit lost, no idea what could it be. I did a full build of all dependencies from source, because I had no Debug binaries for any dependencies, I don't know if it might be worth doing a full clean build just to check.
I removed my .conan2 directory and re-ran in gitbash shell:
different error this time:
libsvtav1/2.1.0: ERROR:
Package 'ed2105a1e8c89cfcb33e0e691b2673c21050a9e0' build failed
libsvtav1/2.1.0: WARN: Build folder C:\Users\casht\.conan2\p\b\libsv6866f3223809c\b\build
ERROR: libsvtav1/2.1.0: Error in build() method, line 121
cmake.configure()
ConanException: Error 3221225477 while executing
That is indeed a new one. The error code is an "access violation":
The error code is an access violation. That means your code is referencing memory.
From the last lines in your log, it would look like cmake executable itself is the one that has crashed with such an access violation, that would be something pretty unusual, anything special in your installed cmake?
Is it deterministic? If you launch the build again, so it will pick up on the build, starting with libsvtav1/2.1.0, does it crash again in the same way?
Repeating conan install --requires=ffmpeg/6.1.1 --build=missing -s build_type=Debug
results in the same error repeatedly.
Heres my version info.
casht@SuperCruzer2000 MINGW64 /c/Users/casht
$ which cmake
/c/Program Files/CMake/bin/cmake
casht@SuperCruzer2000 MINGW64 /c/Users/casht
$ which conan
/c/Users/casht/AppData/Local/Programs/Python/Python312/Scripts/conan
casht@SuperCruzer2000 MINGW64 /c/Users/casht
$ cmake --version
cmake version 3.25.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
casht@SuperCruzer2000 MINGW64 /c/Users/casht
$ conan --version
Conan version 2.12.2
running
conan remove libsvtav*
and then
conan install --requires=ffmpeg/6.1.1 --build=missing -s build_type=Debug
still results to the same error.
Update, I have done a re-test, and it seems with some of the changes that were done in previous releases, the build works in git-bash just with the change to Conan:
diff --git a/conan/tools/gnu/autotoolstoolchain.py b/conan/tools/gnu/autotoolstoolchain.py
index 8f261f552..374ee8ba2 100644
--- a/conan/tools/gnu/autotoolstoolchain.py
+++ b/conan/tools/gnu/autotoolstoolchain.py
@@ -296,7 +296,8 @@ class AutotoolsToolchain:
env.append("CXXFLAGS", self.cxxflags)
env.append("CFLAGS", self.cflags)
env.append("LDFLAGS", self.ldflags)
- env.prepend_path("PKG_CONFIG_PATH", self._conanfile.generators_folder)
+ # env.prepend_path("PKG_CONFIG_PATH", self._conanfile.generators_folder)
+ env.define_path("PKG_CONFIG_PATH", self._conanfile.generators_folder)
# Objective C/C++
self._include_obj_arc_flags(env)
# Issue related: https://github.com/conan-io/conan/issues/15486
So getting closer...
So basically, the issue is reduced to:
- Executing in a git-bash terminal:
echo $PKG_CONFIG_PATH /mingw64/lib/pkgconfig:/mingw64/share/pkgconfig - But executing Python
subprocess.run("echo %PKG_CONFIG_PATH%", check=True, shell=True)in the same git-bash terminal:C:\ws\cmder\vendor\git-for-windows\mingw64\lib\pkgconfig;C:\ws\cmder\vendor\git-for-windows\mingw64\share\pkgconfig
So python is taking the current environment and somehow converting it to windows style paths, even if the shell is git-bash
I have checked other bash terminals:
- msys2:
$ echo $PKG_CONFIG_PATH
/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig
$ python
Python 3.12.9 (main, Feb 6 2025, 15:56:43) [GCC 13.3.0] on cygwin
>>> import subprocess
>>> subprocess.run("echo $PKG_CONFIG_PATH", check=True, shell=True)
/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig
- msys2-mingw64
$ echo $PKG_CONFIG_PATH
/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig
$ python
Python 3.12.9 (main, Feb 13 2025, 09:16:40) [GCC 14.2.0 64 bit (AMD64)] on win32
>>> import subprocess
>>> subprocess.run("echo %PKG_CONFIG_PATH%", check=True, shell=True)
C:\ws\msys64\mingw64\lib\pkgconfig;C:\ws\msys64\mingw64\share\pkgconfig