Opened 8 years ago

Closed 8 years ago

#5158 closed defect (invalid)

Configure error with clang on Android NDK

Reported by: Marco Pracucci Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I successfully build and run in production ffmpeg on Android (arm and x86) compiled with Android NDK's gcc. Recently, Android deprecated gcc and is pushing every dev to migrate to clang.

I'm getting some issues while compiling ffmpeg with Android NDK's clang and this is the first one I encounter:

GNU assembler not found, install/update gas-preprocessor

Despite the message, looks that error is more subtle. Below you can find the full instructions to reproduce it (it fixes with --disable-asm but with gcc I'm able to compile with asm support).

Versions:

  • ffmpeg 2.8.4
  • Compile on OSX 10.9.5

### Download Android NDK

You can download the Android NDK from here:
http://developer.android.com/ndk/downloads/index.html

### Install Android NDK

Follow the installation instructions in the download and then set the environment variable NDK_DIR to the directory where you extracted the NDK.

### Build NDK standalone toolchain

Define an environment variable TOOLCHAIN_DIR with the full path of the directory where the standalone toolchain should be installed. For example:
export TOOLCHAIN_DIR=/tmp/toolchain

Then build the toolchain:
${NDK_DIR}/build/tools/make-standalone-toolchain.sh \

--toolchain=arm-linux-androideabi-clang3.6 \
--platform=android-9 \
--install-dir=${TOOLCHAIN_DIR}

### Compile ffmpeg

The the following configure script:

./configure \

--enable-shared \
--disable-static \
--enable-gpl \
--enable-version3 \
--enable-nonfree \
--disable-runtime-cpudetect \
--disable-all \
--disable-doc \
--enable-avcodec \
--enable-avformat \
--enable-avutil \
--enable-swresample \
--disable-w32threads \
--disable-os2threads \
--disable-network \
--disable-dxva2 \
--disable-vaapi \
--disable-vda \
--disable-vdpau \
--enable-protocol="file" \
--enable-decoder="aac" \
--enable-decoder="cook" \
--enable-decoder="flac" \
--enable-decoder="mp3" \
--enable-decoder="mp3adu" \
--enable-decoder="mp3adufloat" \
--enable-decoder="mp3float" \
--enable-decoder="mp3on4" \
--enable-decoder="mp3on4float" \
--enable-decoder="pcm_alaw" \
--enable-decoder="pcm_bluray" \
--enable-decoder="pcm_dvd" \
--enable-decoder="pcm_f32be" \
--enable-decoder="pcm_f32le" \
--enable-decoder="pcm_f64be" \
--enable-decoder="pcm_f64le" \
--enable-decoder="pcm_lxf" \
--enable-decoder="pcm_mulaw" \
--enable-decoder="pcm_s16be" \
--enable-decoder="pcm_s16be_planar" \
--enable-decoder="pcm_s16le" \
--enable-decoder="pcm_s16le_planar" \
--enable-decoder="pcm_s24be" \
--enable-decoder="pcm_s24daud" \
--enable-decoder="pcm_s24le" \
--enable-decoder="pcm_s24le_planar" \
--enable-decoder="pcm_s32be" \
--enable-decoder="pcm_s32le" \
--enable-decoder="pcm_s32le_planar" \
--enable-decoder="pcm_s8" \
--enable-decoder="pcm_s8_planar" \
--enable-decoder="pcm_u16be" \
--enable-decoder="pcm_u16le" \
--enable-decoder="pcm_u24be" \
--enable-decoder="pcm_u24le" \
--enable-decoder="pcm_u32be" \
--enable-decoder="pcm_u32le" \
--enable-decoder="pcm_u8" \
--enable-decoder="pcm_zork" \
--enable-decoder="ra_144" \
--enable-decoder="ra_288" \
--enable-decoder="ralf" \
--enable-decoder="vorbis" \
--enable-decoder="wmav1" \
--enable-decoder="wmav2" \
--enable-decoder="wmavoice" \
--enable-decoder="wmalossless" \
--enable-decoder="wmapro" \
--enable-parser="aac" \
--enable-parser="flac" \
--enable-parser="mpegaudio" \
--enable-parser="vorbis" \
--enable-demuxer="aac" \
--enable-demuxer="aiff" \
--enable-demuxer="asf" \
--enable-demuxer="flac" \
--enable-demuxer="ogg" \
--enable-demuxer="mp3" \
--enable-demuxer="mov" \
--enable-demuxer="pcm_alaw" \
--enable-demuxer="pcm_f32be" \
--enable-demuxer="pcm_f32le" \
--enable-demuxer="pcm_f64be" \
--enable-demuxer="pcm_f64le" \
--enable-demuxer="pcm_mulaw" \
--enable-demuxer="pcm_s16be" \
--enable-demuxer="pcm_s16le" \
--enable-demuxer="pcm_s24be" \
--enable-demuxer="pcm_s24le" \
--enable-demuxer="pcm_s32be" \
--enable-demuxer="pcm_s32le" \
--enable-demuxer="pcm_s8" \
--enable-demuxer="pcm_u16be" \
--enable-demuxer="pcm_u16le" \
--enable-demuxer="pcm_u24be" \
--enable-demuxer="pcm_u24le" \
--enable-demuxer="pcm_u32be" \
--enable-demuxer="pcm_u32le" \
--enable-demuxer="rm" \
--enable-demuxer="wav" \
--enable-cross-compile \
--toolchain=clang-usan \
--cross-prefix=${TOOLCHAIN_DIR}/bin/arm-linux-androideabi- \
--cc=${TOOLCHAIN_DIR}/bin/arm-linux-androideabi-clang \
--cxx=${TOOLCHAIN_DIR}/bin/arm-linux-androideabi-clang \
--sysroot=${TOOLCHAIN_DIR}/sysroot \
--target-os=android \
--extra-cflags="-I${TOOCHAIN_DIR}/sysroot/usr/include -ffast-math -funroll-loops -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16" \
--extra-ldflags="-L${TOOCHAIN_DIR}/sysroot/usr/lib" \
--arch="arm" \
--logfile="/tmp/ffmpeg.log"

The configure script fails with:
GNU assembler not found, install/update gas-preprocessor

It fails while running check_as (extracted from the fail of ffmpeg.log):

check_as
BEGIN /var/folders/zn/45tzvzd15tnfvp4g5847x2dm0000gn/Tffconf.a7i3f9zc.S

1 .altmacro

END /var/folders/zn/45tzvzd15tnfvp4g5847x2dm0000gn/Tffconf.a7i3f9zc.S
/tmp/toolchain/bin/arm-linux-androideabi-clang --sysroot=/tmp/toolchain/sysroot -isysroot /tmp/toolchain/sysroot -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -I/sysroot/usr/include -ffast-math -funroll-loops -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -march=armv7-a -fPIC -c -o /var/folders/zn/45tzvzd15tnfvp4g5847x2dm0000gn/T
ffconf.Ct6YZsBn.o /var/folders/zn/45tzvzd15tnfvp4g5847x2dm0000gn/Tffconf.a7i3f9zc.S
/var/folders/zn/45tzvzd15tnfvp4g5847x2dm0000gn/T
ffconf.a7i3f9zc.S:1:1: error: unknown directive
.altmacro
GNU assembler not found, install/update gas-preprocessor

The weird thing is that if I create a file containing .altmacro and run the same exact command it actually works. For example:

$ echo ".altmacro" > test.as
$ /tmp/toolchain/bin/arm-linux-androideabi-clang --sysroot=/tmp/toolchain/sysroot -isysroot /tmp/toolchain/sysroot -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -I/sysroot/usr/include -ffast-math -funroll-loops -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -march=armv7-a -fPIC -c -o /tmp/test.o test.as
$ echo $?
0

After digging for an hour in the configure script I can't actually realize why it fails. Do you have any hint?

Thank you!

Change History (4)

comment:1 by Carl Eugen Hoyos, 8 years ago

Which version of gas-preprocessor did you install?

comment:2 by Carl Eugen Hoyos, 8 years ago

And please test current FFmpeg git head to make this a valid ticket.

in reply to:  1 comment:3 by Marco Pracucci, 8 years ago

Which version of gas-preprocessor did you install?

I Don't have gas-preprocessor.pl installed, but I actually don't need it. As stated close to the end of my report, if I manually run the same exact test run by configure it passes, but it failes while running from the configure script. It's like if there's any env variable set by the configure script (or similar) that make it fails, but unfortunately I didn't understand the root cause.

And please test current FFmpeg git head to make this a valid ticket.

Same issue.

comment:4 by Carl Eugen Hoyos, 8 years ago

Resolution: invalid
Status: newclosed

I don't think this is a valid ticket, if you need help when building FFmpeg, please send an email to the user mailing list.

Note: See TracTickets for help on using tickets.