建造大型Wasm的或工具
我正在开发一个依赖Google Or-Tools依靠的一部分的Glazor WASM工具,并通过利用andaberfilereference
在.NET 6 Blazor WASM中遇到问题。
我在应用程序中使用相同方法在应用程序中使用了其他C ++库,并且它们在没有hiccup 请参阅史蒂夫·桑德森(Steve Sanderson)谈话。但是,Or-Tools具有很多依赖性,并且在结构上更为复杂。
我的目标是将我可以在项目中使用和运送的单个二进制文件编译,我将编写一个C ++条目文件,其中包含我需要与C#进行交互的所有功能,如下面的第2号尝试。另请参见静态链接部分
我尝试了什么? :
我看了看 sudoku solver ,他在文章中提到他必须迭代依赖关系,直到他获得了wasm构建并创建了补丁,我不确定它是如何实现的。但是我认为我可以将Suduko示例添加到用于测试的空的Blazor WASM项目中,更改
emcc
命令,使用- 共享
和-s-s生成单个bindary WASM = 1
并删除任何JavaScript使用。但是我在链接emscripten:错误:emscript:emscript:未能从wasm-emscripten farmine-finalize
中解析元数据输出,这似乎是 this 和 dotnet doc ,如果我通过了>
> sudokus.cc
文件我在标题上找不到文件错误。我转到此问题将示例用作从构建WASM的起点,然后以相同的方式使用
main.cpp
,但在大风中使用。那也没有用。
我的问题:
a。从Or-Tools构建WASM单二进制的正确方法是什么?
b。第2号尝试实际上可以工作吗?如果是这样,那么构建它的构建还需要的是WASM。
谢谢你!
系统信息:
Ubuntu 21.10
GCC/G ++ 11.2.0
dotnet 6.0.202
Emscripten 3.1.9
I am developing a Blazor wasm tool that relies on Google OR-Tools for some part and im running into problems building the library and using it in .NET 6 Blazor wasm by leveraging NativeFileReference
.
I have been using other C++ Libraries in my application using the same approach and they build and integrate without a hiccup see Steve Sanderson Talk. but the OR-Tools has a lot of dependencies and is way more complex in structure.
my goal is to compile to a single binary which I can use and ship in my projects, where I'll write a C++ entry file that contains all the functions I need to interact with C# as in attempt no.2 below.see also Static linking section
what have I tried ? :
I took a look at the Sudoku Solver, he mentions in the article that he had to iterate over the dependencies until he got a wasm build and created patches, which I'm unsure how it was achieved. but I figured I can add the suduko example to an empty Blazor wasm project for testing, changing the
emcc
command to generate a single bindary using- shared
and-s WASM=1
and removing any Javascript use. but I got a Json parse error on linkingemscripten : error : emscript: failure to parse metadata output from wasm-emscripten-finalize
which appears to be a version mismatch error according to this and the dotnet doc, if I pass thesudokus.cc
file I get a file not found error on headers.I referred to this question and tried to use the example as a starting point to build wasm from and simply use the
main.cpp
in the same fashion but in Blazor. that also didn't quite work.
my questions:
a. What is the correct way to build a wasm single binary from OR-Tools (regardless of the size) ?
b. would attempt no.2 actually work ? if so, what is additionally required to build it as is but for wasm.
Thank you!
System Information:
Ubuntu 21.10
gcc/g++ 11.2.0
dotnet 6.0.202
Emscripten 3.1.9
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将在此处留给其他任何希望使用Or-Tools用于Glazor Wasm的人,请注意,此答案是针对问题B。的原始问题。
如果您希望通过“或工具”中的特定工具执行某个作业,则在保持大发应用程序的上下文中,此方法很有用。请注意,这使用了非常古老的Or-Tools(暂时)。
.o
文件。 a>I'll leave this here for anyone else looking to use or-tools for Blazor wasm, please note that this answer is meant for question b. in original question.
In the context of keeping the Blazor App light this method is useful if you want a certain job to be executed by a specific tool in or-tools. mind you that this uses a very old version of or-tools (for the time being).
.o
file in your blazor app. see here for details