SampleApp build failure on Ubuntu server 14.04 #574

Closed
mikehadlow opened this Issue Jan 12, 2016 · 11 comments

Projects

None yet

4 participants

@mikehadlow

Starting with an AWS Ubuntu Server 14.04 EC2 t2.micro instance

Installed the dotnet toolchain using instructions on this page: http://dotnet.github.io/getting-started/

All steps successful, including creating and running a simple console application.

Cloned the KestrelHttpServer repo:

git clone https://github.com/aspnet/KestrelHttpServer.git

Attempt to build SampleApp:

cd samples/SampleApp
dotnet restore
dotnet bulid

Gives the following error:

Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'api-ms-win-core-localization-l1-2-0.dll': The specified module could not be found.
 (Exception from HRESULT: 0x8007007E)
   at Interop.mincore.FormatMessage(Int32 dwFlags, IntPtr lpSource_mustBeNull, UInt32 dwMessageId, Int32 dwLanguageId, StringBuilder lpBuffer, Int32 nSize, IntPtr[] arguments)
   at Interop.mincore.TryGetErrorMessage(Int32 errorCode, StringBuilder sb, String& errorMsg)
   at Interop.mincore.GetMessage(Int32 errorCode)
   at System.Diagnostics.Process.ResolvePath(String filename)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at Microsoft.DotNet.Cli.Utils.Command.Execute()
   at Microsoft.DotNet.Cli.Program.Main(String[] args)
Aborted (core dumped)
@shahid-pk

use these instructions instead http://docs.asp.net/en/latest/getting-started/installing-on-linux.html. The ones you are using are not ready yet for some scenarios. They will be ready by rc2

@mikehadlow

Thanks @shahid-pk. Unfortunately that doesn't work either, although the failure is different:

I followed the instructions to install coreClr: http://docs.asp.net/en/latest/getting-started/installing-on-linux.html

Here's my command history:

  5  curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
  6  source /home/ubuntu/.dnx/dnvm/dnvm.sh
  7  dnvm
  8  sudo apt-get install libunwind8 gettext libssl-dev libcurl4-openssl-dev zlib1g libicu-dev uuid-dev
  9  dnvm upgrade -r coreclr
 10  sudo apt-get install make automake libtool curl
 11  curl -sSL https://github.com/libuv/libuv/archive/v1.8.0.tar.gz | sudo tar zxfv - -C /usr/local/src
 12  cd /usr/local/src/libuv-1.8.0
 13  sudo sh autogen.sh
 14  sudo ./configure
 15  sudo make
 16  sudo make install
 17  sudo rm -rf /usr/local/src/libuv-1.8.0 && cd ~/
 18  sudo ldconfig

All steps reported success. I created an ran a little console application which worked fine.

Attempt to build the sample app:

 38  git clone https://github.com/aspnet/KestrelHttpServer.git
 39  ls
 40  cd KestrelHttpServer/samples/SampleApp/
 41  dnu restore
 42  dnx build
 43  dnx web

Which fails with the following exception:

Error: warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.
ApplyProjectInfo.cs(1,11): DNXCore,Version=v5.0 error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
ApplyProjectInfo.cs(2,11): DNXCore,Version=v5.0 error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
ApplyProjectInfo.cs(3,11): DNXCore,Version=v5.0 error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
ApplyProjectInfo.cs(4,11): DNXCore,Version=v5.0 error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
ApplyProjectInfo.cs(1,58): DNXCore,Version=v5.0 error CS0518: Predefined type 'System.String' is not defined or imported
ApplyProjectInfo.cs(2,58): DNXCore,Version=v5.0 error CS0518: Predefined type 'System.String' is not defined or imported
ApplyProjectInfo.cs(3,54): DNXCore,Version=v5.0 error CS0518: Predefined type 'System.String' is not defined or imported
ApplyProjectInfo.cs(4,67): DNXCore,Version=v5.0 error CS0518: Predefined type 'System.String' is not defined or imported
/home/ubuntu/source/KestrelHttpServer/src/Microsoft.AspNet.Server.Kestrel/compiler/preprocess/SPCM.cs(3,59): DNXCore,Version=v5.0 error CS0234: The type or namespace name 'StandardsPolice' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
@shahid-pk

add this package to the project.json file System.Runtime, version 4.0.21-beta-23509 under dnxcore50 or you can go all latest by getting latest version of the package with 'System.Runtime 4.0-21-*.
The sample may be outdated.
Next time you see some types missing use this site http://packagesearch.azurewebsites.net/ to find what package that type lives in.

