Reputation: 187
I compile the ffmpeg and compiler outputs the following errors.
ld: warning: ignoring file libavdevice/libavdevice.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file libavfilter/libavfilter.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file libswresample/libswresample.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file libswscale/libswscale.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file libavutil/libavutil.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file libpostproc/libpostproc.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
ld: warning: ignoring file libavformat/libavformat.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file libavcodec/libavcodec.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
I don't understand why macOS-arm64
cannot link to macOS-arm64
.
Shouldn't an arm64 object file link to arm64 static libraries?
I'm working on an M1 macbook, and configure the ffmpeg with the following commands.
../configure --cc=/usr/bin/clang --prefix=/opt/ffmpeg --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzimg --enable-libzmq --enable-version3 --pkg-config-flags=--static --disable-ffplay --extra-cflags="-I/opt/homebrew/include" --extra-cxxflags="-I/opt/homebrew/include" --extra-ldflags="-L/opt/homebrew/lib"
The full output is here: https://pastebin.com/u9QNTitu
Upvotes: 2
Views: 6934
Reputation: 423
Looks like Clang (when invoked as gcc
) does not like linking with static libraries made by GNU ar
.
% echo "int main() { }" > a.c
% gcc -c a.c
% /opt/homebrew/opt/binutils/bin/ar rcs a.a a.o
% gcc a.a
ld: warning: ignoring file a.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
...
While, if you do the same with Apple's ar
(and take care to delete a.a
, created by binutils, first), it links correctly. The error message is just misleading in this case. This is why @Peng's answer is in the right direction. There is no need to actually remove binutils, just don't have it in your PATH
when building ffmpeg, so the build will pick up the default ar
.
Upvotes: 2
Reputation: 346
I was facing a similar error and switching node versions helped. I switched from 14 to 16.
Upvotes: 0