简体   繁体   English

Mac OS X,C#/ Mono-GeckoFX“ System.DllNotFoundException:xul”

[英]Mac OS X, C#/Mono - GeckoFX “System.DllNotFoundException: xul”

I have an application which utilizes GeckoFX/xulrunner 22. This program works great in Windows but no matter what I do I cannot get it to run in Linux nor Mac. 我有一个使用GeckoFX / xulrunner 22的应用程序。该程序在Windows中效果很好,但是无论如何我都无法使其在Linux或Mac上运行。

The primary focus is Mac though. 不过,主要重点是Mac。

I've tried swapping out different versions of Windows, Linux & Mac xulrunner run-times as well as different initialization strings to try including both the Windows, Linux and Mac versions (of course only one at a time) like: 我尝试换出Windows,Linux和Mac xulrunner运行时的不同版本以及不同的初始化字符串,以尝试包括Windows,Linux和Mac版本(当然一次仅一个),例如:

Gecko.Xpcom.Initialize("lib/xulrunner");
Gecko.Xpcom.Initialize("lib/XUL.framework/Versions/Current");

I have also tried prefixing with "./" as well as using code to obtain the current working directory to prepend to the path. 我还尝试了使用“ ./”作为前缀,以及使用代码来获取当前工作目录以添加到该路径。

I've also tried copying over a dozen different versions of xul.dll into the executable folder and subdirectories within it. 我还尝试将十几种不同版本的xul.dll复制到可执行文件文件夹和其中的子目录中。

No matter what I think to try, or search this site/google to try nothing has worked. 无论我认为要尝试什么,还是搜索此网站/ Google都没有尝试任何方法。

This is failing on the Initialize() call. 这在Initialize()调用上失败。 The program/class names are only starred out so this is not the first thing popping up in google when people search for the program. 程序/类名仅被加注星标,因此当人们搜索该程序时,这并不是Google弹出的第一件事。

Although my biggest concern is getting this running on Mac, I will also mention due to other posts on Stack Overflow and alike that on my Linux system, I have tried having various versions of Firefox installed and the path pointed to as per other peoples' instructions. 尽管我最大的担心是要在Mac上运行它,但由于Stack Overflow上的其他帖子以及我在Linux系统上的其他帖子,我也会提到,我尝试安装各种版本的Firefox,并按照其他人的指示进行了操作。 It always shows the same error as on Mac. 它始终显示与Mac上相同的错误。

Error follows: Unhandled Exception: System.DllNotFoundException: xul at (wrapper managed-to-native) Gecko.Xpcom:Alloc (intptr) at Gecko.nsAString..ctor () [0x00000] in :0 at Gecko.nsAString..ctor (System.String value) [0x00000] in :0 at Gecko.Xpcom.Initialize (System.String binDirectory) [0x00000] in :0 at **********.**********.CreateBrowsers () [0x00000] in :0 at **********.**********.**********_Shown (System.Object sender, System.EventArgs e) [0x00000] in :0 at System.Windows.Forms.Form.OnShown (System.EventArgs e) [0x00000] in :0 at System.Windows.Forms.Form.SetVisibleCore (Boolean value) [0x00000] in :0 at System.Windows.Forms.Control.set_Visible (Boolean value) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:set_Visible (bool) at System.Windows.Forms.Application.RunLoop (Boolean Modal, System.Windows.Forms.ApplicationContext context) [0x00000] in :0 at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) [0x000 错误随之而来:未处理的异常:System.DllNotFoundException:xul位于(包装器管理为本地)Gecko.Xpcom:Alloc(intptr)位于Gecko.nsAString..ctor()[0x00000],位于Gecko.nsAString..ctor的:0中(System.String值)[0x00000]在Gecko.Xpcom.Initialize中为0:[System.String binDirectory)[0x00000]在0处为**********。******** **。CreateBrowsers()[0x00000]在**********处为:0:**********。********** _ Shown(System.Object发件人,System.EventArgs e),System.Windows.Forms.Form.OnShown中为0的[0x00000](System.EventArgs e),System.Windows.Forms.Form.SetVisibleCore:0中为[0x00000] [布尔值] [ System.Windows.Forms.Control.set_Visible上:0处的0x00000](布尔值)System.Windows.Forms.Control:set_Visible上(包装)远程检查时的0处[0x00000] .Windows.Forms.Application.RunLoop(布尔值模态,System.Windows.Forms.ApplicationContext上下文)[0x00000]在System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext上下文)的:0中[0x000 00] in :0 at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) [0x00000] in :0 at **********.Program.Main () [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: xul at (wrapper managed-to-native) Gecko.Xpcom:Alloc (intptr) at Gecko.nsAString..ctor () [0x00000] in :0 at Gecko.nsAString..ctor (System.String value) [0x00000] in :0 at Gecko.Xpcom.Initialize (System.String binDirectory) [0x00000] in :0 at **********.**********.CreateBrowsers () [0x00000] in :0 at **********.**********.**********_Shown (System.Object sender, System.EventArgs e) [0x00000] in :0 at System.Windows.Forms.Form.OnShown (System.EventArgs e) [0x00000] in :0 at System.Windows.Forms.Form.SetVisibleCore (Boolean value) [0x00000] in :0 at System.Windows.Forms.Control.set_Visible (Boolean value) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:set_Visible (bool) at System.Windows.Forms.Application.RunLoop (Boolean Modal, System.Window 00:在System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm)中的[0x00000]在0处在**********。Program.Main()[0x00000] ] in:0 [错误]致命异常:System.DllNotFoundException:xul位于(包装器管理为本地)Gecko.Xpcom:Alloc(intptr)位于Gecko.nsAString..ctor()[0x00000] in 0位于Gecko .nsAString..ctor(System.String值)[0x00000]在Gecko.Xpcom的:0中.Initialize(System.String binDirectory)[0x00000]在****的:0的********。*** *******。CreateBrowsers()[0x00000]在****处为:0:********。**********。********** _Shown(System.Object sender,System.EventArgs e)[0x00000]在System.Windows.Forms.Form.OnShow中的[0x00000]在0:System.Windows.Forms.Form.SetVisibleCore (布尔值)System.Windows.Forms.Control.set_Visible上为0的[0x00000](布尔值)System.Windows.Forms.Control:set_Visible上为0的[0x00000] (布尔)在System.Windows.Forms.Application.RunLoop(布尔模态,System.Window s.Forms.ApplicationContext context) [0x00000] in :0 at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) [0x00000] in :0 at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) [0x00000] in :0 at **********.Program.Main () [0x00000] in :0 s.Forms.ApplicationContext上下文)[0x00000]在System.Windows.Forms.Application.Run处为0 [System.Windows.Forms.ApplicationContext上下文] [0x00000]在System.Windows.Forms.Application.Run(0处为0) System.Windows.Forms.Form mainForm)在**********中为0的[0x00000] .Program.Main()在:0中的[0x00000]

