这两天尝试在Mac/Linux/Windows三大平台上编译.NET跨平台三驾马车(coreclr/corefx/dnx)之一的corefx(.NET Core Framework),结果三个平台的编译都失败了。后来一一都解决了,在这篇博文中分享一下。

(一)

在Mac上编译corefx遇到的错误如下:

/git/dotnet/corefx/dir.props(214,5): warning :
The Roslyn targets do not exist- Roslyn will not be used for this build, but the package should be restored if you build again.
[/git/dotnet/corefx/src/dirs.proj] /git/dotnet/corefx/dir.props(214,5): warning :
The Roslyn targets do not exist- Roslyn will not be used for this build, but the package should be restored if you build again.
[/git/dotnet/corefx/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj] /var/folders/c4/lf8cm6lx5178xsswpzfs2f_c0000gn/T/tmp257bf798c8da46a7baf3954722152b21.exec.cmd:
line 3: /git/dotnet/corefx/packages/dnx-mono.1.0.0-beta5-11760/bin/dnu: Permission denied /git/dotnet/corefx/packages/Microsoft.DotNet.BuildTools.1.0.25-prerelease-00050/lib/packageresolve.targets(31,5): error MSB3073:
The command ""/git/dotnet/corefx/packages/dnx-mono.1.0.0-beta5-11760/bin/dnu" restore --packages "/git/dotnet/corefx/packages" "/git/dotnet/corefx/src/Microsoft.CSharp/src/project.json"" exited with code 126.
[/git/dotnet/corefx/src/Microsoft.CSharp/src/Microsoft.CSharp.csproj] ... 6 Warning(s)
5 Error(s)

删除corefx中packages文件夹重新编译,错误变成了:

System.IO.InvalidDataException: Unable to read package from path 'Microsoft.Net.ToolsetCompilers.1.0.0-rc3-20150510-01.nupkg'.
---> System.IO.FileFormatException: The specified archive is invalid.
at System.IO.Packaging.Package.OpenCore (System.IO.Stream stream, FileMode packageMode,
FileAccess packageAccess, Boolean ownsStream) <0x1055e4fd0 + 0x001df> in <filename unknown>:0

再次编译,又回到了之前的错误。

怀疑问题是Mac电脑与NuGet服务器之间的网络问题引起的,于是从另外一台Linux服务器上将corefx所需的所有packages下载下来之后,编译就取得了成功。

scp -r root@server:/git/corefx/packages/ /git/dotnet/corefx
./build.sh
...
1 Warning(s)
0 Error(s)
Time Elapsed 00:07:33.93
Build Exit Code = 0

(二)

在Linux CentOS上编译corefx遇到的错误如下:

Restoring MSBuild...
WARNING: Error: SendFailure (Error writing headers)
WARNING: Error: SendFailure (Error writing headers)
WARNING: The request timed out
WARNING: Error: SendFailure (Error writing headers)
Unable to find version '14.1.0.0-prerelease' of package 'Microsoft.Build.Mono.Debug'.
Failed to restore MSBuild.

这个问题是由于没有在Linux上安装根证书,无法以https访问nuget服务器,运行下面的命令就可以解决问题:

mozroots --import --sync

(三)

在Windows上编译corefx遇到的错误如下(电脑上安装的是Visual Studio 2015):

corefx\src\Common\src\System\SR.cs(19,67): error CS0117:
'SR' does not contain a definition for 'ResourceType'
[corefx\src\Microsoft.CSharp\src\Microsoft.CSharp.csproj]
...

这个问题比较怪,竟然是前段时间编译corefx时在bin文件夹生成的文件引起的,删除corefx中的bin文件夹,重新编译,问题就消失了。

【相关链接】

Build fails on Mac/Linux/Windows

