获取/编译 Mono-2.0.dll 以进行嵌入 [英] Getting/compiling Mono-2.0.dll for embedding

查看:21
本文介绍了获取/编译 Mono-2.0.dll 以进行嵌入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 mono 在 C 应用程序中实现一些脚本(参见此页面 http://www.mono-project.com/Embedding_Mono).但是我需要 mono-2.0.dll 才能工作.首先,我认为它包含在单声道的二进制分发中.但我在单声道安装文件夹中找不到它.

I am trying to implement some scripting in a C application using mono (cf this page http://www.mono-project.com/Embedding_Mono). However I need mono-2.0.dll for this to work. First I thought it was included with binary distribution of mono. But i could not find it in mono installation folder.

我也尝试自己构建单声道,但构建总是以错误结束(未解析的符号、读写保护文件等).我尝试了 cygwin 和 VS 构建.

I also tryied to build mono myself but the build always finishes with an error (unresolved symbols, read write protected files, and many others). I tryed both cygwin and VS builds.

经过快速搜索,我发现其他人也有类似问题.但不幸的是,没有适合我的解决方案.

After a quick search I found other people with similar problems. But unfortunatly no solutions that would work for me.

有没有解决方案可以轻松编译 mono-2.0.dll 或获取二进制文件?

Is there a solution to easily compile mono-2.0.dll or to get binaries?

谢谢

推荐答案

编辑

恕我直言,您正在寻找的库可以在单声道安装文件夹的 bin 目录中找到.实际上,安装 mono 3.2.3 MONO_INSTALLATION_PATHin 目录下有两个库:libmonoboehm-2.0.dlllibmonosgen-2.0.dll(您必须选择 BoehmSGen GC 实现)

IMHO the library that you are looking for may be found in the bin directory of the mono installation folder. Actually, after installing mono 3.2.3 there are two libraries in the MONO_INSTALLATION_PATHin directory: libmonoboehm-2.0.dll and libmonosgen-2.0.dll (you must choose either Boehm or SGen GC implementation)

你可以像这样创建一个符号链接 libmono-2.0.dll ->/opt/mymono/bin/libmonoboehm-2.0.dll 例如,如果您想使用 Boehm 实现.这就是全部(我认为)

You could create a symbolic link like this libmono-2.0.dll -> /opt/mymono/bin/libmonoboehm-2.0.dll if for example you want to use the Boehm implementation. And that is all (I think)

但是即使不创建任何符号链接也可以工作,您可以引用库 monoboehm-2.0.dll 或 monosgen-2.0.dll 而不是 mono-2.0.dll.问题是(我认为)您正在寻找错误的库名称.

But you could work even without creating any symolic link, you could reference the library monoboehm-2.0.dll or monosgen-2.0.dll instead of mono-2.0.dll. The problem was (I think) you were looking for the wrong library's name.

无论如何,以下是从 cygwin 编译单声道必须遵循的步骤.

Anyhow, what follows are the steps that must be followed in order to compile mono from cygwin.

结束编辑

我设法使用 cygwin 从 Windows 8 编译 Mono(我猜,它也应该适用于 Windows 7)

I managed to compile Mono from Windows 8 using cygwin (I guess, it also should work with Windows 7)

为了完成拥有单声道虚拟机和您请求的库,我必须遵循以下步骤:

These are the steps that I had to follow in order to finish having the mono virtual machine and your requested library:

  1. 下载并安装全新的 32 位 cygwin 安装(即使您使用的是 64 位 Windows,也不要使用 cygwin 的 64 位版本)在我的情况下,cygwin 版本是 2.844 (32bit) 并且我的操作系统是 Windows 8 64 位.即使您已经拥有 cygwin 环境,最好(恕我直言)删除它并安装新的 cygwin 环境.

  1. Download and install a fresh cygwin installation for 32-bit (do not use the cygwin's 64-bit version even if you are using Windows 64-bit) In my case the cygwin version is 2.844 (32 bit) and my operative system is Windows 8 64-bit. Even if you already have a cygwin environment it should be better (IMHO) to remove it and install and new fresh cygwin environment.

cygwin 的安装路径应该(至少在我的情况下)在:C:cygwin

The cygwin's installation path should be (at least in my case) in: C:cygwin

使用 cygwin,您必须安装一些运行 setup-86.exe 所需的依赖项.没有它们,您将无法从 cygwin 编译单声道:

Using cygwin you must install some required dependencies running setup-86.exe. Without them, you are not going to be able to compile mono from cygwin:

autoconf、automake、bison、gcc-core、gcc-g++、mingw-gcc、libtool、make、python、automake、bison、gcc、gdb、gettext、intltool、libiconv、libtool、pkg-config、vim

autoconf, automake, bison, gcc-core, gcc-g++, mingw-gcc, libtool, make, python, automake, bison, gcc, gdb, gettext, intltool, libiconv, libtool, pkg-config, vim

  • 打开 cygwin 控制台并运行以下命令:

  • Open a cygwin console and run these commands:

    我@mewin8 ~$ mkdir -p/opt/mono323

    我@mewin8 ~$ mkdir -p/opt/mymono

    我@mewin8 ~$ cd/opt

    我@mewin8/opt$ git clone https://github.com/mono/mono.git

    我@mewin8/opt$ cd 单声道

    我@mewin8/opt/mono$ git submodule init

    我@mewin8/opt/mono$ git checkout --track origin/mono-3.4.0-branch

    Windows 的 cygwin 控制台外部下载单声道(从 cygwin 编译单声道时将需要它):http://download.mono-project.com/archive/3.2.3/windows-installer/mono-3.2.3-gtksharp-2.12.11-win32-0.exe

    Outside cygwin console download mono for Windows (you are going to need it when compiling mono from cygwin): http://download.mono-project.com/archive/3.2.3/windows-installer/mono-3.2.3-gtksharp-2.12.11-win32-0.exe

    在 C:cygwinoptmono323 中为 Windows 安装 mono

    Install mono for Windows in C:cygwinoptmono323

    再次进入 cygwin 控制台并运行以下命令:

    Go again to the cygwin console and run these commands:

    我@mewin8 ~$ cd/opt/mono

    我@mewin8/opt/mono$ export PATH=$PATH:/opt/mono323/bin

    我@mewin8/opt/mono$ ./autogen.sh --host=i686-pc-mingw32 --prefix=/opt/mymono/

    我@mewin8/opt/mono$ 制作

    编译以错误结束.看到这个线程:来自 git 的 mono 不会在 cygwin 32 上构建 解决方案:

    The compilation ends with error. See this thread: mono from git will not build on cygwin 32 Solution:

    我@mewin8/opt/mono$ vim/usr/i686-pc-mingw32/sys-root/mingw/include/ddk/ntapi.h

    注释掉这一行typedef PVOID PEXECUTION_STATE;如果你和我的步骤一样,要注释掉的那一行应该是数字49.你必须完成//typedefPVOID PEXECUTION_STATE;

    Comment out this line typedef PVOID PEXECUTION_STATE; If you have followed the same steps as me, the line to be commented out should be the number 49. You must finish having //typedef PVOID PEXECUTION_STATE;

    重启编译:

    我@mewin8/opt/mono$ 清理

    我@mewin8/opt/mono$ 制作

    我@mewin8/opt/mono$ make install

    您可能会在此路径中找到您请求的库(实际上您已经拥有了两个):

    You may find your requested library in this path (actually you finish having two):

    实现使用SGen GC:/opt/mymono/bin/libmonosgen-2.0.dll

    你可以像这样创建一个符号链接:/opt/mymono/lib/libmono-2.0.dll ->/opt/mymono/bin/libmonoboehm-2.0.dll;或像这样:/opt/mymono/lib/mono-2.0.dll ->/opt/mymono/bin/libmonoboehm-2.0.dll(适合你的)

    You could create a symbolic link like this: /opt/mymono/lib/libmono-2.0.dll -> /opt/mymono/bin/libmonoboehm-2.0.dll; or like this one: /opt/mymono/lib/mono-2.0.dll -> /opt/mymono/bin/libmonoboehm-2.0.dll (whatever works for you)

    根据您使用库的方式,符号链接可能对您感兴趣或不感兴趣.

    Depending on how you are going to work with the library, the symbolic link could be interesting for you or not.

    此外,如果 gcc/ld 在尝试构建自己的程序时可能找不到您的库(我的意思是您要嵌入单声道的程序)并且您正在尝试从 cygwin 控制台编译,您可以这样做这个:

    Besides, if gcc/ld may not find your library while trying to build your own program (I mean the program where you are going to embed mono) and you are trying to compile from a cygwin console you could do this:

    导出 LD_LIBRARY_PATH=/opt/mymono/lib 参见:man ld

    这就是我所知道的.希望对你有所帮助……至少我尽力了!

    This is all I know. Hopefully it will help you... At least I tried my best!

    这篇关于获取/编译 Mono-2.0.dll 以进行嵌入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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