如何在Debian9.3上编译Mono

如何在Debian9.3上编译Mono,mono,debian,Mono,Debian,我尝试使用命令在Debian9.3上编译mono apt-get install git autoconf libtool automake build-essential gettext cmake python cd /usr/local/src wget https://github.com/mono/mono/archive/mono-5.18.1.0.tar.gz tar -xvf mono-5.18.1.0.tar.gz cd mono-mono-5.18.1.0 ./autogen

我尝试使用命令在Debian9.3上编译mono

apt-get install git autoconf libtool automake build-essential gettext cmake python
cd /usr/local/src
wget https://github.com/mono/mono/archive/mono-5.18.1.0.tar.gz
tar -xvf mono-5.18.1.0.tar.gz
cd mono-mono-5.18.1.0
./autogen.sh --prefix=/opt/m518
./configure --prefix=/opt/m518
make
但是犯了一个奇怪的错误

...
make[3]: Entering directory '/usr/local/src/mono-mono-5.18.1.0/mono/btls'
mkdir -p build-shared
(cd build-shared && CC="gcc" CXX="g++" /usr/bin/cmake -D CMAKE_MAKE_PROGRAM=/usr/bin/make -D CMAKE_INSTALL_PREFIX:PATH=/opt/m518 -D BTLS_ROOT:PATH=/usr/local/src/mono-mono-5.18.1.0/external/boringssl -D SRC_DIR:PATH=/usr/local/src/mono-mono-5.18.1.0/mono/btls -D BTLS_CFLAGS:STRING=""  -DBTLS_ARCH="x86_64" -DBUILD_SHARED_LIBS=1 /usr/local/src/mono-mono-5.18.1.0/mono/btls)
CMake Warning at CMakeLists.txt:27 (message):
  SET ARCH: x86_64


CMake Error at CMakeLists.txt:48 (add_subdirectory):
  The source directory

    /usr/local/src/mono-mono-5.18.1.0/external/boringssl

  does not contain a CMakeLists.txt file.

-- Configuring incomplete, errors occurred!
See also "/usr/local/src/mono-mono-5.18.1.0/mono/btls/build-shared/CMakeFiles/CMakeOutput.log".
Makefile:607: recipe for target 'build-shared/Makefile' failed
make[3]: *** [build-shared/Makefile] Error 1
如何解决这个问题,使mono可以编译

/usr/local/src/mono-mono-5.18.1.0/external/boringssl目录为空

更新

我按照答案中的描述编译了Mono。MVC应用程序未启动。Apache errorlog包含找不到string.split的错误(下面是完整错误)。如何修复此问题,以便应用程序能够运行

