这两天尝试在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. ASP.NET Web API系列教程目录

    ASP.NET Web API系列教程目录 Introduction:What's This New Web API?引子:新的Web API是什么? Chapter 1: Getting Start ...

  2. 转Web安全测试之XSS

    转http://www.cnblogs.com/TankXiao/archive/2012/03/21/2337194.html XSS 全称(Cross Site Scripting) 跨站脚本攻击 ...

  3. servlet3.0,web.xml的metadata-complete的作用

    metadata-complete是servlet3.0规范中的新增的属性,该属性接受两个属性值,true或false.当该属性值为true时,该web应用将不会加载Annotation配置的web组 ...

  4. strcat strcpy 使用出现的问题汇总

    事例1(转)  在程序中多次用的strcat函数,但是有时候编译通过,但是执行时却出现了错误.为了进一步了解strcat函数的使用,我首先写了这样的一个测试程序: main(){       char ...

  5. 解决Linux c语言运行时候“段错误 (核心已转储)”问题-采用gdb 解决

    编译没有警告,没有错误,运行就打印 段错误 (核心已转储) 网上找了一下,都是各种问题,都推荐用gdb 调试解决,咱也来趁机学习gdb一下.   gcc+gdb)输入命令行 运行 sudo apt-g ...

  6. bzoj 2152聪聪可可

    2152: 聪聪可可 Time Limit: 3 Sec  Memory Limit: 259 MB Description 聪聪和可可是兄弟俩,他们俩经常为了一些琐事打起来,例如家中只剩下最后一根冰 ...

  7. 开发板通过UART向主机发送数据

    /********************************* 代码功能:开发板通过UART向主机发送数据 使用函数: Serial.begin(数据传输的波特率); Serial.printl ...

  8. Selenium2+python自动化7-xpath定位

    前言 在上一篇简单的介绍了用工具查看目标元素的xpath地址,工具查看比较死板,不够灵活,有时候直接复制粘贴会定位不到.这个时候就需要自己手动的去写xpath了,这一篇详细讲解xpath的一些语法. ...

  9. 开源PLM软件Aras详解四 ItemType的概念

    首先,我们需要了解什么是ItemType,俗称对象类 官方一点就是ItemType是一个用来定义业务对象类的业务对象类 通过ItemType定义的每个业务对象类可以产生各自的实例对象 通过ItemTy ...

  10. textarea 怎么固定大小,不让调整

    1:彻底禁用拖动(推荐) resize: none; 2:只是固定大小,右下角的拖动图标仍在 width: 200px; height: 100px; max-width: 200px; max-he ...