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

[question] ffmpeg/6.1.1 dependancies and PKG_CONFIG #16963

Open
TrevorCash opened this issue Sep 9, 2024 · 11 comments
Open

[question] ffmpeg/6.1.1 dependancies and PKG_CONFIG #16963

TrevorCash opened this issue Sep 9, 2024 · 11 comments
Assignees
Milestone

Comments

@TrevorCash
Copy link

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

@TrevorCash TrevorCash changed the title [bug] [question] ffmpeg/6.1.1 dependancies and PKG_CONFIG Sep 9, 2024
@memsharded memsharded added this to the 2.8.0 milestone Sep 9, 2024
@memsharded
Copy link
Member

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?

@TrevorCash
Copy link
Author

TrevorCash commented Sep 9, 2024

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

@memsharded
Copy link
Member

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?

@TrevorCash
Copy link
Author

TrevorCash commented Sep 9, 2024

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

@memsharded
Copy link
Member

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?

@TrevorCash
Copy link
Author

TrevorCash commented Sep 9, 2024

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.

@SpaceIm
Copy link
Contributor

SpaceIm commented Sep 11, 2024

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).

@TrevorCash
Copy link
Author

TrevorCash commented Sep 13, 2024

@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?

@memsharded
Copy link
Member

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.

@memsharded
Copy link
Member

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 the pkgconfig from the gitbash
  • The bash.exe path 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

@memsharded
Copy link
Member

Let's start with some low hanging fruit: #16997

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

No branches or pull requests

4 participants