@mikehadlow

I added System.Runtime to my project file:

{
  "version": "1.0.0-*",
  "dependencies": {
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-*",
    "Microsoft.AspNet.Server.Kestrel.Https": "1.0.0-*",
    "Microsoft.Extensions.Logging.Console": "1.0.0-*"
  },
  "compilationOptions": {
    "emitEntryPoint": true
  },
  "frameworks": {
    "dnx451": {
    },
    "dnxcore50": {
      "dependencies": {
        "System.Console": "4.0.0-*",
        "System.Runtime": "4.0-21-*"
      }
    }
  },
  "commands": {
    "web": "SampleApp"
  }
}

Then dnu restore reported some NotFound errors:

NotFound https://api.nuget.org/v3-flatcontainer/microsoft.aspnet.internal.libuv-windows/index.json 157ms
NotFound https://api.nuget.org/v3-flatcontainer/microsoft.aspnet.internal.libuv-darwin/index.json 279ms
NotFound https://api.nuget.org/v3-flatcontainer/system.threading.tasks.extensions/index.json 164ms

dnx web gave the same error as above.

@mikehadlow

BTW, dnu restore also reported:

Installing System.Runtime.4.0.0-beta-23019
@cesarbs cesarbs self-assigned this Jan 12, 2016
@cesarbs cesarbs added the 2 - Working label Jan 13, 2016
@cesarbs
Member
cesarbs commented Jan 13, 2016

@mikehadlow Run dnu restore at the root of the repository. Then go into samples/SampleApp and you should be able to build and run it.

There's some pre- and post-restore logic in src/Microsoft.AspNet.Server.Kestrel that needs to be run before you can run the sample apps.

@mikehadlow

Thanks @cesarbs. I ran dnu restore from the root then dnx web from samples/SampleApp. Now I'm getting the following error:

System.TypeLoadException: Method 'get_Configuration' in type 'WrappedApplicationEnvironment' from assembly 'Microsoft.AspNet.Hosting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.
   at Microsoft.AspNet.Hosting.WebApplicationBuilder.BuildHostingServices()
   at Microsoft.AspNet.Hosting.WebApplicationBuilder.Build()
   at SampleApp.Startup.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   at Microsoft.Dnx.ApplicationHost.Program.<>c__DisplayClass3_0.<ExecuteMain>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
@davidfowl
Member

You might be mixing an old DNX with newer packages. Update your DNX.

@mikehadlow

I think I've already got the latest dnx:

$ dnvm upgrade -r coreclr
Determining latest version
Latest version is 1.0.0-rc1-update1
dnx-coreclr-linux-x64.1.0.0-rc1-update1 already installed in /home/ubuntu/.dnx
@davidfowl
Member

Not new enough. Your packages are RC2 and your DNX is RC1, that will not work. Run dnvm upgrade -u The -u is for unstable.

@mikehadlow

Many thanks @davidfowl and @cesarbs! Now working:

$ dnvm upgrade -u -r coreclr
Determining latest version
Latest version is 1.0.0-rc2-16357
Downloading dnx-coreclr-linux-x64.1.0.0-rc2-16357 from https://www.myget.org/F/aspnetvnext/api/v2
Download: https://www.myget.org/F/aspnetvnext/api/v2/package/dnx-coreclr-linux-x64/1.0.0-rc2-16357
######################################################################## 100.0%
Installing to /home/ubuntu/.dnx/runtimes/dnx-coreclr-linux-x64.1.0.0-rc2-16357
Adding /home/ubuntu/.dnx/runtimes/dnx-coreclr-linux-x64.1.0.0-rc2-16357/bin to process PATH
Updating alias 'default' to 'dnx-coreclr-linux-x64.1.0.0-rc2-16357'
$ dnx web
dbug: Microsoft.AspNet.Hosting.Internal.WebApplication[3]
      Hosting starting
dbug: Microsoft.AspNet.Hosting.Internal.WebApplication[4]
      Hosting started
Hosting environment: Production
Now listening on: http://localhost:5000
Now listening on: https://localhost:5001
Application started. Press Ctrl+C to shut down.
@mikehadlow mikehadlow closed this Jan 14, 2016
@cesarbs cesarbs removed the 2 - Working label Jan 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment