libhostpolicy.so not found when cross-compiling for Linux on Windows
See original GitHub issueSteps 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:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
A couple of things here.
debian.8-x64
, notdebian-x64
.I have tried what I indicated above and I can see a <app> file in the publish output folder and run it.
Thank you! It works when I use
debian.8-x64
. Did that change at some point?debian-x64
worked in previous releases.