Msbuild: Support for Ubuntu 16.04

Created on 28 Jul 2016  路  9Comments  路  Source: dotnet/msbuild

Hi. It's been a few week since .NET Core was released, and it works fine on Ubuntu 16.04.
Therefore, it should be possible to update MSBuild to also support it.

Currently, installing libunwind8 on this version of Ubuntu does not seem to solve the problem.
Sample run:

$ uname -a
Linux jurocha-pad 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ sudo apt install libunwind8
$ git clone https://github.com/Microsoft/msbuild.git --branch xplat
$ cd msbuild
$ ./cibuild.sh 
Unsupported target detected: . Configuring as if for CoreCLR
Unsupported host detected: . Configuring as if for CoreCLR
Installing dotnet cli...
Restoring BuildTools version 1.0.25-prerelease-00410-01...
Failed to initialize CoreCLR, HRESULT: 0x80131500
$ cat init-tools.log 
Running: /home/jurocha/Desktop/msbuild/init-tools.sh
Installing 'https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/1.0.0-rc2-002547/dotnet-dev-ubuntu-x64.1.0.0-rc2-002547.tar.gz' to '/home/jurocha/Desktop/msbuild/Tools/dotnetcli/dotnet.tar'
Running: /home/jurocha/Desktop/msbuild/Tools/dotnetcli/dotnet restore "/home/jurocha/Desktop/msbuild/Tools/1.0.25-prerelease-00410-01/project.json" --packages /home/jurocha/Desktop/msbuild/packages --source https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json

Maybe the .NET Core dependency can be bumped to the same version as the official release?

Most helpful comment

I vote go the second way and then let the magic of the CLI solve this for us long-term.

All 9 comments

I think the problem is that we're downloading and using a fairly old version of the dotnet CLI as the initial bootstrapper to build us the first time. I bet MSBuild would work after bootstrapping.

Conveniently, we will be updating our Build Tools dependency in the not-too-distant future for another reason (fixes to NuGet packaging). @jeffkl when you're done with that can you briefly see if my guess is correct and that fixes our build on 16.04? If it doesn't we'll need to investigate further.

Okay here's the problem, we're statically setting the Runtime Identifier (RID) to ubuntu.14.04 here. We really should be detecting the RID via the RuntimeEnvironment class in .NET Core.

We can also get the correct RID in our cibuild.sh in the same way that init-tools.sh does here.

The second option would be a lot easier to implement but the first option is a better long term solution. There is no MSBuild task for getting the RuntimeEnvironment so we'd either have to write our own or expose a static method.

I vote go the second way and then let the magic of the CLI solve this for us long-term.

Greetings. I just tried this change, but it still fails. Here are the init-tools.log contents:

Running: /home/user/ws/msbuild/init-tools.sh
Installing 'https://dotnetcli.blob.core.windows.net/dotnet/Sdk/1.0.0-preview3-003686/dotnet-dev-ubuntu.16.04-x64.1.0.0-preview3-003686.tar.gz' to '/home/user/ws/msbuild/Tools/dotnetcli/dotnet.tar'
Running: /home/user/ws/msbuild/Tools/dotnetcli/dotnet restore "/home/user/ws/msbuild/Tools/1.0.26-prerelease-00826-05/project.json" --no-cache --packages /home/user/ws/msbuild/packages --source https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json --legacy-packages-directory
log  : Restoring packages for /home/user/ws/msbuild/Tools/1.0.26-prerelease-00826-05/project.json...
error: Unable to load the service index for source https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json.
error:   The type initializer for 'System.Net.Http.CurlHandler' threw an exception.
error:   The type initializer for 'Http' threw an exception.
error:   The type initializer for 'HttpInitializer' threw an exception.
error:   Unable to load DLL 'System.Net.Http.Native': The specified module could not be found.
error:    (Exception from HRESULT: 0x8007007E)
Running: /home/user/ws/msbuild/packages/Microsoft.DotNet.BuildTools/1.0.26-prerelease-00826-05/lib/init-tools.sh /home/user/ws/msbuild /home/user/ws/msbuild/Tools/dotnetcli/dotnet /home/user/ws/msbuild/Tools

(Note: Using a standard Ubuntu 16.04, x64 installation).

Please reopen this issue.

@emgarten or @eerhardt do either of you know what could the error above this or who would know? It's working fine in our CI and on my local machine.

@JunielKatarn - Do you have all the prereqs installed on the machine? See https://github.com/dotnet/core/blob/master/Documentation/prereqs.md

I didn't know about the full dependency list (was only aware of libunwind8*).
It builds successfully after installing all the list.
Thanks!

@anotherbugmaster Good catch; I updated the instructions. The easiest way to get going now is to just install the .NET Core SDK, which brings in the appropriate dependencies.

Was this page helpful?
0 / 5 - 0 ratings