title: How to correctly link ffmpeg to static build "g++ -static"?
body: <p>I want to link a static build of ffmpeg when compiling a project to a static executable. I use the following command:</p>
  
  <pre><code>g++ -O2 -static -o myBin myBin-myBin.o -lm -lpthread someotherlibraries.a 
  /path/to/libavformat.a /path/to/libavcodec.a
  </code></pre>
  
  <p>but get the following list of errors, although I configured ffmpeg with --disable-libopus:</p>
  
  <pre><code>libavcodec/opusdec.c:376: error: undefined reference to 'swr_is_initialized'
  libavcodec/opusdec.c:222: error: undefined reference to 'swr_is_initialized'
  libavcodec/opusdec.c:163: error: undefined reference to 'swr_init'
  libavcodec/opusdec.c:169: error: undefined reference to 'swr_convert'
  libavcodec/opusdec.c:236: error: undefined reference to 'swr_convert'
  libavcodec/opusdec.c:117: error: undefined reference to 'swr_convert'
  libavcodec/opusdec.c:408: error: undefined reference to 'swr_close'
  libavcodec/opusdec.c:557: error: undefined reference to 'swr_close'
  libavcodec/opusdec.c:579: error: undefined reference to 'swr_free'
  libavcodec/opusdec.c:629: error: undefined reference to 'swr_alloc'
  </code></pre>
  
  <p>What am I doing wrong here?</p>