首页
社区
课程
招聘
[求助]越狱开发, Theos引用三方静态库的问题
发表于: 2017-5-16 10:24 4592

[求助]越狱开发, Theos引用三方静态库的问题

2017-5-16 10:24
4592

最近在捣腾将FFmpeg集成到ios程序上实现编解码一些功能,发现THEOS引用编译好的库出现了一些问题,具体问题是这样。
我已经把FFmpeg编译了armv7、arm64、x86等版本,使用lipo查看对应的.a文件也都能看到支持的架构,如下:
Architectures in the fat file: FFmpeg-iOS/lib/libavcodec.a are: armv7 i386 x86_64 arm64 
Architectures in the fat file: FFmpeg-iOS/lib/libavdevice.a are: armv7 i386 x86_64 arm64 
Architectures in the fat file: FFmpeg-iOS/lib/libavfilter.a are: armv7 i386 x86_64 arm64 
Architectures in the fat file: FFmpeg-iOS/lib/libavformat.a are: armv7 i386 x86_64 arm64 
Architectures in the fat file: FFmpeg-iOS/lib/libavutil.a are: armv7 i386 x86_64 arm64 
Architectures in the fat file: FFmpeg-iOS/lib/libswresample.a are: armv7 i386 x86_64 arm64 
Architectures in the fat file: FFmpeg-iOS/lib/libswscale.a are: armv7 i386 x86_64 arm64

而且我将他们和头文件一起放入xcode设置好相应的引入可以在项目中正常使用,但是我当我尝试在theos里面进行集成时却出现了一些问题,我是这样做的:
1、将编译好的头文件放入THEOS的include目录下(因为头文件中间有些有包含关系,放入项目对应目录更改较为麻烦)
2、将.a文件放入THEOS的lib目录下
3、编写makefiles文件,文件如下:

makefiles

ARCHS = arm64
TARGET = iphone:latest:8.0 #此句加入与否不影响编译结果
include $(THEOS)/makefiles/common.mk

TOOL_NAME = consoleapp
consoleapp_FILES = main.mm
consoleapp_FRAMEWORKS =UIKit AVFoundation CoreImage OpenGLES VideoToolbox CoreGraphics CoreMedia AudioToolbox
consoleapp_PRIVATE_FRAMEWORK = IOSurface IOKit

consoleapp_LDFLAGS+=libs/libbz2.1.0.tbd
consoleapp_LDFLAGS+=libs/libiconv.2.tbd
consoleapp_LDFLAGS+=libs/libz.1.tbd
consoleapp_LDFLAGS+=-lavcodec
consoleapp_LDFLAGS+=-lavfilter
consoleapp_LDFLAGS+=-lavformat
consoleapp_LDFLAGS+=-lavutil
consoleapp_LDFLAGS+=-lswresample
consoleapp_LDFLAGS+=-lswscale
consoleapp_LDFLAGS+=-lavdevice

include $(THEOS_MAKE_PATH)/tool.mk

当我进行编译时,编译链接阶段发生如下错误:

Making all for tool consoleapp…
==> Compiling main.mm (arm64)…
==> Linking tool consoleapp (arm64)…
Undefined symbols for architecture arm64:
"clockgettime", referenced from:
avgettime_relative in libavutil.a(time.o)
avgettime_relative_is_monotonic in libavutil.a(time.o)
ld: symbol(s) not found for architecture arm64

搜索相关资料在linux下面加入librt即编译库加上-lrt即可,但是我在osx全路径下查找librt并没有相对应的库,问题的根本好像是苹果系列的系统在实现clock_gettime时有所出入(事实上我之前开过一贴是关于libevent引用出现同样的问题,当时不太清楚发帖的说明而被锁帖囧,libevent并不是我想要的必须使用的库,这个问题没解决也就绕过了),然而比较奇葩的是,我把它做为非越狱应用在xcode8上编译却能顺利通过并在arm64(iphone6)的机器上机器上跑起来,附上xcode的库依赖


请问坛子里有没有大神碰到过类似问题并且顺利解决,或者有其他解决思路呢?(我都想直接改FFmpeg的源码调用_clock_gettime的地方然后重新编译了,但是怕改动引起连锁反应暂时还没动手)



[课程]FART 脱壳王!加量不加价!FART作者讲授!

收藏
免费 0
支持
分享
最新回复 (2)
雪    币: 155
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
TARGET  =  iphone:latest:8.0  #此句加入与否不影响编译结果      <=    不影响编译

你出现这个情况是你打包ffmpeg时没有指定target。
2017-6-19 11:59
0
雪    币: 30
活跃值: (41)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
3
指定Target可以解决
2017-7-6 08:47
0
游客
登录 | 注册 方可回帖
返回
//