Page MenuHomeFreeBSD

lang/linux-dotnet-(runtime|sdk): add linux implementation of .NET Core
AbandonedPublic

Authored by dbn on Jan 11 2018, 6:33 PM.
Referenced Files
Unknown Object (File)
Sun, Mar 31, 1:10 PM
Unknown Object (File)
Feb 17 2024, 1:35 AM
Unknown Object (File)
Feb 17 2024, 1:35 AM
Unknown Object (File)
Feb 17 2024, 1:35 AM
Unknown Object (File)
Feb 17 2024, 1:35 AM
Unknown Object (File)
Feb 17 2024, 1:35 AM
Unknown Object (File)
Feb 17 2024, 1:23 AM
Unknown Object (File)
Jan 10 2024, 1:49 AM
Subscribers

Details

Summary

TODO:

  • Depend on ca_root_nss (and link for linux)

Commit message

lang/linux-dotnet-(runtime|sdk): add linux implementation of .NET Core

.NET Core is a free and open-source managed software framework. It consists of
CoreCLR, a complete runtime implementation of CLR, the virtual machine that
manages the execution of .NET programs. CoreCLR comes with an improved
just-in-time compiler, called RyuJIT. .NET Core also includes CoreFX, which is
a partial fork of FCL. While .NET Core shares a subset of .NET Framework APIs,
it comes with its own API that is not part of .NET Framework. Further,
.NET Core contains CoreRT, the .NET Native runtime optimized to be integrated
into AOT compiled native binaries. A variant of the .NET Core library is used
for UWP. .NET Core's command-line interface offers an execution entry point
for operating systems and provides developer services like compilation and
package management.

.NET Core supports four cross-platform scenarios: ASP.NET Core web apps,
command-line apps, libraries, and Universal Windows Platform apps. It does not
implement Windows Forms or WPF which render the standard GUI for desktop
software on Windows. .NET Core is also modular, meaning that instead of
assemblies, developers work with NuGet packages. Unlike .NET Framework, which
is serviced using Windows Update, .NET Core relies on its package manager to
receive updates.
Test Plan

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dbn added a reviewer: russ.haley_gmail.com.
dbn added a project: Linux Emulation.
dbn edited the summary of this revision. (Show Details)
dbn added a reviewer: mono.

Update patch based on committed dependencies.

Hi David, I'm trying to create a test application from instructions here: https://medium.com/wolox-driving-innovation/how-to-create-your-first-net-e2223dedb74f

I ran into an issue with libunwind:

Welcome to fish, the friendly interactive shell
russellh@g1 ~> cd dnc-test/
russellh@g1 ~/dnc-test> dotnet new console
Failed to load ��e, error: libunwind.so.8: cannot open shared object file: No such file or directory
Failed to bind to CoreCLR at '/usr/local/dotnet/shared/Microsoft.NETCore.App/2.0.4/libcoreclr.so'
russellh@g1 ~/dnc-test> uname -a
FreeBSD g1.highfell.home 11.1-RELEASE-p4 FreeBSD 11.1-RELEASE-p4 #0: Tue Nov 14 06:12:40 UTC 2017 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64

The coreclr is the runtime engine. I had seen you imported libunwind just prior to this patch: https://reviews.freebsd.org/D13869

The libunwind files are on my filesystem:

russellh@g1 /u/l/lib> pwd
/usr/local/lib
russellh@g1 /u/l/lib> ll libunwind.so*
lrwxr-xr-x 1 root wheel 18B Jul 26 2017 libunwind.so -> libunwind.so.8.0.1
lrwxr-xr-x 1 root wheel 18B Jul 26 2017 libunwind.so.8 -> libunwind.so.8.0.1
-rwxr-xr-x 1 root wheel 43K Jul 26 2017 libunwind.so.8.0.1

Thanks,
Russ

russellh@g1 /u/l/lib> pwd
/usr/local/lib
russellh@g1 /u/l/lib> ll libunwind.so*
lrwxr-xr-x 1 root wheel 18B Jul 26 2017 libunwind.so -> libunwind.so.8.0.1
lrwxr-xr-x 1 root wheel 18B Jul 26 2017 libunwind.so.8 -> libunwind.so.8.0.1
-rwxr-xr-x 1 root wheel 43K Jul 26 2017 libunwind.so.8.0.1

I think your Ports directory was out-of-date. There is a bug with USES=linux in that it ignores missing Linux packages (i.e. if your Ports tree was out-of-date). See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225768 for the patch to check for this case.

Also, note that this is a Linux port, and you need the Linux version of libunwind:

# cd /compat/linux/usr/lib
# ls -l libunwind.so*
lrwxr-xr-x  1 root  wheel     18 Aug  2  2017 libunwind.so.8 -> libunwind.so.8.0.1
-rwxr-xr-x  1 root  wheel  43764 Aug  2  2017 libunwind.so.8.0.1

