dotnet / core

.NET news, announcements, release notes, and more!
https://dot.net
MIT License
20.92k stars 4.9k forks source link

targets(59, 5): error MSB6004 in Ubuntu emulator in termux #5326

Open chenyulue opened 4 years ago

chenyulue commented 4 years ago

I installed Ubuntu 20.04 LTS in termux, and manually installed dotnet according to the instructions.

When I ran dotnet, everything was OK. However, when I created a console app with dotnet new console -o myApp and ran it with dotnet run, an error happened:

/root/dotnet/sdk/3.1.100/Roslyn/Microsoft.CSharp.Core.targets(59, 5): error MSB6004: The specified task executable location "/data/data/com.termux/files/home/ubuntu-fs/root/dotnet/dotnet" is invalid. [/root/cs/myApp/myApp.csproj]

Why this happens?

mairaw commented 3 years ago

@dagood can you help here?

dagood commented 3 years ago

Maybe @rainersigwald can help?

Something that stands out is the old link here:

the instructions(https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.1.100-preview3-linux-arm64-binaries).

3.1.100-preview3 is pretty old, it might be worth trying 3.1.402 or 3.1.108 from https://dotnet.microsoft.com/download/dotnet-core/3.1.

chenyulue commented 3 years ago

Maybe @rainersigwald can help?

Something that stands out is the old link here:

the instructions(https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.1.100-preview3-linux-arm64-binaries).

3.1.100-preview3 is pretty old, it might be worth trying 3.1.402 or 3.1.108 from https://dotnet.microsoft.com/download/dotnet-core/3.1.

I have tried the 3.1.402, and the same problem still happens.

rainersigwald commented 3 years ago

This error is originating from the Csc task, so I think this should be moved to dotnet/roslyn.

@chenyulue can you build and share a binary log (⚠ note warnings that the log contains a bunch of information that you may not want to share) of this build? That may reveal some useful information.

chenyulue commented 3 years ago

@rainersigwald You can download the binary log here.

sri-vathsa commented 3 years ago

I am facing the same issue. How do I fix this?

wfurt commented 3 years ago

What is your exact error @sri-vathsa? Do you have any special characters or symbolic links in the path? what dotnet --info gives you?

sri-vathsa commented 3 years ago

I am trying the hello world program here. I get the following error on dotnet run

/home/gitpod/dotnet/sdk/5.0.205/Roslyn/Microsoft.CSharp.Core.targets(71,5): error MSB6004: The specified task executable location "/run/containerd/io.containerd.runtime.v2.task/k8s.io/8d43b12c1594dc0c1d088799c455ea33f1a0ea3eb8a5b641c0b8326fc5656516/rootfs/home/gitpod/dotnet/dotnet" is invalid. [/workspace/react-js-sample/myApp/myApp.csproj]

The build failed. Fix the build errors and run again.

Just for reference: logs on dotnet new console -o myApp

Welcome to .NET 5.0!
---------------------
SDK Version: 5.0.205

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Getting ready...
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on myApp/myApp.csproj...
  Determining projects to restore...
  Restored /workspace/react-js-sample/myApp/myApp.csproj (in 89 ms).
Restore succeeded.

and I installed dotnet using the following command

 mkdir -p /home/gitpod/dotnet && curl -fsSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel Current --install-dir /home/gitpod/dotnet

Output of uname -srv

Linux 5.4.117-58.216.amzn2.aarch64 #1 SMP Tue May 11 20:50:12 UTC 2021
wfurt commented 3 years ago

can you do cd myApp and dotnet build? I assume the /home/gitpod/dotnet is only one dotnet you have, right?

sri-vathsa commented 3 years ago

Yes, I only have one dotnet installation.

On doing cd myApp and dotnet build I am getting a similar error

Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
/home/gitpod/dotnet/sdk/5.0.205/Roslyn/Microsoft.CSharp.Core.targets(71,5): error MSB6004: The specified task executable location "/run/containerd/io.containerd.runtime.v2.task/k8s.io/8d43b12c1594dc0c1d088799c455ea33f1a0ea3eb8a5b641c0b8326fc5656516/rootfs/home/gitpod/dotnet/dotnet" is invalid. [/workspace/react-js-sample/myApp/myApp.csproj]

