Fix for macOSX homebrew ffmpeg bundling error.

This commit is contained in:
mjbudd77 2021-10-06 18:29:58 -04:00
parent 59b8c825b5
commit 80ca06224b
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,42 @@
#!/usr/bin/perl
use strict;
# MacOSX homebrew version of ffmpeg comes with 5 libraries. These libraries depend on each other
# and it seems that macdeployqt doesn't fix all the library paths when bundling them.
# This script fixes those bundling issues.
my $i; my $j; my $k;
my $LIBPATH=`brew --prefix ffmpeg`;
my @libList = ( "libavutil", "libavcodec", "libavformat", "libswscale", "libswresample" );
my $lib; my $otool;
my @lines;
for ($i=0; $i<=$#libList; $i++)
{
#print "LIB: $libList[$i]\n";
$lib="$LIBPATH/lib/$libList[$i].dylib";
$lib=~s/\n//;
print "Fixing lib: '$lib'\n";
$otool=`otool -L $lib`;
#print "otool: '$otool'\n";
@lines = split /\n/, $otool;
for ($j=0; $j<=$#lines; $j++)
{
for ($k=0; $k<=$#libList; $k++)
{
if ( $lines[$j] =~ m/\s+(\/.*\/($libList[$k].*\.dylib))/ )
{
#print "$1 $2\n";
print("install_name_tool -change $1 \@executable_path/../Frameworks/$2 $lib\n");
system("install_name_tool -change $1 \@executable_path/../Frameworks/$2 $lib");
}
}
}
}

View File

@ -77,6 +77,9 @@ echo 'Install Optional Dependency ffmpeg'
echo '****************************************' echo '****************************************'
brew install ffmpeg brew install ffmpeg
# Fix homebrew ffmpeg libraries so that they work in the bundle.
sudo $SCRIPT_DIR/macOS_BundleFFmpegFix.pl
#brew install zlib # Already installed in appveyor macOS #brew install zlib # Already installed in appveyor macOS
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig: export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig: