.NET Core: error: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory

I recently moved from Visual Studio (Windows) to Visual Studio Code (Ubuntu Linux), and due to patchy beta .NET 5 support, I re-targeted from .NET 5 to .NET Standard 2.0 library projects (as I should have in the first place), and .NET 5 to .NET Core 3.1 on my executable projects. The transition seemed to go smoothly…

…but when I run the executable, I get this error:

Failed to load �߻, error: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory
The library libhostfxr.so was found, but loading it from /home/.../dotnet/host/fxr/5.0.0-preview.3.20214.6/libhostfxr.so failed
  - Installing .NET Core prerequisites might help resolve this problem.
     https://go.microsoft.com/fwlink/?linkid=2063370

Output of ldd:

linux-vdso.so.1 (0x00007ffd03dfd000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fca18105000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fca180ea000)
        libc.musl-x86_64.so.1 => not found
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fca17f9b000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fca17da9000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fca1834f000)

Also, I am running on Ubuntu 20.04. However, I followed the SDK installation instructions for 18.04, as (at the time) there was no instructions for 20.04.

Answer

It was an installation misconfiguration problem.

To prevent an issue like this from arising again:

  • Do not install the Snap version.
  • Do not have conflicting binaries in your system. This confused my system a bit because I had installed from the package manager and also had an unzipped/configured binary in my home directory.

Leave a Reply

Your email address will not be published. Required fields are marked *