gpt4 book ai didi

ios - iOS平台编译FFmpeg框架时出错

转载 作者:行者123 更新时间:2023-12-04 23:27:39 27 4
gpt4 key购买 nike

我用的ffmpeg版本是3.0,Xcode版本是7.3.1,编译的时候一直报如下错误:

Undefined symbols for architecture x86_64:
"_libiconv", referenced from:
_avcodec_decode_subtitle2 in libavcodec.a(utils.o)
"_libiconv_close", referenced from:
_avcodec_open2 in libavcodec.a(utils.o)
_avcodec_decode_subtitle2 in libavcodec.a(utils.o)
"_libiconv_open", referenced from:
_avcodec_open2 in libavcodec.a(utils.o)
_avcodec_decode_subtitle2 in libavcodec.a(utils.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我的项目已经在以下框架和库中引入:

1.VideoToolbox.framework

2.libiconv.2.4.0.tbd

3.libz.待定

4.libbz2.待定

最佳答案

我同意 Eureka.gh。根本原因应该是符号不匹配。
我在下面显示我的测试结果。

LiaotekiMacBook-Pro:lib liaokuohsun$ nm libavcodec.a | grep iconv
U _libiconv
U _libiconv_close
U _libiconv_open

LiaotekiMacBook-Pro:lib liaokuohsun$ nm libiconv.dylib | grep iconv
00000000000f2d80 S ___iconv_2VersionNumber
00000000000f2d50 S ___iconv_2VersionString
00000000000f4750 D __libiconv_version
0000000000003174 T _iconv
00000000000034b7 T _iconv_canonicalize
0000000000003196 T _iconv_close
0000000000001cdd T _iconv_open
00000000000031a3 T _iconvctl
00000000000032ac T _iconvlist
0000000000015f0d T _libiconv_relocate
00000000000f4760 b _libiconv_relocate.initialized
0000000000015e54 T _libiconv_set_relocation_prefix

这里我提供另一种解决方案。
通过代码中的一些包装函数,可以修复此链接错误。
#include <iconv.h>
iconv_t libiconv_open(const char *tocode, const char *fromcode)
{
return iconv_open(tocode, fromcode);
}

size_t libiconv(iconv_t cd,
char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
return iconv( cd, inbuf, inbytesleft, outbuf, outbytesleft);
}

int libiconv_close(iconv_t cd)
{
return iconv_close(cd);
}

关于ios - iOS平台编译FFmpeg框架时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37375904/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com