ndk编译ffmpeg 4.1版本 error: request for member 's_addr' in something not a st

ameyume
博客专家认证
2019-02-12 06:40:54

hi@hi:~/3tb_volume/ffmpeg/ffmpeg-4.1$ which ndk-build
/home/hi/Android/Sdk/ndk-bundle/ndk-build
hi@hi:~/3tb_volume/ffmpeg/ffmpeg-4.1$ ndk-build -version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu

1.使用Android Studio默认下载的ndk编译ffmpeg4.1
export NDK=/home/hi/Android/Sdk/ndk-bundle

提示错误如下
hi@hi:~/3tb_volume/ffmpeg/ffmpeg-4.1$ ./build2.sh
/home/hi/Android/Sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc is unable to create an executable file.
C compiler test failed.


If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.

注:使用android-ndk-r16b也报同样的错误,也就是说新版本会报这个错误

2.ndk替换为android-ndk-r10e版本和android-ndk-r14b
export NDK=/home/hi/bin/android-ndk-r10e
不再报错:
hi@hi:~/3tb_volume/ffmpeg/ffmpeg-4.1$ ./build2.sh
install prefix ../fflib
source path .
C compiler /home/hi/bin/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
C library bionic
host C compiler gcc
host C library glibc
ARCH c (armv7-a)
big-endian no
runtime cpu detection yes
debug symbols no
strip symbols no
optimize for size yes
...
Enabled outdevs:
fbdev v4l2

License: GPL version 2 or later

WARNING: /home/hi/bin/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-pkg-config not found, library detection may fail.
libavutil/avconfig.h is unchanged
libavcodec/codec_list.c is unchanged
libavcodec/parser_list.c is unchanged
libavcodec/bsf_list.c is unchanged
libavformat/demuxer_list.c is unchanged
libavformat/muxer_list.c is unchanged
libavformat/protocol_list.c is unchanged
hi@hi:~/3tb_volume/ffmpeg/ffmpeg-4.1$

3.执行make,还是会报错:
CC libavformat/udp.o
libavformat/udp.c: In function 'udp_set_multicast_sources':
libavformat/udp.c:290:28: error: request for member 's_addr' in something not a structure or union
mreqs.imr_multiaddr.s_addr = ((struct sockaddr_in *)addr)->sin_addr.s_addr;

^
compilation terminated due to -Wfatal-errors.
make: *** [libavformat/udp.o] 错误 1

有大神知道怎么解决吗?
...全文
929 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
https://blog.csdn.net/qq_34902522/article/details/87879145 成功编译FFmpeg 4.1版本
ameyume 2019-02-18
  • 打赏
  • 举报
回复
引用 2 楼 心执一 的回复:
楼主解决了吗? 同样问题ndk14 windows64位 msys2编译的,也是卡在 CC libavformat/udp.o

换了build编译脚本,可以编译通过了,参考: ubuntu14.04系统Android NDK编译ffmpeg遇到的问题
baobrother阿振 2019-02-15
  • 打赏
  • 举报
回复
大神顺便帮我看一下我的.sh有没有什么问题
baobrother阿振 2019-02-15
  • 打赏
  • 举报
回复
附我的.sh make clean export NDK=D:/android-ndk-r14b export PLATFORM=$NDK/platforms/android-14/arch-arm export TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64 export PREFIX=../androidfflib export ADDI_CFLAGS="-marm" export TMPDIR=D:/ffmpeg-4.0.3/temp build_one(){ ./configure --target-os=linux \ --extra-libs=-lgcc \ --prefix=$PREFIX --arch=arm \ --enable-cross-compile \ --disable-doc \ --enable-shared \ --disable-static \ --disable-asm \ --disable-symver \ --enable-gpl \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --cc=$TOOLCHAIN/bin/arm-linux-androideabi-gcc \ --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \ --sysroot=$PLATFORM \ --extra-cflags="-Os -fpic $ADDI_CFLAGS" \ --extra-ldflags="$ADDI_CFLAGS" \ $ADDITIONAL_CONFIGURE_FLAG } build_one
baobrother阿振 2019-02-15
  • 打赏
  • 举报
回复
楼主解决了吗? 同样问题ndk14 windows64位 msys2编译的,也是卡在 CC libavformat/udp.o
ameyume 2019-02-12
  • 打赏
  • 举报
回复
build2.sh文件如下:
# build.sh
# 在Linux下编译FFmpeg成功的脚本
# 注意Linux和windows的换行符\r\n不太一样,要转换(dos2unix)
#!/bin/sh
make clean
#export NDK=/home/gym/bin/android-ndk-r10e
export NDK=/home/gym/bin/android-ndk-r14b
export PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt
export PLATFORM=$NDK/platforms/android-9/arch-arm
export PREFIX=../fflib
build_one(){
./configure --target-os=linux --prefix=$PREFIX \
--enable-cross-compile \
--enable-runtime-cpudetect \
--disable-asm \
--arch=arm \
--cc=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi- \
--disable-stripping \
--nm=$PREBUILT/linux-x86_64/bin/arm-linux-androideabi-nm \
--sysroot=$PLATFORM \
--enable-gpl --enable-shared --disable-static --enable-small \
--disable-ffprobe --disable-ffplay --disable-ffmpeg --disable-debug \
--extra-cflags="-fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -marm -march=armv7-a"
}
build_one
make
#make install
cd ..

80,472

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