Firstly, to my knowledge no one has ever run geckofx on OSX. 首先,据我所知,没有人在OSX上运行过geckofx。

The problem you are seeing is probably easy fixable but before getting geckofx to work on mac you will likely hit more problems. 您看到的问题很容易解决,但是在让geckofx在Mac上运行之前,您可能会遇到更多问题。

Geckofx's architecture on Windows is simple. Windows上的Geckofx的体系结构很简单。 The GeckoWebBrowser control is a winforms based control, which underneath are win32 controls and gecko/firefox on windows also uses win32 controls. GeckoWebBrowser控件是基于Winforms的控件,在Win32控件之下,而Windows上的Gecko / firefox也使用Win32控件。

However on Linux things are a little more complicated as gecko/firefox uses GTK while the mono winform implementation is based upon X11. 但是在Linux上,事情变得有些复杂,因为gecko / firefox使用GTK,而mono winform实现基于X11。 Hence geckofx has some fairly complex code to make that all work. 因此geckofx有一些相当复杂的代码才能使所有工作正常进行。 (Which is why one needs to use a different build of geckofx on Linux (one with the GTK flag defined). (这就是为什么在Linux上需要使用另一种版本的geckofx(定义了GTK标志的原因)的原因。

So firstly on OSX you have to determine what UI toolkit does mono uses for winforms, is it X11, carbon or something else? 因此,首先在OSX上,您必须确定mono用于winforms的UI工具包是X11,carbon还是其他工具? Then you have to determine which toolkit Firefox uses on OSX, carbon, cocoa or something else? 然后,您必须确定Firefox在OSX,碳,可可粉或其他产品上使用的工具包? If they happen to match then its probably worth proceeding with the windows build of geckofx. 如果它们碰巧匹配,那么可能值得继续进行geckofx的Windows构建。 If they are different then you will probably have to modify geckofx itself to deal with this issue. 如果它们不同,则可能必须修改geckofx本身才能处理此问题。

Now on to the DllNotFoundException. 现在转到DllNotFoundException。

The PInvoke/DllImport calls are probably looking for "xul.dll". PInvoke / DllImport调用可能正在寻找“ xul.dll”。 This file could be named something different in OSX's firefox (eg. libxul.so) so a dllmap config file is needed to map xul.dll to the correct file. 在OSX的firefox中,该文件的名称可能有所不同(例如libxul.so),因此需要dllmap配置文件才能将xul.dll映射到正确的文件。

Also setting these two environment variables, MONO_LOG_LEVEL="debug" and MONO_LOG_MASK="dll" should provide you with useful debug information. 同时设置这两个环境变量,MONO_LOG_LEVEL =“ debug”和MONO_LOG_MASK =“ dll”应该为您提供有用的调试信息。

Additionally one can use an absolute path for Gecko.Xpcom.Initialize to avoid any confusion about finding the path. 另外,可以为Gecko.Xpcom.Initialize使用绝对路径,以避免有关查找路径的任何混淆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Mono SQLite上的System.DllNotFoundException - System.DllNotFoundException on Mono SQLite Geckofx-Core - System.DllNotFoundException - Geckofx-Core - System.DllNotFoundException Mono (Linux, C#): 找不到同一文件夹中的 DLL (System.DllNotFoundException) - Mono (Linux, C#): DLL in same folder can not be found (System.DllNotFoundException) C ++ DLL和C#应用程序WPF:System.DllNotFoundException - C++ DLL and C# applications WPF: System.DllNotFoundException BadImageFormatException或System.DllNotFoundException尝试运行ac#项目时 - BadImageFormatException or System.DllNotFoundException When trying to run a c# project C# Windows 7 应用程序 System.DllNotFoundException 上的 AutoIt (AutoItX) - AutoIt (AutoItX) on C# Windows 7 App System.DllNotFoundException 在Mac上使用Xamarin的System.DLLNotFoundException - System.DLLNotFoundException using Xamarin on mac 不可预测的System.DllNotFoundException - Unpredictable System.DllNotFoundException 从 Linux 上的 C# 调用 Haskell 时出现 System.DLLNotFoundException(wsl1 Debian) - System.DLLNotFoundException when calling Haskell from C# on Linux (wsl1 Debian) 在Mac OS X上进行C#/ Mono单元测试 - C# / Mono unit tests on Mac OS X
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM