question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

libhostpolicy.so not found when cross-compiling for Linux on Windows

See original GitHub issue

Steps to reproduce

Create new ASP.NET Core 1.1 web app in Visual Studio 2017, using the “empty” template Build and publish for Debian:

dotnet restore -r debian-x64
dotnet publish . -o "C:\TempPublish\helloworld" -c Release -r debian-x64

rsync to Debian server Attempt to run the site:

ASPNETCORE_ENVIRONMENT=Production COREHOST_TRACE=1 dotnet WebApplication9.dll

Expected behavior

It works

Actual behavior

A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found

I do see libhostpolicy.so at /opt/dotnet/shared/Microsoft.NETCore.App/1.1.1/libhostpolicy.so; is there something I need to do to get it to use that one?

Full error:

18:40 daniel@vps03 /home/daniel/temp/corehelloworld/helloworld
% ASPNETCORE_ENVIRONMENT=Production COREHOST_TRACE=1 dotnet WebApplication9.dll  --server.urls http://\*:37652
Tracing enabled
--- Invoked dotnet [version: 1.1.0, commit hash: 928f77c4bc3f49d892459992fb6e1d5542cb5e86] main = {
dotnet
WebApplication9.dll
--server.urls
http://*:37652
}
Reading fx resolver directory=[/opt/dotnet/host/fxr]
Considering fxr version=[.]...
Considering fxr version=[1.1.0]...
Considering fxr version=[..]...
Detected latest fxr version=[/opt/dotnet/host/fxr/1.1.0]...
Resolved fxr [/opt/dotnet/host/fxr/1.1.0/libhostfxr.so]...
Tracing enabled
--- Invoked hostfxr [commit hash: 928f77c4bc3f49d892459992fb6e1d5542cb5e86] main
Own DLL path=[/opt/dotnet/dotnet.dll]
Checking if CoreCLR path exists=[/opt/dotnet/libcoreclr.so]
--- Executing in muxer mode...
Detected a non-standalone application, expecting app.dll to execute.
Treating application '/home/daniel/temp/corehelloworld/helloworld/WebApplication9.dll' as a managed executable.
App runtimeconfig.json from [/home/daniel/temp/corehelloworld/helloworld/WebApplication9.dll]
Runtime config is cfg=/home/daniel/temp/corehelloworld/helloworld/WebApplication9.runtimeconfig.json dev=/home/daniel/temp/corehelloworld/helloworld/WebApplication9.runtimeconfig.dev.json
Attempting to read runtime config: /home/daniel/temp/corehelloworld/helloworld/WebApplication9.runtimeconfig.json
Attempting to read dev runtime config: /home/daniel/temp/corehelloworld/helloworld/WebApplication9.runtimeconfig.dev.json
Runtime config [/home/daniel/temp/corehelloworld/helloworld/WebApplication9.runtimeconfig.json] is valid=[1]
Executing as a standalone app as per config file [/home/daniel/temp/corehelloworld/helloworld/WebApplication9.runtimeconfig.json]
--- Resolving libhostpolicy.so version from deps json [/home/daniel/temp/corehelloworld/helloworld/WebApplication9.deps.json]
Resolved version 1.1.0 from dependency manifest file [/home/daniel/temp/corehelloworld/helloworld/WebApplication9.deps.json]
Directory core servicing at [] was not specified or found
Fallback directory core servicing at [/opt/coreservicing] was not found
Did not find libhostpolicy.so in directory /pkgs/runtime.debian.8-x64.Microsoft.NETCore.DotNetHostPolicy/1.1.0/runtimes/debian.8-x64/native
The expected libhostpolicy.so directory is [/home/daniel/temp/corehelloworld/helloworld]
The libhostpolicy.so was not found in [/home/daniel/temp/corehelloworld/helloworld]
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/home/daniel/temp/corehelloworld/helloworld'.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0)

Product Information:
 Version:            1.0.0
 Commit SHA-1 hash:  e53429feb4

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16179
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\1.0.0

Server has:


Microsoft .NET Core Shared Framework Host

  Version  : 1.1.0
  Build    : 928f77c4bc3f49d892459992fb6e1d5542cb5e86

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

9reactions
livarcocccommented, May 4, 2017

A couple of things here.

  1. The right rid to use with debian is debian.8-x64, not debian-x64.
  2. Second, taking in consideration the folder you put above, you need to check under bin/Release/netcoreapp1.1/debian-x64/publish/. I know the the output of the publish is pointing to the folder above, we have fixed that in the 2.0 tooling.

I have tried what I indicated above and I can see a <app> file in the publish output folder and run it.

0reactions
Daniel15commented, May 4, 2017

Thank you! It works when I use debian.8-x64. Did that change at some point? debian-x64 worked in previous releases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A fatal error was encountered. The library 'libhostpolicy.so ...
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/app'. docker .
Read more >
Debug Your .NET Core Apps in WSL 2 with Visual Studio
I get a message where cwd is always prefixed with /mnt/x/… (where x is my mapped drive) and can not find the path...
Read more >
Under Linux, I cannot run my project; libhostpolicy.so is ...
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/mnt/UBUNTU_OPT/Dropbox/ ...
Read more >
Cross Compiling With CMake
In order to use CMake for cross-compiling, a CMake file that describes the target platform has to be created, called the “toolchain file,”...
Read more >
Untitled
NET package mix ups on Linux - .NET WebApr 30, 2017 · Daniel15 changed the title libhostpolicy.so not found when cross-compiling for Linux...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found