前言,为了windows平台下ffmpeg正常编译支持frei0r滤镜,可采用如下步骤确保支持dlopen等相关接口。
第一步 下载库
地址 https://github.com/dlfcn-win32/dlfcn-win32
第二步 编译
下载文件为 dlfcn-win32-1.3.0.tar.gz
上传到指定系统的指定路径,执行解压命令
tar -zxvf dlfcn-win32-1.3.0.tar.gz
编译前,先扩展环境变量
export PATH="/home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bin:$PATH"
./configure --cross-prefix=/home/hybase/mingw-w64/tools/x86_64-w64-mingw32
testing compiler: /home/hybase/mingw-w64/tools/x86_64-w64-mingw32gcc -shared -o tmptest.dll tmptest.c
./configure: 149: ./configure: /home/hybase/mingw-w64/tools/x86_64-w64-mingw32gcc: not found
/home/hybase/mingw-w64/tools/x86_64-w64-mingw32gcc could not create shared file with Windows API functions.
Make sure your MinGW system is working properly.
root@ubuntu:~/dlfcn-win32-1.3.0# ./configure --cross-prefix=/home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bin
testing compiler: /home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bingcc -shared -o tmptest.dll tmptest.c
./configure: 149: ./configure: /home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bingcc: not found
/home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bingcc could not create shared file with Windows API functions.
Make sure your MinGW system is working properly.
root@ubuntu:~/dlfcn-win32-1.3.0# ./configure --cross-prefix=/home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-
testing compiler: /home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-gcc -shared -o tmptest.dll tmptest.c
prefix: /mingw
libdir: ${prefix}/lib
incdir: ${prefix}/include
ar: /home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-ar
cc: /home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-gcc
ranlib: /home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-ranlib
strip: /home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-strip
static: yes
shared: no
wine:
编译
make -j 8
/home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-gcc -Wall -O3 -fomit-frame-pointer -Isrc -o src/dlfcn.o -c src/dlfcn.c
/home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-ar cru libdl.a src/dlfcn.o
/home/hybase/mingw-w64/tools/x86_64-w64-mingw32/bin/x86_64-w64-mingw32-ranlib libdl.a
第三步 复制文件到指定位置
头文件
dlfcn.h
/home/hybase/mingw-w64/tools/x86_64-w64-mingw32/x86_64-w64-mingw32/include/
库文件
libdl.a
/home/hybase/mingw-w64/tools/x86_64-w64-mingw32/x86_64-w64-mingw32/lib
第四步 编译验证
继续编译 ffmpeg with --enable-frei0r将正常通过
第五步 程序验证
在windows可以通过测试case验证是否frei0r相关滤镜功能, 具体样例请参考以下链接:
https://blog.youkuaiyun.com/zymill/article/details/112140695
注意事项
1)确认mingw64相应的路径(笔者采用的是ubuntu系统下的交叉编译,路径为 /home/hybase/mingw-w64/tools/x86_64-w64-mingw32/x86_64-w64-mingw32/)
2)编译libdl.a需要采用mingw64,并且建议采用静态库方式。