title: Android FFmpeg : Undefined references to atof, log2 & log2f
body: <p>I am <strong>trying to link to FFmpeg built for android</strong> using <em>android-ndk-r15c</em>. I built this by downloading <a href="https://www.ffmpeg.org/download.html" rel="noreferrer">FFmpeg source</a> that is latest <strong>ffmpeg-3.3.4</strong>.</p>
  
  <p>Following are my linker list:</p>
  
  <pre><code>-lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample -lavdevice -lpostproc
  </code></pre>
  
  <p>I get the following errors complaining</p>
  
  <pre><code>libavformat/hls.c:783: error: undefined reference to 'atof'
  libavcodec/ffv1enc.c:146: error: undefined reference to 'log2'
  libavcodec/imc.c:428: error: undefined reference to 'log2f'
  </code></pre>
  
  <p>Following are my FFmpeg related includes:</p>
  
  <pre><code>#include &lt;stdint.h&gt;
  #include &lt;cstdlib&gt;
  
  #define __STDC_CONSTANT_MACROS
  
  extern "C" {
  
  #include "libavcodec/avcodec.h"
  #include "libavformat/avformat.h"
  #include "libavutil/mathematics.h"
  #include "libavcodec/version.h"
  #include "libavutil/rational.h"
  #include "libavutil/avstring.h"
  #include "libswscale/swscale.h"
  
  }
  </code></pre>
  
  <p>Following is my <strong>buildscript</strong> to cross-compile FFmpeg for android:</p>
  
  <pre><code>#!/bin/bash
  
  cd ffmpeg-3.3.4
  
  NDK=/path/to/ndk/android-ndk-r15c
  SYSROOT=$NDK/platforms/android-21/arch-arm/
  TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
  AR=$TOOLCHAIN/bin/arm-linux-androideabi-ar
  CPREFIX=$TOOLCHAIN/bin/arm-linux-androideabi-ar
  CC=$TOOLCHAIN/bin/arm-linux-androideabi-gcc
  CXX=$TOOLCHAIN/bin/arm-linux-androideabi-g++
  LD=$TOOLCHAIN/bin/arm-linux-androideabi-ld
  RANLIB=$TOOLCHAIN/bin/arm-linux-androideabi-ranlib
  STRIP=$TOOLCHAIN/bin/arm-linux-androideabi-strip
  
  function build_ffmpeg_android {
  
  ./configure \
      --prefix=$PREFIX \
      --disable-stripping \
      --arch=arm \
      --cpu=cortex-a8 \
      --target-os=linux \
      --enable-cross-compile \
      --enable-debug \
      --enable-pic \
      --disable-programs \
      --enable-static \
      --disable-shared \
      --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
      --disable-doc \
      --enable-postproc \
      --enable-swscale \
      --enable-avfilter \
      --enable-avresample \
      --disable-opencl \
      --disable-securetransport \
      --sysroot=$SYSROOT \
      --enable-videotoolbox \
      --enable-avresample \
      --disable-symver \
      #--enable-gpl \
      #--enable-libx264
      $ADDITIONAL_CONFIGURE_FLAG
      make clean
      make -j9
      make install
  }
  
  CPU=arm
  PREFIX=$(pwd)/android/$CPU
  ADDI_CFLAGS="-marm"
  
  build_ffmpeg_android
  </code></pre>
  
  <p><em>Question:</em><br>
  <strong>Which library am I missing to link to ?</strong></p>