You can manually install it with pkg install linux-c7-libunwind, however you are likely missing other Linux packages.

I hope this helps?

In D13870#299128, @dbn wrote:

russellh@g1 /u/l/lib> pwd
/usr/local/lib
russellh@g1 /u/l/lib> ll libunwind.so*
lrwxr-xr-x 1 root wheel 18B Jul 26 2017 libunwind.so -> libunwind.so.8.0.1
lrwxr-xr-x 1 root wheel 18B Jul 26 2017 libunwind.so.8 -> libunwind.so.8.0.1
-rwxr-xr-x 1 root wheel 43K Jul 26 2017 libunwind.so.8.0.1

I think your Ports directory was out-of-date. There is a bug with USES=linux in that it ignores missing Linux packages (i.e. if your Ports tree was out-of-date). See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225768 for the patch to check for this case.

Also, note that this is a Linux port, and you need the Linux version of libunwind:

# cd /compat/linux/usr/lib
# ls -l libunwind.so*
lrwxr-xr-x  1 root  wheel     18 Aug  2  2017 libunwind.so.8 -> libunwind.so.8.0.1
-rwxr-xr-x  1 root  wheel  43764 Aug  2  2017 libunwind.so.8.0.1

You can manually install it with pkg install linux-c7-libunwind, however you are likely missing other Linux packages.

I hope this helps?

Great, I'll drill in. Thanks for the patch.

Hi David,

Adding libunwind got me past my last error. I tried running

dotnet new console

to create a new console application and recieved an error about missing globalization:

russellh@g1 ~> dotnet new console
FailFast: Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.

at System.Environment.FailFast(System.String)
at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode()
at System.Globalization.GlobalizationMode..cctor()
at System.Globalization.CultureData.CreateCultureWithInvariantData()
at System.Globalization.CultureData.get_Invariant()
at System.Globalization.CultureData.GetCultureData(System.String, Boolean)
at System.Globalization.CultureInfo.InitializeFromName(System.String, Boolean)
at System.Globalization.CultureInfo.Init()
at System.Globalization.CultureInfo..cctor()
at System.StringComparer..cctor()
at System.AppDomainSetup.SetCompatibilitySwitches(System.Collections.Generic.IEnumerable`1<System.String>)
at System.AppDomain.PrepareDataForSetup(System.String, System.AppDomainSetup, System.Security.Policy.Evidence, System.Security.Policy.Evidence, IntPtr, System.String, System.String[], System.String[])

There is mention of the issue on the dotnet github site here: https://github.com/dotnet/core/blob/master/Documentation/build-and-install-rhel6-prerequisites.md

"The ICU libraries can be downloaded in a precompiled binary form from the ICU site, the URL is http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-RHEL6-x64.tgz."

Are you able to add that library to the port patch? There is a manual work around I will try first. I'm not really comfortable trying to import a Linux binary.

dbn edited the test plan for this revision. (Show Details)

Update to latest versions of dotnet, fix SDK for v1.1 (no SDK for v1.0).

@russ.haley_gmail.com: which version of CentOS are you using? I've made the ports CentOS 7 only and the icu there works.

dbn edited the test plan for this revision. (Show Details)

Downgrade dotnet from 2.1 to 2.0. Dotnet 2.1 uses Linux's /proc/$PID/maps output for various purposes, however FreeBSD has a but whereby output is truncated at 128KiB. This breaks the parsing of the output.

I also don't understand why dotnet has so many entries in the mapping table.

I believe this patch is ready to be committed.

lang/linux-dotnet-cli/Makefile
7–8 ↗(On Diff #43961)

Those two lines are out of order, see Chapter 15. Order of Variables in Port Makefiles.

18 ↗(On Diff #43961)
lang/linux-dotnet-sdk/Makefile
20

We have lzma in the base system, it does not work correctly?

dbn marked 3 inline comments as done.Jun 30 2018, 7:33 AM
dbn added inline comments.
lang/linux-dotnet-cli/Makefile
18 ↗(On Diff #43961)

Hmm, I learn a new thing every day. I found it easier to use relative paths, but RLN is more robust.

lang/linux-dotnet-sdk/Makefile
20

Surprisingly, no base lzma does not work:

lzma -d work/linux-dotnet-sdk-2.1.201/sdk/2.1.201/nuGetPackagesArchive.lzma 
lzma: work/linux-dotnet-sdk-2.1.201/sdk/2.1.201/nuGetPackagesArchive.lzma: File format not recognized
dbn marked 2 inline comments as done.Jun 30 2018, 8:19 PM

Committed in r473600