android_build.sh gives error while building ffmpeg

2020-05-01 07:24发布

i am trying to build ffmpeg library my android_build.sh is given below

  #!/bin/bash
   NDK=C:/Users/Benzatine/Downloads/android-ndk-r10e
   SYSROOT=$NDK/platforms/android-18/arch-arm/
   TOOLCHAIN=$NDK/toolchains//arm-linux-androideabi-4.8/prebuilt/windows-x86_64
   function build_one
   {
     ./configure \
     --arch=arm \
      --target-os=linux \
--enable-runtime-cpudetect \
--enable-pic \
--disable-shared \
--enable-static \
--extra-cflags='-march=armv6' \
--extra-ldflags="$ADDI_LDFLAGS" \
--enable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver\
--disable-network \
--enable-cross-compile \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--sysroot=$SYSROOT \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make -j4
 make install
 }
CPU=arm
PREFIX=$(pwd)/android/$CPU 
 ADDI_CFLAGS="-marm"
 build_one

but when i try to execute it always gives error

error is

    /android_build.sh: line 5: syntax error near unexpected token `$'\r''
    /android_build.sh: line 5: `function build_one()

I am new in this so please any one can help me to resolve this issue

1条回答
甜甜的少女心
2楼-- · 2020-05-01 08:16

Easy way to convert example.sh file to unix is use NotePad++ (Edit>EOL Conversion>UNIX/OSX Format)

You can also set the default EOL in notepad++ (Settings>Preferences>New Document/Default Directory>select Unix/OSX under the Format box)

Reference- syntax error near unexpected token `$'in\r''

I used this one. It solves my problem earlier.

查看更多
登录 后发表回答