amiaopensource / homebrew-amiaos

Homebrew tap for AMIA Open Source
MIT License
29 stars 14 forks source link

ffmpegdecklink: x264 not found using pkg-config #362

Open pjotrek-b opened 1 year ago

pjotrek-b commented 1 year ago

Hi everyone! :smiley:

I keep running into the following error brewing ffmpegdecklink on Xubuntu 20.04.6:

ERROR: x264 not found using pkg-config

The current brew-recipe downloads ffmpeg v5.1.2: (https://github.com/amiaopensource/homebrew-amiaos/blob/6909a7a2bb25078a4992808eae617362d01d6e56/ffmpegdecklink.rb#L4)

It worked flawlessly on my previous Ubuntu 20.04 setup (ffmpeg v4.4). I'm guessing it may be related to an issue posted on ffmpeg-user "ffmpeg > 5.0 refuses to build with x264-static"?

I'm currently trying to adjust the brew-recipe with the workaround/fix mentioned in the above post:

I've never edited brew-recipes before, so it may take a while, but I thought I'd post this here in case someone else also runs into this :smile:

pjotrek-b commented 1 year ago

Here's the complete and partially cut :wink: commandline and console output:

$ brew install ffmpegdecklink --with-iec61883

==> Fetching amiaopensource/amiaos/ffmpegdecklink ==> Downloading https://ffmpeg.org/releases/ffmpeg-5.1.2.tar.xz Already downloaded: /home/arkthis/.cache/Homebrew/downloads/7f8448ac2cf8ab4812d1b22a41a9e768f7b2c537f9a79a74bde1e0a91752a54c--ffmpeg-5.1.2.tar.xz ==> Installing ffmpegdecklink from amiaopensource/amiaos ==> ./configure --disable-shared --enable-version3 --cc=gcc-13 --host-cflags= --host-ldflags= --enable-gpl --enable-libfreetype --enab Last 15 lines from /home/arkthis/.cache/Homebrew/Logs/ffmpegdecklink/01.configure: --disable-libjack --disable-indev=jack --enable-libiec61883 --enable-nonfree --enable-decklink --extra-cflags=-I/home/linuxbrew/.linuxbrew/include --extra-ldflags=-L/home/linuxbrew/.linuxbrew/include

ERROR: x264 not found using pkg-config [...]

retokromer commented 1 year ago

@pjotrek-b Thank you for reporting! This should be resolved in https://github.com/amiaopensource/homebrew-amiaos/pull/349. Could you possibly test?

pjotrek-b commented 1 year ago

Hi Reto! Thanks. will test.

btw: I've also tried using the ffmpeg-v4.4 recipe (from git history) - same "libx264 not found" error. Anyways: I'll test with #349.

Cheers!

pjotrek-b commented 1 year ago

@retokromer: Unfortunately, ffmpeg v6 has the same issue:

ERROR: x264 not found using pkg-config :cry:

The following codecs are all not found by pkg-config (disabled them one by one in the brew-recipe), until configure is happy and it start to run "make":

--enable-libx264
--enable-libx265
--enable-libxvid

But build fails with quite nasty errors (ffmpeg v5 and v6):

==> make Last 15 lines from /home/arkthis/.cache/Homebrew/Logs/ffmpegdecklink/02.make: ./libavcodec/x86/mathops.h:125: Error: operand type mismatch for shr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch forshr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch for shr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch forshr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch for shr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch forshr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch for shr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch forshr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch for shr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch forshr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch for shr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch forshr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch for shr' ./libavcodec/x86/mathops.h:125: Error: operand type mismatch forshr' make: *** [ffbuild/common.mak:81: libavformat/adtsenc.o] Error 1

pjotrek-b commented 1 year ago

Is there something like "make clean" for brew?

pjotrek-b commented 1 year ago

btw, here's the output of pkg-config --debug x264:

no output option set, defaulting to --exists Error printing disabled by default due to use of output options --exists, --atleast/exact/max-version, --list-all or no output option at all. Value of --print-errors: 0 Error printing disabled Adding virtual 'pkg-config' package to list of known packages Looking for package 'x264' Looking for package 'x264-uninstalled' Reading 'x264' from file '/home/linuxbrew/.linuxbrew/lib/pkgconfig/x264.pc' Parsing package file '/home/linuxbrew/.linuxbrew/lib/pkgconfig/x264.pc' line>prefix=/home/linuxbrew/.linuxbrew/Cellar/x264/r3095 Variable declaration, 'prefix' has value '/home/linuxbrew/.linuxbrew/Cellar/x264/r3095' line>exec_prefix=${prefix} Variable declaration, 'exec_prefix' has value '/home/linuxbrew/.linuxbrew/Cellar/x264/r3095' line>libdir=${exec_prefix}/lib Variable declaration, 'libdir' has value '/home/linuxbrew/.linuxbrew/Cellar/x264/r3095/lib' line>includedir=${prefix}/include Variable declaration, 'includedir' has value '/home/linuxbrew/.linuxbrew/Cellar/x264/r3095/include' line> line>Name: x264 line>Description: H.264 (MPEG4 AVC) encoder library line>Version: 0.164.3095 line>Libs: -L${exec_prefix}/lib -lx264 line>Libs.private: -lpthread -lm -ldl Unknown keyword 'Libs.private' in '/home/linuxbrew/.linuxbrew/lib/pkgconfig/x264.pc' line>Cflags: -I${prefix}/include -DX264_API_IMPORTS Path position of 'x264' is 1 Adding 'x264' to list of known packages

retokromer commented 1 year ago

Is there something like "make clean" for brew?

brew cleanup or even brew cleanup --prune=all

retokromer commented 1 year ago

We also modified the troubleshooting page.

pjotrek-b commented 1 year ago

Thanks for the quick reply! Something is "dirty" in my install - because now the v4.4 build also fails with the same mathops.h errors. Will try cleaning up first :smile:

retokromer commented 1 year ago

Try also a brew upgrade before reinstalling ffmpegdecklink.

pjotrek-b commented 1 year ago

Not sure if this is related, but Mozilla devs ran into the "mathops" issue less than a month ago: https://bugzilla.mozilla.org/show_bug.cgi?id=1846703

And here on FFmpeg's tracker: https://fftrac-bg.ffmpeg.org/ticket/10405

both seem to conclude:

"It's a change in binutils that has worked its way through."

@retokromer: Seems you already addressed that patch? (https://github.com/amiaopensource/homebrew-amiaos/blob/b81dbb4dead96b775cbdd4f31f7f15a47c6d2fc1/ffmpegdecklink.rb)

Disabled x264,x265,xvid - and crossing fingers for successful build!

retokromer commented 1 year ago

@pjotrek-b Please test again with the again patched formula.

pjotrek-b commented 1 year ago

The "x264-x265-xvid not found by pkg-config" issue is still present, but now "make" runs successfully.

privatezero commented 1 year ago

@pjotrek-b, does running pkg-config --print-errors x264 give you any useful output?

bravoalphatango commented 7 months ago

Wanted to add to this thread since the issue was still open. Not sure which patches are being referred to toward the end of this post since a lot had been discussed, but I was running into a similar issue as @pjotrek-b. When trying to reinstall vrecord on my work laptop (M1 Mac running MacOS Monterey 12.6.5) and I was getting the following error:

Last 15 lines from /Users/tothba/Library/Logs/Homebrew/ffmpegdecklink/02.make:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavutil/macros.h:53:34: note: expanded from macro 'FF_ARRAY_ELEMS'
#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
^~~
libavutil/hwcontext_vulkan.c:1444:29: error: invalid application of 'sizeof' to
an incomplete type 'const VulkanOptExtension[]'
for (int j = 0; j < FF_ARRAY_ELEMS(optional_device_exts); j++) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavutil/macros.h:53:34: note: expanded from macro 'FF_ARRAY_ELEMS'
#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
^~~
4 errors generated.
CC libavutil/lzo.o
make: *** [libavutil/hwcontext_vulkan.o] Error 1
make: *** Waiting for unfinished jobs....
CC libavutil/mastering_display_metadata.o
If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrewcore):
https://github.com/amiaopensource/homebrew-amiaos/issues
These open issues may also help:
ffmpegdecklink: fontconfig not found using pkg-config https://github.com/amiaope
nsource/homebrew-amiaos/issues/360
ffmpegdecklink: x264 not found using pkg-config https://github.com/amiaopensourc
e/homebrew-amiaos/issues/362

Seems like whatever the issues were, they were preventing vrecord from compiling. Downloaded ffmpegdecklink.rb and took out “fontconfig” and “x264” from the Ruby source code and told it to disable VulkanOptExtension (since it seems to be for 3D rendering???) and vrecord seems to be working now.

Added

--disable-vulkan

Removed

depends_on "x264"
depends_on "fontconfig"
--enable-libx264
--enable-libfontconfig

I know this is not best practice but it allowed me to continue with brew install ./ffmpegdecklink.rb.

bravoalphatango commented 7 months ago

What is strange is that even though I got vrecord to install with the help of @cajunjoel on all our computers (Intel and M1) I am now getting errors on the Intel Mac Mini but NOT the M1 Macbook Pro:

2018 Intel Core i7 Mac Mini running Monterey 12.7.2:

tothba@SIA-3118AV-1 ~ % avfctl --list_devices
avfctl - control and capture from DV tape players via AVFoundation
version 0.21.11

Usage: avfctl [Options...] [OutputFile]

"avfctl -h" for displaying more information.

Usage: avfctl [Options...] [OutputFile]

"avfctl -h" for displaying more information.


- Can capture with the `avfctl -cmd capture filename.dv` command but not preview window appears during transfer and logs are not created.

These issues seem similar to what @libbyhopfauf and I were experiencing recently that is explained in more depth here: https://github.com/mipops/dvrescue/issues/760
libbyhopfauf commented 7 months ago

@bravoalphatango this does sound similar to the issue I was experiencing! @dericed can correct me if I am wrong, but I believe that the new DVRescue release will be rolled into vrecord to replace avfctl, so it could possibly resolve this on your end?