Build FAILED.

/home/gitpod/dotnet/sdk/5.0.205/Roslyn/Microsoft.CSharp.Core.targets(71,5): error MSB6004: The specified task executable location "/run/containerd/io.containerd.runtime.v2.task/k8s.io/8d43b12c1594dc0c1d088799c455ea33f1a0ea3eb8a5b641c0b8326fc5656516/rootfs/home/gitpod/dotnet/dotnet" is invalid. [/workspace/react-js-sample/myApp/myApp.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.11
wfurt commented 3 years ago

one more thing: try to set

DOTNET_ROOT=/home/gitpod/dotnet
DOTNET_MULTILEVEL_LOOKUP=0
sri-vathsa commented 3 years ago

The DOTNET_ROOT is already set. I set the DOTNET_MULTILEVEL_LOOKUP as suggested but I am getting the same error.

wfurt commented 3 years ago

what is it set to? Can you check?

sri-vathsa commented 3 years ago

DOTNET_ROOT is set to /home/gitpod/dotnet

wfurt commented 3 years ago

I'm wondering @rainersigwald if process name for 'dotnet' gives wrong answer. But the DOTNET_ROOT should fix that, right?

can you please try to run mount on your system @sri-vathsa ?

sri-vathsa commented 3 years ago

What should I mount and at which location?

Btw I am running these commands inside a pod in a Kubernetes cluster(eks)

wfurt commented 3 years ago

running mount without parameters will show existing volumes/mount points.

sri-vathsa commented 3 years ago

@wfurt Here's the output of mount

/.workspace/mark on / type shiftfs (rw,relatime)
sysfs on /sys type sysfs (ro,nosuid,nodev,noexec,relatime)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (ro,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/perf_event type cgroup (ro,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/memory type cgroup (ro,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (ro,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (ro,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (ro,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/blkio type cgroup (ro,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/pids type cgroup (ro,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/devices type cgroup (ro,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (ro,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/cpuset type cgroup (ro,nosuid,nodev,noexec,relatime,cpuset)
tmpfs on /sys/firmware type tmpfs (ro,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,size=65536k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=65536k)
/dev/nvme0n1p1 on /dev/termination-log type xfs (rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
devtmpfs on /dev/net/tun type devtmpfs (rw,nosuid,size=64486220k,nr_inodes=16121555,mode=755)
/dev/nvme0n1p1 on /workspace type xfs (rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
/dev/nvme0n1p1 on /etc/hosts type xfs (rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
/dev/nvme0n1p1 on /etc/hostname type xfs (rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
/dev/nvme0n1p1 on /etc/resolv.conf type xfs (rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota)
tmpfs on /tmp type tmpfs (rw,relatime,uid=33333,gid=33333)
proc on /proc type proc (rw,relatime)
tmpfs on /proc/acpi type tmpfs (ro,relatime)
tmpfs on /proc/kcore type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/keys type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/timer_list type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/sched_debug type tmpfs (rw,nosuid,size=65536k,mode=755)
tmpfs on /proc/scsi type tmpfs (ro,relatime)
proc on /proc/bus type proc (ro,relatime)
proc on /proc/fs type proc (ro,relatime)
proc on /proc/irq type proc (ro,relatime)
proc on /proc/sys type proc (ro,relatime)
proc on /proc/sysrq-trigger type proc (ro,relatime)
wfurt commented 3 years ago

can you copy dotnet binary to /tmp, keep DOTNET_ROOT as is and call /tmp/dotnet build?

omajid commented 3 years ago

Btw I am running these commands inside a pod in a Kubernetes cluster(eks)

I would like to see what cat /proc/self/mountinfo and cat /proc/self/cgroup say inside this pod. We use that to compute the relative path which is what looks wrong here.

paul-cheung commented 2 years ago

can you copy dotnet binary to /tmp, keep DOTNET_ROOT as is and call /tmp/dotnet build?

I tried it, but not worked