sdk: Self-contained applications in Linux does not work
Steps to reproduce
mkdir hwappcd hwappdotnet new- Modify project.json to match self-contained app
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": "1.0.0-rc2-3002702"
},
"frameworks": {
"netcoreapp1.0": {}
},
"runtimes": {
"ubuntu.14.04-x64: {}
}
}
dotnet restoredotnet publish -o outcd outhwapp
Expected behavior
Print Hello World!
Actual behavior
hwapp: command not found
Environment data
.NET Command Line Tools (1.0.0-preview1-002702)
Product Information:
Version: 1.0.0-preview1-002702
Commit Sha: 6cde21225e
Runtime Environment:
OS Name: ubuntu
OS Version: 14.04
OS Platform: Linux
RID: ubuntu.14.04-x64
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 9
- Comments: 27 (8 by maintainers)
Commits related to this issue
- Add work around for missing libunwind on deploy https://github.com/dotnet/cli/issues/3390 — committed to flostellbrink/adp_project by flostellbrink 5 years ago
- Add work around for missing libunwind on deploy https://github.com/dotnet/cli/issues/3390 — committed to flostellbrink/adp_project by flostellbrink 5 years ago
For anyone still running into this, try
apt-get install libunwind8It solves the problem, but not the real issue. The application is not self-contained if it depends on a workaround. A self-contain application should run using just the kernel (i.e. Go with Docker scratch image).
@livarcocc The experience surrounding this issue is awful, consider reopening it and fixing at least the experience if not the issue itself.
The average .NET Core user has no clue what
libunwindis, and probably jumps back to building their service in Node.js or Ruby after they see an error like this.This isn’t an isolated incident either, this is a problem for EVERY self-contained linux app deployed to a machine without a portable framework installed. Self-contained apps are exactly the same as portable apps from a (single) deployment and usability perspective, for this reason.
There are several ways to solve this problem (without distributing the libraries yourself), I think the easiest of which is to print a command or set of commands that the user can copy/paste to run on their target machine (i.e.
apt-get install libunwind8) whenever they do a self-contained deployment to alinux-x64or child RID.Today we published and tried to run simple console app on fresh ubuntu WSL (16.04 LTS) & ubuntu azure (16.04 LTS). dotnetcore2 Tried linux-x64 & ubuntu.16.04-x64 runtime setups.
The same problem appeared. Installing libunwind8 did the job.
Is it going to be fixed at all? This way linux publish is not self contained. PERIOD. We could install full dotnet runtime this way…
could we simply make the
libunwinda part of the build in case it’s not present on the os?Or if you running on CentOs then run
sudo yum install libunwindWhen all else fails, pull the missing libraries from the microsoft docker image. You can put them in the publish directory and distribute them with your app.
Quick example from my macbook:
Creating the project:
If you run it on linux, expected result:
Pull the libraries via docker (
libunwindandlibicu) and to your publish directory:Re-test:
Success!
@WhatFreshHellIsThis @dasMulli @FDUdannychen
I was having the same problem on ubuntu 17.04, after installing libunwind8 with apt the .NET Core application was running successfully. With a self contained application this should work without the need to install anything
@henrylle @AlbertoMonteiro Have you installed the dependencies of .NET Core?
You can use the debian package to bring them in with the installation of the cli or you need to install them manually.
You can see the list of packages in this dockerfile: https://github.com/dotnet/cli/blob/rel/1.0.0/scripts/docker/ubuntu.14.04/Dockerfile#L20
On CoreOS, it’s impossible to install
libunwindbecause CoreOS doesn’t have a package manager. A workaround is creating a container (Fedora/Ubuntu/etc) and run my .net core app inside it, but it’s quite indirect. What’s the correct way to deploy self-contained app on CoreOS?Or at least it should display a message that dependency is not installed
@AlbertoMonteiro can you share the contents of the
outdirectory?You should also try running
./hwapp. @brthor suspects this is the issue here.