.net Core console app on Ubuntu 20.10 on raspberry pi 4 give No such file or directory when trying to execute the program

Viewed 798

I've published my Hello World console app to my raspberry PI 4 running Ubuntu 20.10 using the publish function in VS2019 and copied it to my PI using scp.

When I try to start the program (i've chmod it to executable) I get error:

bash: ./AppName: No such file or directory

The steps to create my app:

  • I've create a Hello World C# .NET Core console application in Visual Studio 2019 community edition
  • I published it (right click on project name in the solution explorer)
    • Target: folder
    • Specific target: folder
  • Profile settings
    • Configuration: Debug | Any CPU
    • target framework: netcoreapp3.1
    • Deployment mode: Self-contained
    • Target runtime: Linux-arm
    • Produce single file: checked
  • copied the files in the publish folder using scp * username@10.10.2.22:/home/username/Downloads/core
  • chmod 777 AppName
  • ./AppName

I get the error:

bash: ./AppName: No such file or directory

I must be overlooking something simple, but I cannot find it.

How to run my Hello World C# .NET Core console app on my Raspberry PI4 running on Ubuntu 20.10?

1 Answers

This ancient question has no answer, but just in case you're getting here from a search engine, the answer is here.

How to identify the problem?

file cross_compiled_executable

Contains something like:

interpreter /lib/ld-uClibc.so.0

and the problem is that that file does not exist on the target.

This means that you probably built it for the wrong architecture (32 vs 64 bit)

I changed linux-arm to linux-arm64

dotnet build -c Release -r linux-arm

to

dotnet build -c Release -r linux-arm64

and everything is working again.

Related