在Linux Ubuntu上编译DNX

DNX是.NET Execution Environment,前身是XRE,XRE的前身是KRuntime,项目网址:https://github.com/aspnet/DNX 。

签出DNX的代码:

git clone https://github.com/aspnet/DNX.git --recursive

安装Mono:

apt-get install mono-complete

运行./build.sh命令进行编译,出现错误:

WARNING: Invalid certificate received from server. Error code: 0xffffffff800b010a
WARNING: Invalid certificate received from server. Error code: 0xffffffff800b010a
WARNING: Invalid certificate received from server. Error code: 0xffffffff800b010a
WARNING: Invalid certificate received from server. Error code: 0xffffffff800b010a
Unable to find package 'KoreBuild'.
WARNING: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure
WARNING: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure
Unable to find version '0.2' of package 'Sake'.

通过下面的命令可以修复这个问题:

CERTMGR=/usr/local/bin/certmgr
sudo $CERTMGR -ssl -m https://go.microsoft.com
sudo $CERTMGR -ssl -m https://nugetgallery.blob.core.windows.net
sudo $CERTMGR -ssl -m https://nuget.org
sudo $CERTMGR -ssl -m https://www.myget.org/F/aspnetvnext/
mozroots --import --sync

继续编译,出现下面的错误:

./build.sh: 31: ./build.sh: source: not found
./build.sh: 35: ./build.sh: dnvm: not found

将build.sh文件中的第一行由 #!/bin/sh  改为  #!/usr/bin/env bash ,错误消失。

错误的原因是:在Ubuntu中,/bin/sh指向的是/bin/dash,而dash不支持source命令,详见source command not found in sh shell

继续编译,出现下面的错误:

info: Exec
info:   program: kpm
info:   commandline: restore
info:   workingdir: src/Microsoft.Framework.ApplicationHost
warn: ApplicationName='kpm', CommandLine='restore', CurrentDirectory='src/Microsoft.Framework.ApplicationHost', 
Native error= Cannot find the specified file

查看makefile.shade文件(这是Sake的配置文件),发现问题出在下面的配置部分

for each='var projectFile in Files.Include("src/*/project.json")'
        exec program='cmd' commandline='/C kpm restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
        exec program='kpm' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
for each='var projectFile in Files.Include("test/*/project.json")'
        exec program='cmd' commandline='/C kpm restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
        exec program='kpm' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
for each='var projectFile in Files.Include("samples/*/project.json")'
        exec program='cmd' commandline='/C kpm restore' if='!IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"
        exec program='kpm' commandline='restore' if='IsMono' workingdir="${Path.GetDirectoryName(projectFile)}"

出错是因为找不到kpm命令。

已经在github上针对这个问题提交了issue,等这个问题解决后再继续编译。

posted @ 2015-03-14 18:05 dudu 阅读(...) 评论(...) 编辑 收藏