dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.
http://dot.net
MIT License
2.91k stars 510 forks source link

Ubuntu 20.04 dotnet publish failed #8363

Closed ryancheung closed 3 years ago

ryancheung commented 3 years ago

Command: dotnet publish -r linux-x64 -c Release CoreRT publish failed in ubuntu 20.04 with the following build error:


/usr/bin/clang Generating compatible native code. To optimize for size or speed, visit https://aka.ms/OptimizeCoreRT /usr/bin/ld: cannot find -lgssapi_krb5 clang : error : linker command failed with exit code 1 (use -v to see invocation) [/home/ryan/XXX/XXX_Client/Client.DesktopGL/Client.DesktopGL.csproj] /home/ryan/.nuget/packages/microsoft.dotnet.ilcompiler/1.0.0-alpha-29228-02/build/Microsoft.NETCore.Native.targets(327,5): error MSB3073: The command "clang "obj/Release/netcoreapp3.1/linux-x64/native/Client.DesktopGL.o" -o "bin/Release/netcoreapp3.1/linux-x64/native/Client.DesktopGL" /home/ryan/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/1.0.0-alpha-29228-02/sdk/libbootstrapper.a /home/ryan/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/1.0.0-alpha-29228-02/sdk/libRuntime.a /home/ryan/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/1.0.0-alpha-29228-02/sdk/libSystem.Private.CoreLib.Native.a /home/ryan/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/1.0.0-alpha-29228-02/sdk/libSystem.Private.TypeLoader.Native.a /home/ryan/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/1.0.0-alpha-29228-02/framework/libSystem.Native.a /home/ryan/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/1.0.0-alpha-29228-02/framework/libSystem.Globalization.Native.a /home/ryan/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/1.0.0-alpha-29228-02/framework/libSystem.IO.Compression.Native.a /home/ryan/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/1.0.0-alpha-29228-02/framework/libSystem.Net.Security.Native.a /home/ryan/.nuget/packages/runtime.linux-x64.microsoft.dotnet.ilcompiler/1.0.0-alpha-29228-02/framework/libSystem.Security.Cryptography.Native.OpenSsl.a -g -Wl,-rpath,'$ORIGIN' -Wl,--as-needed -pthread -lstdc++ -ldl -lm -lz -lgssapi_krb5 -lrt -Wl,--discard-all -Wl,--gc-sections" exited with code 1. [/home/ryan/XXX/XXX_Client/Client.DesktopGL/Client.DesktopGL.csproj]


Temporary workaround I found:

  1. cd /usr/lib/x86_64-linux-gnu
  2. sudo ln -s libgssapi_krb5.so.2.2 libgssapi_krb5.so
jkotas commented 3 years ago

Could you please check that you have libkrb5-dev dependency installed?https://github.com/dotnet/corert/blob/master/samples/prerequisites.md#ubuntu-1604

ryancheung commented 3 years ago

I'm sorry that I missed the prerequisites.md document. Install libkrb5-dev and it is working. I think it's would be obvious to put a link to prerequisites.md in repo README.md. Thanks for reply!