Vargol/ffmpeg-apple-arm64-build

MacBook Pro M1 Max - error compiling FFmpeg - libpng16.dylib arm64 but attempting to link with file built for macOS-x86_64

DJRMPY opened this issue · 22 comments

warning: ignoring file /usr/local/lib/libpng16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ffmpeg_g] Error 1
rm libavfilter/metal/vf_yadif_videotoolbox.metal.air libavfilter/metal/vf_yadif_videotoolbox.metallib libavfilter/metal/vf_yadif_videotoolbox.metallib.c
check failed: build of ffmpeg failed

I'n not getting the same error but a different one but it seems that either libass have changed the png decency or libpng have changed their file naming so that the ffmpeg check for libass fails as libpng16.a has not been created.

I suspect for you as the linker doesn't find libpng16.a in <build_dir>/tool/lib and continues searching and finds an old x86 version elsewhere in the search path where as for me there is no other version so mine fails with no library found for
-lpng16 instead

a quick fix for this would to create a link and build using the skip option so it doesn't rebuild everything (assuming to haven't deleted the build directory)

cd tool/lib 
ln -s png16.a libpng16.a
cd ../..
rm -rf ffmpeg
../ffmpeg-apple-arm64-build/build.sh skip

While I've been typing this a quick test of the above fix has finished compiling, so now I need to add the linking into the libpng build script and build from scratch again.

okay I've now committed the change the repo's master branch to fix the issue I had, can you see if that fixes your issue too.

ee3a71a

I have an encode going on in the background so this may take a bit, but I'll post back shortly.

This is odd. I'm getting a failure on libass now. It looks like it's failing to simply create teh subfolders? The permissions on the folder are correct.

  • [[ -d /Users/User/desktop/tmp/libass ]]

  • [[ -d /Users/User/desktop/tmp/libass ]]

  • [[ ! -d /Users/User/desktop/tmp/libass ]]

  • make_directories /Users/User/desktop/tmp/build /Users/User/desktop/tmp /Users/User/desktop/tmp/tool 10 0.15.1

  • cd /Users/User/desktop/tmp

  • checkStatus 0 'change directory failed'

  • '[' 0 -ne 0 ']'

  • mkdir libass

  • checkStatus 0 'create directory failed'

  • '[' 0 -ne 0 ']'

  • cd libass

  • checkStatus 0 'change directory failed'

  • '[' 0 -ne 0 ']'

  • download_code /Users/User/desktop/tmp/build /Users/User/desktop/tmp /Users/User/desktop/tmp/tool 10 0.15.1

  • cd /Users/User/desktop/tmp/libass

  • checkStatus 0 'change directory failed'

  • '[' 0 -ne 0 ']'

  • curl -O -L https://github.com/libass/libass/releases/download/0.15.1/libass-0.15.1.tar.xz
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed

    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

100 361k 100 361k 0 0 662k 0 --:--:-- --:--:-- --:--:-- 662k

  • checkStatus 0 'download of libass failed'
  • '[' 0 -ne 0 ']'
  • tar xf libass-0.15.1.tar.xz
  • checkStatus 0 'download of libass failed'
  • '[' 0 -ne 0 ']'
  • configure_build /Users/User/desktop/tmp/build /Users/User/desktop/tmp /Users/User/desktop/tmp/tool 10 0.15.1
  • cd /Users/User/desktop/tmp/libass/libass-0.15.1
  • checkStatus 0 'change directory failed'
  • '[' 0 -ne 0 ']'
  • LDFLAGS='-L/Users/User/desktop/tmp/tool/lib -lc++ -lpng -lbz2 -lz -lbrotlidec-static -lbrotlicommon-static'
  • ./configure --prefix=/Users/User/desktop/tmp/tool --enable-static --disable-shared --disable-fontconfig --disable-dependency-tracking
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... ./install-sh -c -d
    checking for gawk... no
    checking for mawk... no
    checking for nawk... no
    checking for awk... awk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking build system type... arm-apple-darwin22.2.0
    checking host system type... arm-apple-darwin22.2.0
    checking how to print strings... printf
    checking whether make supports the include directive... yes (GNU style)
    checking for gcc... gcc
    checking whether the C compiler works... no
    configure: error: in /Users/User/desktop/tmp/libass/libass-0.15.1': configure: error: C compiler cannot create executables See config.log' for more details
  • checkStatus 77 'configuration of libass failed'
  • '[' 77 -ne 0 ']'
  • echo 'check failed: configuration of libass failed'
    check failed: configuration of libass failed
  • exit 1

