title: Why can't FFmpeg code compile on different ARM 64 bit platforms？
body: <p>The same code (test_ffmpeg.c), I have compiled it on the x86_64 platform successfully, and there is no problem. I can successfully push the video to the <a href="https://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol" rel="nofollow noreferrer">RTMP</a> server. However, if I switch to the ARM 64-bit platform, there is a problem with the compilation. Why?</p>
  <ol>
  <li><p>Cross compile x264</p>
  <pre class="lang-none prettyprint-override"><code>./configure --enable-shared --disable-asm
  </code></pre>
  <p>Edit <em>config.mak</em></p>
  <pre class="lang-none prettyprint-override"><code>SRCPATH=.
  prefix=/usr/local
  exec_prefix=${prefix}
  bindir=${exec_prefix}/bin
  libdir=${exec_prefix}/lib
  includedir=${prefix}/include
  SYS_ARCH=aarch64
  SYS=LINUX
  CC=aarch64-linux-gnu-gcc
  CFLAGS=-Wno-maybe-uninitialized -Wshadow -O3 -ffast-math   -Wall -I. -I$(SRCPATH) -std=gnu99 -
  D_GNU_SOURCE  -fPIC -fomit-frame-pointer -fno-tree-vectorize
  COMPILER=GNU
  COMPILER_STYLE=GNU
  DEPMM=-MM -g0
  DEPMT=-MT
  LD=aarch64-linux-gnu-gcc -o
  LDFLAGS=  -lm -lpthread -ldl
  LIBX264=libx264.a
  AR=aarch64-linux-gnu-gcc-ar rc
  RANLIB=aarch64-linux-gnu-gcc-ranlib
  STRIP=strip
  INSTALL=install
  AS=
  ASFLAGS= -I. -I$(SRCPATH)  -f elf64 -DSTACK_ALIGNMENT=64
  -DPIC
  RC=
  RCFLAGS=
  EXE=
  HAVE_GETOPT_LONG=1
  DEVNULL=/dev/null
  PROF_GEN_CC=-fprofile-generate
  PROF_GEN_LD=-fprofile-generate
  PROF_USE_CC=-fprofile-use
  PROF_USE_LD=-fprofile-use
  HAVE_OPENCL=yes
  CC_O=-o $@
  default: cli
  install: install-cli
  SOSUFFIX=so
  SONAME=libx264.so.157
  SOFLAGS=-shared -Wl,-soname,$(SONAME)  -Wl,-Bsymbolic
  default: lib-shared
  install: install-lib-shared
  LDFLAGSCLI = -ldl
  CLI_LIBX264 = $(LIBX264)
  </code></pre>
  <p>then,</p>
  <pre class="lang-none prettyprint-override"><code>make &amp;&amp; make install
  </code></pre>
  </li>
  <li><p>Cross compile FFmpeg</p>
  <pre class="lang-none prettyprint-override"><code>./configure --arch=aarch64 --enable-cross-compile --target-os=linux --cc=aarch64-linux-gnu-gcc --
   cross-prefix=aarch64-linux-gnu- --prefix=./ffmpeg_result  --enable-shared --disable-static --
   disable-doc  --enable-gpl --enable-libx264 --extra-ldflags=-L/usr/local/lib/ --extra-libs=-ldl -
   -extra-cflags=-I/usr/local/include
  </code></pre>
  <p>Add output of ffmpeg configure:<a href="https://pastebin.com/yNpTQkAa" rel="nofollow noreferrer">output</a>.</p>
  <p>then,</p>
  <pre class="lang-none prettyprint-override"><code>make &amp;&amp; make install
  </code></pre>
  </li>
  <li><p>Cross compile file <em>test_ffmpeg.c</em></p>
  <pre class="lang-none prettyprint-override"><code>aarch64-linux-gnu-gcc test_ffmpeg.c  -lavcodec -lavdevice -lavfilter -lavformat -lavutil -L
  /data/ffmpeg-4.3/ffmpeg_result/lib -I /data/ffmpeg-4.3/ffmpeg_result/include -g
  </code></pre>
  </li>
  </ol>
  <p>An error occurred, as detailed below:</p>
  <pre class="lang-none prettyprint-override"><code>test_ffmpeg.c: In function 'main':
  test_ffmpeg.c:63:3: warning: 'codec' is deprecated [-Wdeprecated-declarations]
  AVStream *out_stream = avformat_new_stream(ofmt_ctx, in_stream-&gt;codec-&gt;codec);
  ^~~~~~~~
  In file included from test_ffmpeg.c:4:
  /data/ffmpeg-4.3/ffmpeg_result/include/libavformat/avformat.h:880:21: note: declared here
  AVCodecContext *codec;
  ^~~~~
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: warning:
  libswresample.so.3, needed by /data/ffmpeg-4.3/ffmpeg_result/lib/libavcodec.so, not found (try
  using -rpath or -rpath-link)
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: warning:
  libswscale.so.5, needed by /data/ffmpeg-4.3/ffmpeg_result/lib/libavfilter.so, not found (try
  using -rpath or -rpath-link)
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: warning:
  libpostproc.so.55, needed by /data/ffmpeg-4.3/ffmpeg_result/lib/libavfilter.so, not found (try
  using -rpath or -rpath-link)
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_freeContext@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `pp_get_context@LIBPOSTPROC_55'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `swr_alloc_set_opts@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `pp_postprocess@LIBPOSTPROC_55'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `swr_get_class@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_scaleVec@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to
  `swr_set_channel_mapping@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_getCoefficients@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavcodec.so: undefined reference to `swr_alloc@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_getGaussianVec@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to
  `pp_get_mode_by_name_and_quality@LIBPOSTPROC_55'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `swr_next_pts@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavcodec.so: undefined reference to `swr_init@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to
  `sws_setColorspaceDetails@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_isSupportedOutput@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_init_context@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavcodec.so: undefined reference to `swr_close@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_alloc_context@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_scale@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `swr_get_delay@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `pp_free_context@LIBPOSTPROC_55'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavcodec.so: undefined reference to `swr_convert@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_freeVec@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavcodec.so: undefined reference to `swr_is_initialized@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_getContext@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `pp_free_mode@LIBPOSTPROC_55'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_isSupportedInput@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_getCachedContext@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `swr_set_matrix@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to `sws_get_class@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavcodec.so: undefined reference to `swr_free@LIBSWRESAMPLE_3'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to
  `sws_getColorspaceDetails@LIBSWSCALE_5'
  /usr/lib/gcc-cross/aarch64-linux-gnu/8/../../../../aarch64-linux-gnu/bin/ld: /data/ffmpeg-
  4.3/ffmpeg_result/lib/libavfilter.so: undefined reference to
  `sws_isSupportedEndiannessConversion@LIBSWSCALE_5'
  collect2: error: ld returned 1 exit status
  </code></pre>