换了一个系统, xubuntu14 ,然后今天安装 YCM 的时候出错了错误,我的安装指令是./install.py -all
msbuild or xbuild is required to build Omnisharp
后来查到了这篇回答,why-is-omnisharp-not-working,看到了 programingfrik 的答案,说是omnisharp
没能正确安装,于是我切换到YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer
目录下,执行了一下安装指令
git checkout master
git submodule update --init --recursive
sudo apt-get install mono-xbuild
xbuild
然后又报错了,这回不知道该咋办了,特来向 V 友们求助!
我的分支和 mono 版本是这样的:
➜ /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer (master) $ git branch -v
* master e190291 Merge pull request #207 from micbou/drive-letter
➜ /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer (master) $ mono --version
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1.1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: sgen
报的错误是这样的:
➜ /home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer (master) $ xbuild
XBuild Engine Version 12.0
Mono, Version 3.2.8.0
Copyright (C) 2005-2013 Various Mono authors
Build started 4/22/2016 10:44:14 PM.
__________________________________________________
Project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln" (default target(s)):
Target ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Target Build:
Project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj" (default target(s)):
Target PrepareForBuild:
: error : Error initializing task Message: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
Task "Message" execution -- FAILED
Done building target "PrepareForBuild" in project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj".-- FAILED
Target _RecordCleanFile:
: error : Error initializing task ReadLinesFromFile: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
Task "ReadLinesFromFile" execution -- FAILED
Done building target "_RecordCleanFile" in project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj".-- FAILED
Done building project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj".-- FAILED
Project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj" (default target(s)):
Target PrepareForBuild:
: error : Error initializing task Message: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
Task "Message" execution -- FAILED
Done building target "PrepareForBuild" in project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj".-- FAILED
Target _RecordCleanFile:
: error : Error initializing task ReadLinesFromFile: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
Task "ReadLinesFromFile" execution -- FAILED
Done building target "_RecordCleanFile" in project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj".-- FAILED
Done building project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj".-- FAILED
Task "MSBuild" execution -- FAILED
Done building target "Build" in project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln".-- FAILED
Done building project "/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln".-- FAILED
Build FAILED.
Errors:
/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln (default targets) ->
(Build target) ->
/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.Common.targets (PrepareForBuild target) ->
: error : Error initializing task Message: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln (default targets) ->
(Build target) ->
/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/Microsoft.Build.Evaluation/Microsoft.Build.Evaluation.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.Common.targets (_RecordCleanFile target) ->
: error : Error initializing task ReadLinesFromFile: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln (default targets) ->
(Build target) ->
/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.Common.targets (PrepareForBuild target) ->
: error : Error initializing task Message: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln (default targets) ->
(Build target) ->
/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/NRefactory/ICSharpCode.NRefactory/ICSharpCode.NRefactory.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.Common.targets (_RecordCleanFile target) ->
: error : Error initializing task ReadLinesFromFile: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specified.
0 Warning(s)
4 Error(s)
Time Elapsed 00:00:00.5894150
望 V 友们给个提示呗,这是啥错误啊,从哪里入手解决!
折腾了一下,决定不整了,记录一下我折腾的情况吧!
首先,发现自己装的时候装错了,我安装YCM的时候,用的是./install.py -all
,这是默认安装所有特性,其中就包括了,C#的补全(./install.py --omnisharp-completer
)而报错的这个OmniSharpServer
库,正是C#的补全库!,什么鬼,Linux下写C#这种事情我根本不会干好伐!
但是觉得已经开搞了,不试着解决解决总是怪怪的,于是找了一下解决方案,发现我少装了两个包,又装了这么两个包 !
sudo apt-get install libmono-microsoft-build-tasks-v4.0-4.0-cil
sudo apt-get install mono-dmcs
但是还是报错啊,错误是这样的:
/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp.sln (default targets) ->
(Build target) ->
/home/michael/Bundle/k-vim/bundle/YouCompleteMe/third_party/ycmd/third_party/OmniSharpServer/OmniSharp/OmniSharp.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.CSharp.targets (CoreCompile target) ->
: error CS8001: Warning as Error: SDK path could not be resolved
然后我就无解了,最终决定放弃,因为我根本不会在VIM中写C#啊,感觉自己真是闲的蛋疼!
1
bwangel OP 报错的编译命令是好长好长的一句, V2 贴不上来啊!
|