I'll need libass/libass-0.15.1/config.log to check what that issue is.

See attached.
config.log

look in ffmpeg-apple-arm64-build/build/build-libass.sh
for this section

  # prepare build
  LDFLAGS="-L$3/lib -lc++ -lpng -lbz2 -lz -lbrotlidec -lbrotlicommon"  ./configure --prefix="$3" --enable-static --disable-shared --disable-fontconfig --disable-dependency-tracking
  checkStatus $? "configuration of ${SOFTWARE} failed"

it seems you've may have an old build-libass.sh that has
-lbrotlidec-static -lbrotlicommon-static in the LD_FLAGS.
If so how did you download the script ?

I do see that in the build script.

LDFLAGS="-L$3/lib -lc++ -lpng -lbz2 -lz -lbrotlidec-static -lbrotlicommon-static" ./configure --prefix="$3" --enable-static --disable-shared --disable-fontconfig --disable-dependency-tracking
checkStatus $? "configuration of ${SOFTWARE} failed"

I just downloaded this from the "Code" section, and then clicked 'Latest' and then downloaded source.

https://github.com/Vargol/ffmpeg-apple-arm64-build/archive/refs/tags/2.5.zip

okay the 2.5 you've just linked is brand new as in 1 minute after my previous reply, so it would have been 2.0 when you last downloaded.
2.5 should have the latest fixes in but I haven't tested it yet as I'm working on a standard M1 so the build hasn't finished :-)

Lol. Point taken. I’ll wait a bit and download it again and start with a new folder.

okay, so thats random, the testing failed as this time the png build actually built libpng16.a ???

Running the 2.5 download now to see what I get. I verified the downloaded zip is actually 2.5. I'll post the results shortly.

Ah, they've backed out a change, I guessing it broke more than my build, give me a minute and I'll knock up release 2.5.1

I'll see what you get first before I check it in

Mine failed in libpng16.a

Install the project...
-- Install configuration: ""
-- Installing: /Users/Ron/desktop/tmp/tool/lib/libpng16.a
-- Installing: /Users/Ron/desktop/tmp/tool/lib/libpng.a
-- Installing: /Users/Ron/desktop/tmp/tool/include/png.h
-- Installing: /Users/Ron/desktop/tmp/tool/include/pngconf.h
-- Installing: /Users/Ron/desktop/tmp/tool/include/pnglibconf.h
-- Installing: /Users/Ron/desktop/tmp/tool/include/libpng16/png.h
-- Installing: /Users/Ron/desktop/tmp/tool/include/libpng16/pngconf.h
-- Installing: /Users/Ron/desktop/tmp/tool/include/libpng16/pnglibconf.h
-- Installing: /Users/Ron/desktop/tmp/tool/bin/libpng-config
-- Installing: /Users/Ron/desktop/tmp/tool/bin/libpng16-config
-- Installing: /Users/Ron/desktop/tmp/tool/share/man/man3/libpng.3
-- Installing: /Users/Ron/desktop/tmp/tool/share/man/man3/libpngpf.3
-- Installing: /Users/Ron/desktop/tmp/tool/share/man/man5/png.5
-- Installing: /Users/Ron/desktop/tmp/tool/lib/pkgconfig/libpng.pc
-- Up-to-date: /Users/Ron/desktop/tmp/tool/bin/libpng-config
-- Installing: /Users/Ron/desktop/tmp/tool/lib/pkgconfig/libpng16.pc
-- Up-to-date: /Users/Ron/desktop/tmp/tool/bin/libpng16-config
-- Installing: /Users/Ron/desktop/tmp/tool/lib/libpng/libpng16.cmake
-- Installing: /Users/Ron/desktop/tmp/tool/lib/libpng/libpng16-noconfig.cmake
ln: /Users/Ron/desktop/tmp/tool/lib/libpng16.a: File exists
check failed: linking libpng16.a failed

Yep..matches what I got, I'm compiling with original fix removed

Okay 2.5.1 released and tested to "works for me" level :-)

Executed successfully here too. Excellent :)

I don't really do much audio stuff, other than -c:a copy

Maybe this will help

https://www.reddit.com/r/ffmpeg/comments/s7scqu/audio_loudness_after_downmixing_from_51_to_stereo/

I think you start the -af argument with [0:a:0 ] (Video 0, audio track 0, yes ffmpeg indexing starts at 0 :-) )

"[0:a:0]lowpass=c=LF....