弱链接框架到静态库 [英] Weak linking a framework to a static library

查看:89
本文介绍了弱链接框架到静态库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目安排如下:


  • App


    • 框架


      • 静态库(公共代码)

      取决于GoogleWebRTC,静态库将开始运行框架。不幸的是,只能通过 WebRTC.org 将这种依赖关系构建为框架。由于维护原因,他们删除了构建为静态库的功能。

      The static library is going to start depending on the GoogleWebRTC framework. Unfortunately, this dependency can only be built as a framework via WebRTC.org. They removed the ability to build as a static library for maintenance reasons.

      对于静态库弱链接到GoogleWebRTC框架?

      Is is possble for the static library to weakly link to the GoogleWebRTC framework?


      • 应用程序


        • 框架


          • 静态库( CommonCode)

          想到的一些解决方案是:

          Some solutions that come to mind are:


          • 在静态库中包含WebRTC头文件,并使用自定义模块映射进行构建,以使包括< WebRTC / WebRTC.h> ; 起作用。然后将库嵌入并链接到App目标中

          • 以某种方式将GoogleWebRTC.framework转换为静态库,并将标头和二进制文件嵌入 CommonCode static lib

          • 我...我不记得我想到的另一个解决方案。当我记得时,我将对其进行更新。

          • Including the WebRTC header files in the static library, and build with a custom modulemap so that the include "<WebRTC/WebRTC.h> works. Then embedding and linking the library in the App target
          • Somehow converting the GoogleWebRTC.framework to a static library and embed the headers and binary in the "CommonCode" static lib
          • I... can't remember the other solution I had in mind. I'll update this when I remember.

          推荐答案

          不幸的是,Google决定删除静态目标。

          It's unfortunate decision on Google's part to remove static target.

          如果有帮助,您可以使用mesibo webrtc框架,该框架是使用修改后的忍者文件构建的静态框架。唯一的缺点是,它不会像Google版本那样定期更新(通常会滞后一个月)。

          if that helps, you can use mesibo webrtc framework which is a static framework build using modified ninja files. Only downside is, it is not as regularly updated as Google build (typically lags by a month old sync).

          https://github.com/mesibo/mesibowebrtcframework

          您要做的就是从 mesibo复制 WebRTC.framework / WebRTC 版本,它不过是一个静态库,请使用 lipo -extract 提取,然后使用 lipo -create 将其重新打包到您自己的库中code>。

          All you have to do is to copy WebRTC.framework/WebRTC from mesibo version which is nothing but a static library, extract using lipo -extract and repackage it with your own library using lipo -create.

          以下是您将在Mesibo和WebRTC框架的Google版本中看到的差异

          Below is the difference you will see in Mesibo and Google Version of WebRTC framework

          Mesibo版本

          $ file WebRTC.framework/WebRTC
          WebRTC.framework/WebRTC: Mach-O universal binary with 4 architectures: [i386:current ar 
          archive random library] [arm64]
          WebRTC.framework/WebRTC (for architecture i386):    current ar archive random library
          WebRTC.framework/WebRTC (for architecture armv7):   current ar archive random library
          WebRTC.framework/WebRTC (for architecture x86_64):  current ar archive random library
          WebRTC.framework/WebRTC (for architecture arm64):   current ar archive random library
          

          和Google版本

          $ file WebRTC.framework/WebRTC
          WebRTC.framework/WebRTC: Mach-O universal binary with 4 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
          WebRTC.framework/WebRTC (for architecture x86_64):  Mach-O 64-bit dynamically linked shared library x86_64
          WebRTC.framework/WebRTC (for architecture i386):    Mach-O dynamically linked shared library i386
          WebRTC.framework/WebRTC (for architecture armv7):   Mach-O dynamically linked shared library arm_v7
          WebRTC.framework/WebRTC (for architecture arm64):   Mach-O 64-bit dynamically linked shared library arm64
          

          让我知道您是否需要更多输入!

          Let me know if you need more inputs!

          这篇关于弱链接框架到静态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