Sdk: libhostpolicy.so not found

Created on 2 Feb 2017  路  12Comments  路  Source: dotnet/sdk

Steps to reproduce

  • get the latest cli binaries (see version info below) and put them on the path
  • dotnet new console
  • add rid to the project: <RuntimeIdentifier>ubuntu.16.04-x64</RuntimeIdentifier>
  • dotnet restore
  • dotnet run

Expected behavior

Program runs and prints hello world.

Actual behavior

Could not find required library libhostpolicy.so in 1 probing paths:
  /home/sven/.nuget/packages
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/home/sven/dotnettest/bin/Debug/netcoreapp1.0'.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc4-004755)

Product Information:
 Version:            1.0.0-rc4-004755
 Commit SHA-1 hash:  bffbee2b91

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /home/sven/bin/sdk/1.0.0-rc4-004755

Most helpful comment

In which CLI version was that fixed? I am experiencing this problem on 2.0.0-preview1-005977

All 12 comments

Possibly related to 5059 or 560

This is this issue here: https://github.com/dotnet/sdk/pull/811.

We have already taken a new version of the SDK that fixes this. If you try the latest CLI, this would work for you.

I tried it out.

Great, thanks!

In which CLI version was that fixed? I am experiencing this problem on 2.0.0-preview1-005977

I'm still experiencing this on 2.0.3.

Same here. Any news ?!
This is not fixed at all. Why closed?

I just tried this on OSX with RID osx-x64.

@Jose-CF can you give us a more detailed repro of your scenario?

@livarcocc I follow the steps from the original post and get the same error. Using dotnet sdk 2.0.2

Can you try with the latest release SDK, 2.1.4?

I am seeing the same error when running on docker.

docker logs 679f21c482b02f392e9bb5da197689b42a32e47d41f7b4c6deba3892320d45d9
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/app/'.

on 2.0.3 and 2.0.5

My Dockerfile

FROM microsoft/aspnetcore
ARG source
WORKDIR /app
EXPOSE 80
COPY ${source:-obj/release/netcoreapp2.0/} .
ENTRYPOINT ["dotnet", "harrier.dll"]

It doesn't work even locally, without invoking in container, but the dll is slightly different.

...\obj\release\netcoreapp2.0> dotnet harrier.dll
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in '...\obj\release\netcoreapp2.0\'.

EDIT:
replacing COPY ${source:-obj/release/netcoreapp2.0/} . with COPY ${source:-bin/Release/netcoreapp2.0/publish} . solved this problem. I don't understand it though ;)

The contents of the build folder are not supposed to be runnable in production. The way to distribute your app for production is to publish your app and use the contents of the publish folder.

I'm experiencing this bug in 2.0.6 using Amazon's dotnetcore ami image:
amzn2-ami-hvm-2017.12.0-x86_64-gp2-dotnetcore-2018.03.28 (ami-64a9771b)

--

$ dotnet DotNetWikiBot.Build.for.Mono.dll
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/opt/dotnet/DotNetWikiBot/'.

$ dotnet --info
.NET Command Line Tools (2.1.101)

Product Information:
Version: 2.1.101
Commit SHA-1 hash: 6c22303bf0

Runtime Environment:
OS Name: amzn
OS Version: 2
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/2.1.101/

Microsoft .NET Core Shared Framework Host

Version : 2.0.6
Build : 74b1c703813c8910df5b96f304b0f2b78cdf194d

$ cat /etc/*release
NAME="Amazon Linux"
VERSION="2 (2017.12)"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2 (2017.12) LTS Release Candidate"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
Amazon Linux release 2 (2017.12) LTS Release Candidate

Was this page helpful?
0 / 5 - 0 ratings