- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图以抽象的方式表述问题,但无论如何我最后都会提供有关实际库的详细信息。
动态库 Addon
与其他库 WebRTC
静态链接,后者在汇编中有一些代码,此代码作为目标文件链接到 WebRTC
连同 WebRTC
自己的对象文件。让我们调用此汇编代码 VP8
。 VP8
的功能在WebRTC
中被标记为extern
。 Addon
中的某些函数 Encode()
调用 WebRTC
的函数,最终调用 VP8
的函数。
现在,要加载库 Addon
的应用程序 Firefox
非常复杂,并且有自己的库版本(意味着静态链接)WebRTC
(我们称它为 WebRTC2
),但它是一个较旧的代码。
所以,这里有一个问题:如果从应用程序 Firefox
调用 Encode()
,则调用 WebRTC
函数(不是 WebRTC2
,这是正确的)但是当 WebRTC
尝试调用 VP8
函数时,它们从 WebRTC2
版本(表示应用程序的 WebRTC
版本),但不是来自 WebRTC
。
有没有办法强制 WebRTC
只从 VP8
的本地副本进行调用?
Application Firefox
是一个 Firefox 浏览器,WebRTC
是一个 WebRTC 库,VP8
是一个 VP8 编解码器库(在 WebRTC 中)和 Addon
是我的 Firefox C++ 插件。
更新 - 详细说明
这里是问题的“非抽象”描述:所以有一个 C++ XPCOM 附加组件静态链接到最新版本的 WebRTC 库。在加载项内部的某个时刻,调用了对帧进行编码(VP8Encoder
类的方法 Encode
),它一直在 Firefox 中崩溃,但继续运行良好在使用 gtest 框架的测试程序上。
问题在于,在 WebRTC 内部的某个时刻,有 VP8 汇编代码被调用以进行编码,并且该汇编代码的函数在实现文件中声明为 extern
。实际上,它在 vp8_intra_pred_y_ve_sse2
函数上崩溃。我比较了这个函数的三个汇编代码:一个来 self 的 WebRTC 版本(在附加组件中使用),第二个 - 调试器崩溃的地方,第三个 - 来自 Mozilla 的 WebRTC 的源代码。
事实证明,由于某些奇怪的原因,Mozilla 的代码被调用而不是附加组件的 WebRTC(当然它们具有相同的名称)并且由于 Mozilla 的 WebRTC 代码已过时,它因 EXC_BAD_ACCESS 而崩溃。
最佳答案
这可能对你没有太大帮助,但由于没有其他人回应,我开始......
您没有提到您是在 Linux、Windows 还是其他平台上运行。我的答案是针对 Linux。我相信 Windows 加载动态库的方式不同。
我认为正在发生的事情是您已经静态链接到 WebRTC 库 stub 接口(interface),并且这些 stub 接口(interface)动态链接到实际实现,然后将 WebRTC 库的第一个实例加载到 firefox 而不是第二个实例。确保您真正链接到 WebRTC 库的静态编译版本。
linux dlopen(3)
手册页列出了一个有趣的标志,它似乎对如果您的库是加载 WebRTC 库的库有帮助:
void *dlopen(const char *filename, int flag);
dlopen()
The function dlopen() loads the dynamic library file named by the null-
terminated string filename and returns an opaque "handle" for the
dynamic library. [...]
RTLD_DEEPBIND (since glibc 2.3.4)
Place the lookup scope of the symbols in this library ahead of
the global scope. This means that a self-contained library will
use its own symbols in preference to global symbols with the
same name contained in libraries that have already been loaded.
This flag is not specified in POSIX.1-2001.
不幸的是,firefox 是加载您的库的那个。
如果您的库动态链接到 WebRTC(看起来是这样)并且您使用带有 RTLD_DEEPBIND 标志的 dl_open() 显式加载了您想要的 WebRTC 库,那么这将解决您的问题。
这对您没有多大帮助,因为绑定(bind)到 vp8_intra_pred_y_ve_sse2
的不是您的代码,但值得指出的是 gcc 也有 dlsym()
函数,它可以拿几个特殊的标志:
void *dlsym(void *handle, const char *symbol);
dlsym()
The function dlsym() takes a "handle" of a dynamic library returned by
dlopen() and the null-terminated symbol name, returning the address
where that symbol is loaded into memory. [...]
There are two special pseudo-handles, RTLD_DEFAULT and RTLD_NEXT. The
former will find the first occurrence of the desired symbol using the
default library search order. The latter will find the next occurrence
of a function in the search order after the current library. This
allows one to provide a wrapper around a function in another shared
library.
您可以在您的代码中使用它来至少调试正在发生的事情,方法是让它打印出它为查找 vp8_intra_pred_y_ve_sse2 而获得的值。
最后,同一个手册页指出 linux 有一个 dlvsm()
也接受一个版本字符串参数,允许 XPCOM 代码指定它想要的函数版本:
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <dlfcn.h>
void *dlvsym(void *handle, char *symbol, char *version);
如果是我,并且我被迫动态链接这些东西,我会采用蛮力方法。进入库并更改函数名称(在两个库中)。不优雅,每当这两个库的新版本出来都会让人头疼,但它简单直接。
关于firefox-addon - 带有重复项的复杂动态和静态链接(Firefox 附加组件、WebRTC 和 VP8),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18731128/
我正在开发一个 Firefox 插件,我假装我的插件能够在桌面和移动设备上运行。我认为或多或少所有东西都与这两种环境兼容,但是我想根据当前设备是移动设备还是桌面设备来运行一些代码,所以问题是是否有类似
我正在开发一个 Firefox 插件,我不确定的一件事是如何在用户卸载插件时删除与我的插件相关的用户首选项。首选项被设置,如果用户卸载并重新安装首选项仍然存在。一些设置还与第一次安装有关,因此如果用户
使用 SDK 制作对话框的正确方法是什么(它没有锚定到附加栏等,而是显示在屏幕中央)?这个重要功能似乎没有任何 API。我确实看到 windows/utils 有 open 但我有两个问题: 打开对话
我遵循了几个教程但没有成功。我认为这是经典的例子,但我无法让它发挥作用。我可以保存我的项目,安装插件,当我选择一些文本时我可以看到上下文菜单项“日志选择”,但是当我点击它时没有任何反应。 export
我刚刚制作了一个 FF 插件并制作了一个简单的网站。我希望访问者点击“下载”按钮安装插件,而不是下载。它在本地有效,但在我上传网站时无效。我检查了 mozilla 存储库,它们也只是链接到 xpi 文
构建传统的 Firefox 扩展,您将在 install.rdf 中设置 minVersion 字段。由于这是由 package.json 和 cfx 抽象出来的,有没有办法设置 minVersion
请告诉我如何在 odoo9 中将文件夹(例如:custom_module)添加到“./odoo.py --addons=./addons” 我正在尝试将 custom_module 添加到“”./od
我用 simple-prefs配置插件设置的模块。我怎么能以编程方式 打开插件的设置页面? 最佳答案 我们在 test add-on here 中执行此操作 那里的代码比您需要的要多,因此较短的版本是
我有一个带有工作回调构造的插件: 库/main.js: function myLogin(loginname,loginfield) { var pageUrl = tabs.activeTa
为了在我的服务器上为我的插件提供自动更新,我需要创建一个 update.rdf文件。 我如何生成这样的文件? 文档非常多:https://developer.mozilla.org/en-US/doc
我在此链接中阅读了有关“请求”功能的信息: https://addons.mozilla.org/en-US/developers/docs/sdk/1.1/packages/addon-kit/do
我正在尝试使用 nsIHttpChannel 使用 firefox 插件 sdk 读取 header 喜欢.. var httpChannel = subject.QueryInterface(Ci.
有没有办法在内容脚本中访问 Fire Fox addon sdk 中的 Html5 文件 api? 这是为了存储用户添加的单词及其含义所必需的。数据可能会变大,因此本地存储不是一种选择。 windo
两者有什么区别: import React from 'react/addons'; let {PropTypes} = React; 对比 import React, { PropTypes } f
tl;dr:我们使用 Addon SDK 创建了一个 firefox 插件。由于编译插件是更大的构建系统中的一个步骤(我们也为 chrome 编译),我们的构建系统手动打包 xpi 并且不使用 jpm
我是 Windows 7 64 位用户,我在更新最新版本的 Android Studio 和 SDK 后遇到了 Android Studio 问题组件.. The following SDK comp
我正在研究一个Firefox扩展。问题是,如果我进行了任何更改,我需要关闭然后重新打开firefox浏览器以查看更改。我可以通过刷新页面来查看那些更改吗? 最佳答案 您可能想尝试Restart Fir
似乎是您从属性 title="test" 获得的工具提示不显示在面板内。 也用 stackoverflow loaded in the panel 测试过, 将鼠标悬停在热门、周、月上时没有工具提示。
截至 2019 年 6 月 27 日,所有语言词典的下载量约为 1,800 次。我已从该页面查看了一些示例仪表板... https://addons.mozilla.org/en-US/firefox
我正在尝试通过 msi 安装程序静默安装 firefox xpi。我是通过以下方法这样做的: 解压我的 xpi在某个临时目录中并将其中的所有内容复制到 %APPDATA%\Mozilla\Firefo
我是一名优秀的程序员,十分优秀!