在Mac/Linux/Windows上编译corefx遇到的问题及解决方法的更多相关文章

  1. Windows 上编译 corefx 源码生成 Linux 上可用的 System.Data.SqlClient.dll

    最近在排查一个奇怪的 EF Core 查询速度慢的问题,需要在 corefx 2.2.3 的 System.Data.SqlClient 源码中打点. github 上签出 corefx 的源代码,运 ...

  2. 在windows上部署使用Redis出现问题的解决方法

    下载Redis 在Redis的官网下载页上有各种各样的版本,我这次是在windows上部署的,要去GitHub上下载.目前的是2.8.12版的,直接解压,在\bin\release 目录下有个压缩包, ...

  3. Windows 上安装 Redis 及可能出现的错误和解决方法!

    前言 Redis(REmote Dictionary Server) 是一种以key-value写得存储系统.他是开源的ANSI语言编写的.遵守BSD协议.被称作“数据结构服务器”,因为它的值(val ...

  4. [ZZ] 在windows上编译Mesa3d opengl32库

    在windows上编译Mesa3d opengl32库 cheungmine http://blog.csdn.net/ubuntu64fan/article/details/8061475 Mesa ...

  5. 使用VS Code配合Remote Development插件连接远程服务器(Mac/Linux+Windows) | Using VS Code with Remote Development Connect to Remote Server (Mac/Linux+Windows)

    最新版VS Code(2019年6月)出了一系列新的插件,包括Remote Development,Remote SSH等,使得用户可以使用VS Code远程连接服务器写代码,方便了协同工作.具体配置 ...

  6. Go交叉编译(Go语言Mac/Linux/Windows下交叉编译)

    Go交叉编译(Go语言Mac/Linux/Windows下交叉编译) 2019/11/21 Chenxin 在很多时候,由于开发的方便,会有这样的场景出现,使用Mac开发或使用Windows开发,需要 ...

  7. 利用openssl管理证书及SSL编程第2部分:在Windows上编译 openssl

    利用openssl管理证书及SSL编程第2部分:在Windows上编译 openssl 首先mingw的环境搭建,务必遵循下文: http://blog.csdn.net/ubuntu64fan/ar ...

  8. 在windows上编译wireshark源代码

    终于在windows上成功编译了wireshark源代码,个中酸辛,都是泪..只能说要多试! windows上编译wireshark共用到三个东西:wireshark源代码.python.cygwin ...

  9. 在windows 上编译部署Rap2

    在windows 上编译部署Rap2 引言 安装需要的环境 安装后端站点 创建数据库 在全局安装pm2 和 typescript 配置mysql,redis 数据库链接配置 初始化 编译 初始化数据库 ...

随机推荐

  1. apache相关

    http://hw1287789687.iteye.com/blog/2212292 http://enable-cors.org/server_apache.html http://blog.sin ...

  2. ComponentCount 与 ControlCount 区别

       ShowMessage(panel.ComponentCount.ToString);  ShowMessage(panel.ControlCount.ToString);componetcou ...

  3. python some install tips

    /* wooyun的小伙伴出了神器. 但是都是打包配置的.我本机又搭建了wamp,不能混合了,那就自己动手丰衣足食咯. */ python 2.7 已经安装. pip https://pip.pypa ...

  4. flex4.0密钥及破解方式

    输入下面的序列号: 1424-4507-0757-7016-8907-6937 1424-4785-4428-8084-6314-8733 1424-4794-9281-8063-2338-9079 ...

  5. WPS项目编号问题

    问题:文档需要编号如下: 1.(标题1) 1.1(标题2) 1.1.1(标题3) 1.2 1.2.1 2.(标题1) 2.1(标题2) 2.1.1(标题3) 2.2 2.2.1 方法一: 第一步,打开 ...

  6. jQuery.bind() 函数详解

    bind()函数用于为每个匹配元素的一个或多个事件绑定事件处理函数. 此外,你还可以额外传递给事件处理函数一些所需的数据. 执行bind()时,事件处理函数会绑定到每个匹配元素上.因此你使用bind( ...

  7. firefox广告拦截插件

    firefox广告拦截插件: Adblock Plus  Adblock Edge Adblock Plus Pop-up Addon 如果不能更新,则需要修改HOST: 117.18.232.191 ...

  8. VS调试在Win7(vista系列)操作系统下 HttpListener拒绝访问解决办法

    一. VS调试在Win7(vista系列)操作系统下 HttpListener无法绑定多个 指定IP.端口问题 来自:http://www.cnblogs.com/ryhan/p/4195693.ht ...

  9. 使用 python 操作 redis

    1.安装pyredis (1)使用 # easy_install redis (2)直接编译安装 #wget https://pypi.python.org/packages/source/r/red ...

  10. ssh免密码登陆

    Ssh免密码登陆设置 准备工作:1.确保两个主机里没有id_rsa.pub和authorized_keys的文件(这两个文件会影响实验的结果)# find / -name id_rsa.pub可查看是 ...