如何在Debian 9.3上编译Mono

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何在Debian 9.3上编译Mono相关的知识,希望对你有一定的参考价值。

我尝试使用命令在Debian 9.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

如何解决这个问题,以便单声道可以编译?

/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:What is git tag, How to create tags & How to checkout git remote tag(s)

re:https://github.com/mono/mono/tree/mono-5.18.1.0

以上是关于如何在Debian 9.3上编译Mono的主要内容,如果未能解决你的问题,请参考以下文章

如何在Debian或Ubuntu上编译virt-manager

在Debian上编译2.6.30+bfs

GCC/MingW 在不同版本上编译

请问windows visual studio上编译的C#程序是不是能在linux上运行?

如何在windows上编译Chromium 并加入MP3支持

远程调试如何工作?代码需要在本地机器上编译吗?