mingw64 支持 dlopen接口操作说明

前言,为了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.csdn.net/zymill/article/details/112140695

注意事项
1)确认mingw64相应的路径(笔者采用的是ubuntu系统下的交叉编译,路径为 /home/hybase/mingw-w64/tools/x86_64-w64-mingw32/x86_64-w64-mingw32/)
2)编译libdl.a需要采用mingw64,并且建议采用静态库方式。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值