[Fri Mar 29 23:26:57.643727 2019] [mpm_event:notice] [pid 28163:tid 140067959029824] AH00489: Apache/2.4.25 (Debian) mod_mono/3.12 configured -- resuming normal operations
[Fri Mar 29 23:26:57.643846 2019] [core:notice] [pid 28163:tid 140067959029824] AH00094: Command line: '/usr/sbin/apache2'
[ERROR] FATAL UNHANDLED EXCEPTION: System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.MissingMethodException: Method 'string.Split' not found.
  at System.Configuration.SectionGroupInfo.ReadRootData (System.Xml.XmlReader reader, System.Configuration.Configuration config, System.Boolean overrideAllowed) [0x00007] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/SectionGroupInfo.cs:273 
  at System.Configuration.Configuration.ReadConfigFile (System.Xml.XmlReader reader, System.String fileName) [0x000ce] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/Configuration.cs:572 
  at System.Configuration.Configuration.Load () [0x00043] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/Configuration.cs:532 
  at System.Configuration.Configuration.Init (System.Configuration.Internal.IConfigSystem system, System.String configPath, System.Configuration.Configuration parent) [0x0005d] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/Configuration.cs:138 
  at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x00056] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/Configuration.cs:96 
  at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x00038] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/Configuration.cs:91 
  at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x0000d] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/InternalConfigurationFactory.cs:41 
  at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (System.Configuration.ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x000ea] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:119 
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x0000e] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:49 
   --- End of inner exception stack trace ---
  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x0001f] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:52 
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs:61 
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:159 
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in /usr/local/src/mono/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs:173 
  at Mono.WebServer.Options.Settings.Setting`1[T]..ctor (System.String name, Mono.WebServer.Options.Settings.Parser`1[T] parser, System.String description, System.String appSetting, System.String environment, System.Nullable`1[T] defaultValue, System.String prototype) [0x000c5] in /usr/local/src/xsp-4.6/src/Mono.WebServer/Options/Settings/Setting.cs:55 
  at Mono.WebServer.Options.Settings.NullableSetting`1[T]..ctor (System.String name, Mono.WebServer.Options.Settings.Parser`1[T] parser, System.String description, System.String appSetting, System.String environment, System.Nullable`1[T] defaultValue, System.String prototype) [0x00003] in /usr/local/src/xsp-4.6/src/Mono.WebServer/Options/Settings/NullableSetting.cs:33 
  at Mono.WebServer.Options.Settings.NullableUInt16Setting..ctor (System.String name, System.String description, System.String appSetting, System.String environment, System.Nullable`1[T] defaultValue, System.String prototype) [0x00000] in /usr/local/src/xsp-4.6/src/Mono.WebServer/Options/Settings/NullableUInt16Setting.cs:35 
  at Mono.WebServer.Apache.ConfigurationManager..ctor (System.String name, System.Boolean quietDefault, System.String rootDefault) [0x0009c] in /usr/local/src/xsp-4.6/src/Mono.WebServer.Apache/ConfigurationManager.cs:43 
  at Mono.WebServer.Apache.Server.RealMain (System.String[] args, System.Boolean root, Mono.WebServer.IApplicationHost ext_apphost, System.Boolean v_quiet) [0x0001a] in /usr/local/src/xsp-4.6/src/Mono.WebServer.Apache/main.cs:77 
  at (wrapper remoting-invoke-with-check) Mono.WebServer.Apache.Server:RealMain (string[],bool,Mono.WebServer.IApplicationHost,bool)
  at Mono.WebServer.Apache.Server.Main (System.String[] args) [0x00034] in /usr/local/src/xsp-4.6/src/Mono.WebServer.Apache/main.cs:58 

浅克隆您需要的特定分支/标记:

git clone --recursive https://github.com/mono/mono.git --branch=mono-5.18.1.0
cd mono
make install
关于:


re:

external目录用于git子模块(),否则您需要手动将每个子模块的代码集安装到您正在构建的mono版本的正确提交位置。external目录包含许多空子目录。看起来tar文件不包含这些内容。也许我不需要它们。我应该填写这些以便Mono可以编译吗?如果是,所有这些目录应该从Github手动加载还是有更简单的方法?我总是使用
git
来拉取代码集(
git clone--recursive),而不是使用tar ballhttps://github.com/mono/mono.git
)因此一切都可用。。。你能手工做吗,当然,但是,值得花时间吗。。。不适合我…我需要为ASP.NET MVC应用程序安装更新的Mono for production system。当前的git版本未经测试,可能包含严重的bug。如何下载最新版本以及编译所需的所有文件?我不知道git,是否有一些git命令代替了wget?我试过了,但得到了错误
克隆到“mono”。。。致命:在上游源代码中找不到远程分支5.18.1.0
Typo,使用
mono-5.18.1.0
(我在答案中有正确的链接,但在分支选项中使用了错误的用法)。我从github编译了mono、xsp和libgdiplus。尝试运行apache会导致找不到string.split的异常。我更新了问题并提供了完整的堆栈跟踪。如何解决这个问题?@Andrus你真的应该把这个问题当作另一个问题来问。。。。如果您创建的控制台应用程序使用“系统”并包含
string.Split
方法,是否会以同样的方式失败。。。String.Split是ref.source的一部分,所以除非它没有被编译到System.dll中(不知道这是怎么发生的):我在中把它作为单独的问题发布了。新的Mono安装在
/opt/m518
中。如何使用它来编译控制台应用程序?环境是否应该更改,或者我是否可以直接调用
/opt/m518
中的编译器?