[FFmpeg-trac] #7785(build system:new): [Android] Configure script: Wrong HAVE_ macros are created due to "-f may not be used without -shared" error

FFmpeg trac at avcodec.org
Mon Mar 11 01:40:03 EET 2019

#7785: [Android] Configure script: Wrong HAVE_ macros are created due to "-f may
not be used without -shared" error
             Reporter:  ESt          |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  build        |                  Version:  git-
  system                             |  master
             Keywords:  Android,     |               Blocked By:
  shared, configure, ld, HAVE        |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
 Summary of the bug:
 While building for Android the configuration script seems to create some
 wrong HAVE_ macros, e. g. #define HAVE_ATANF 0, HAVE_CBRT 0,
 HAVE_LOCALTIME_R 0, etc. Which later on causes issues with the build
 itself, e.g.:

 ./libavutil/libm.h:61:31: error: static declaration of 'cbrtf' follows
 non-static declaration
 static av_always_inline float cbrtf(float x)

 The source of the problem seems to be that the 'test_ld' function throws
 the following error for those functions "-f may not be used without
 -shared". I've added ''$(if [ shared="yes" ] ; then echo "-shared" ; fi)''
 to the last line of test_ld, and it seemed to fix the problem for that
 (I'm not submitting a patch since I'm not sure this is the way the problem
 should be solved and I'm afraid it might cause errors with other builds)

     log test_ld "$@"
     shift 1
     flags=$(filter_out '-l*|*.so' $@)
     libs=$(filter '-l*|*.so' $@)
     test_$type $($cflags_filter $flags) || return
     flags=$($ldflags_filter $flags)
     libs=$($ldflags_filter $libs)
     test_cmd $ld $LDFLAGS $LDEXEFLAGS $flags $(ld_o $TMPE) $TMPO $libs
 $extralibs $(if [ shared="yes" ] ; then echo "-shared" ; fi)

 How to reproduce:
 The configure command I ran was:
 ./configure --prefix=android/arm64-v8a --disable-asm --enable-cross-
 compile --disable-static --disable-programs --disable-doc --enable-shared
 --enable-protocol=file --enable-pic --enable-small --disable-pthreads
 x86_64/bin/clang --cxx=/home/es/Android/Sdk/ndk-
 x86_64/bin/clang --target-os=android --extra-cflags='-target aarch64-none-
 linux-android -mfpu=neon -mfloat-abi=soft -I/home/es/Android/Sdk/ndk-
 bundle//sysroot/usr/include/aarch64-linux-android -O3 -fPIC' --extra-
 -lc' --sysroot=/home/es/Android/Sdk/ndk-bundle//sysroot --extra-libs=-lgcc
 Then I ran 'make' and got the make error above (or you can see the ld
 error in the config log or the macros in config.h)

 My NDK version is r19b and my OS is Arch-Linux
 I'll attach the config.log in the files of this ticket

Ticket URL: <https://trac.ffmpeg.org/ticket/7785>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list