Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for FreeBSD #14537

Open
ghuntley opened this issue May 4, 2015 · 855 comments · Fixed by #58085
Open

Support for FreeBSD #14537

ghuntley opened this issue May 4, 2015 · 855 comments · Fixed by #58085
Labels
area-Meta enhancement Product code improvement that does NOT require public API changes/additions needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration os-freebsd FreeBSD OS
Milestone

Comments

@ghuntley
Copy link
Member

ghuntley commented May 4, 2015

Updated proposal from 2017/9

Proposal (by @karelz - https://github.com/dotnet/corefx/issues/1626#issuecomment-329840518) will be updated in top-post based on further discussion and proposal changes.

We discussed community-driven port for FreeBSD with @RussellHaley (from FreeBSD community) and @wfurt (from .NET Core team) who both expressed interest in the work.
Here's a plan proposal we put together (feedback / suggestions are welcome):

  1. Produce binaries in CoreCLR & CoreFX repo targeting FreeBSD - using hacks is fine
    • Hard to parallelize, @wfurt will work on that
    • The build can be mix of builds from other platforms (Mac, Linux) targeting FreeBSD
    • We will need documented steps (on FreeBSD wiki) to reproduce the build with FreeBSD-specific bug fixes
  2. Run & stabilize CoreCLR tests (using corerun)
    • Tests may be built on another platform
    • Goal: Provides basic quality of runtime
  3. Run & stabilize CoreFX tests (using corerun)
    • Tests may be built on another platform
    • Note this requires xunit. We believe, based on our past porting experience, once [2] is done, xunit will just work.
    • This can be in theory parallelized with [2] - it may require shortcutting xunit (e.g. generate static execution recipe on another platform)
    • We can expose new OSPlatform API for FreeBSD when the pass rate is reasonable: see dotnet/corefx#23989
  4. Full stack build on FreeBSD (using corerun as bootstrapper from [1]-[3])
    • We will need all tools (nuget, msbuild, roslyn) to work on boostrapping .NET Core
  5. Installers (FreeBSD ports)
    • First-stage: Using product binaries from nuget feeds
    • Second-stage: Build product from source (blocked on build from source effort)
    • Requires FreeBSD community expertise and guidance on design
    • Note: We can link FreeBSD packages also from official .NET Core download pages as community-support packages
  6. Regular build and test runs on FreeBSD
    • Goal: Make sure changes in .NET Core repos breaking FreeBSD are known early
    • Design needed
    • Requires FreeBSD community expertise and guidance on design

Operation principles:

  • Changes in [2]-[4] should be done primarily in CoreCLR/CoreFX repos (due to CLA signing requirements, code reviews from .NET Core team experts/members. etc.)
  • We will track high-level work on this issue. Specific bugs will be filed as separate issues.

If anyone is interested in helping, please let us know here. We can easily distribute work items from [2] & [3] above once we are far enough with [1].


Original proposal from @ghuntley from 2015/5

This issue is to discuss unit(s) of work to actually produce FreeBSD assemblies for corefx.

@stephentoub - There's what's likely a more pressing issue, which is actually building for FreeBSD. Today, when we need to specialize an assembly for a particular platform, we effectively have three builds, producing three different managed assemblies: Windows, Linux, OSX. Sounds like at least for now we'll need a fourth, FreeBSD. I suggest you start by modifying the build to support an IsFreeBSD property (or just IsBSD of you think there's a high chance that the implementations across BSDs will be the same even with varied kernels) along with the appropriate OSGroup targets. That can then be used in the csproj files as needed to specialize an assembly with FreeBSD-specific code.

Related issue(s)

/cc: @janhenke @josteink

@josteink
Copy link
Member

josteink commented May 4, 2015

There seems to be agreement as far as https://github.com/dotnet/corefx/issues/1576 is concerned.

When we also have a decision on https://github.com/dotnet/corefx/issues/1625 we should be able to start shipping some code.

@ghuntley
Copy link
Member Author

Agreement on #14536 has been reached by the portteam, unless MSFT chooses otherwise it will be FreeBSD. Issue dotnet/corefx#1999 will potentially be the issue that introduces the definition into the public API.

@josteink
Copy link
Member

Agreement on #14536 has been reached by the portteam, unless MSFT chooses otherwise it will be FreeBSD

If I read that right, this means that when dotnet/corefx#1999 is merged, we can consider this MSFT approving of the new public API, and can therefore press forward on the remaining issues with regular pull-requests without need for MSFT approval.

If so, that sounds good to me.

@ghuntley
Copy link
Member Author

Next steps as per dotnet/corefx#1999 (comment) are:

  1. The "FreeBSD port team" continues their work to get a FreeBSD version of CoreFX produced (tracked by dotnet/corefx#1626).
  2. The port team brings up enough of the CoreFX and CoreCLR stack on FreeBSD such that we can start running the CoreFX unit tests on FreeBSD.
  3. The tests reach some minimal quality level. I don't know exactly what this looks like yet, but I expect it means something like a majority of the tests pass. Ideally we would not have a bunch of specific tests disabled for only FreeBSD (compared to Linux and OSX, we wouldn't want to hold FreeBSD to a higher standard than the other *NIX platforms we have there).
  4. Working with the FreeBSD port team, the CoreFX team gets the CoreFX tests added to our CI system running on FreeBSD.
  5. Discuss merging a PR based for issue [public api] System.Runtime.Environment - OSName("FreeBSD") or OSName("BSD") #14536, which adds the property.

@josteink
Copy link
Member

That sounds like a fully reasonable plan to me.

@janhenke
Copy link
Member

Okay, then let's start the work on getting corefx to work.

@josteink
Copy link
Member

First obstacle in building corefx on FreeBSD seems to be mono. The build-script insists version 4.1 is required. @ajensenwaud did some work on this on the Frankfurt-host, but I'm not sure how complete it is.

I'll queue a build for now and see what the output looks like.

Edit: The (mono) build crashes with the following kicker at the end:

Making all in mini
make[1]: "/usr/home/josteink/mono/mono/mini/Makefile" line 2906: warning: duplicate script for target "%.exe" ignored
make[1]: "/usr/home/josteink/mono/mono/mini/Makefile" line 2899: warning: using previous script for "%.exe" defined here
  CC       genmdesc-genmdesc.o
In file included from genmdesc.c:9:0:
mini.h:17:34: fatal error: ./mono/metadata/loader.h: Too many levels of symbolic links
 #include <mono/metadata/loader.h>
                                  ^
compilation terminated.
*** Error code 1

Stop.
make[1]: stopped in /usr/home/josteink/mono/mono/mini
*** Error code 1

Stop.

@stephentoub
Copy link
Member

First obstacle in building corefx on FreeBSD seems to be mono

FWIW, I personally don't think this is the first obstacle. There are two build related issues:

  1. Building assemblies that work correctly on FreeBSD
  2. Building those assemblies on FreeBSD

(1) is critical, and is I believe what this issue is meant to be about. (2) is very nice to have, but lack of it doesn't prevent the creation of a great system for running managed code on FreeBSD.

You're of course free to prioritize however you see fit, but my recommendation would be to focus on (1) rather than (2).

Note that we still have issues building corefx on Linux and building it on OSX, such that our CI system builds the assemblies for those platforms on Windows; it then shuttles the resulting assemblies over to the target platform to execute the tests.

@josteink
Copy link
Member

That's fair enough. I just assumed that it would be easier to get general FreeBSD platform support baked into corefx if we could actually build it ourselves on FreeBSD.

I'll make do with Windows-initiated building for now and attempt to ninja together a build-configuration.

@akoeplinger
Copy link
Member

@josteink btw. corefx should now build on Mono 4.0.1.44.

@josteink
Copy link
Member

@akoeplinger Nice. That leaves me some hope we can get it running on FreeBSD too :)

@ajensenwaud
Copy link
Contributor

Good points. However if we really want corefx to be part of the FreeBSD environment, we really need it to be able to compile from source to get it into the Ports system.

I did hear that Mono 4.0.1.44 fixes a lot of these issues but have not had time to play with it yet. I know the ports team are updating the port Makefile as well as we speak with a new patch.

On 12 Jun 2015, at 20:21, Stephen Toub [email protected] wrote:

First obstacle in building corefx on FreeBSD seems to be mono

FWIW, I personally don't think this is the first obstacle. There are two build related issues:

Building assemblies that work correctly on FreeBSD
Building those assemblies on FreeBSD
(1) is critical, and is I believe what this issue is meant to be about. (2) is very nice to have, but lack of it doesn't prevent the creation of a great system for running managed code on FreeBSD.

You're of course free to prioritize however you see fit, but my recommendation would be to focus on (1) rather than (2).

Note that we barely have corefx building-on-Linux and building-on-OSX, such that our CI system builds the assemblies for those platforms on Windows; it then shuttles the resulting assemblies over to the target platform to execute the tests.


Reply to this email directly or view it on GitHub.

@stephentoub
Copy link
Member

Yes, I'm in no way disagreeing... being able to build corefx on Linux, OSX, and FreeBSD is important. I'm simply suggesting that from a priority perspective it's more important to be able to actually run corefx on Linux, OSX, and FreeBSD. 😉 If both can be worked on in parallel, all the better.

@ghost
Copy link

ghost commented Jun 13, 2015

@ghuntley,
would be super 🆒 if we have a markdown task checklist outlining what what is remaining:

- [x] task 1
- [ ] task 2
- [ ] task 3

renders as:

  • task 1
  • task 2
  • task 3

This will probably encourage others to score those feats and FreeBSD support will land rather sooner than anticipated! 😎

@janhenke
Copy link
Member

To my knowledge the following pieces of work in CoreFX are required for FreeBSD support:

13 Assemblies do not compile on their own and need FreeBSD specific changes. Mostly the Interop pieces that already exist for Linux/OS X (order by the occurrence in the build output):

I will try to update that list based on PRs opened and merged.

@josteink
Copy link
Member

FYI: PR dotnet/corefx#2039 merged

@josteink
Copy link
Member

Just trying to be ahead of the curve here... How do we plan to implement System.IO.FileSystem.Watcher ?

Iirc FreeBSD has no inotify such as Linux and Windows does (which is also why there is no Dropbox last time I checked). Will this be a potential source of trouble coming our way? Or does anyone have an idea for how to work around this?

@janhenke
Copy link
Member

I suggest we stub that out for the moment and throw a PlatformNotSupportedException as Stephen Toub suggested in the other topic (dotnet/corefx#2021 (comment)). Then we have at least a complete set of assemblies and we can continue to work on that particular issue without blocking further steps.

Would you mind opening a separate issue for that?

@ghuntley
Copy link
Member Author

Let's move System.IO.FileSystem.Watcher discussions to dotnet/corefx#2046

@ghost
Copy link

ghost commented Jun 15, 2015

Guys is there any such blocker for System.Diagnostics.Process?

@ghuntley
Copy link
Member Author

@jasonwilliams200OK added FreeBSD to S.RT.I.RI early this morning which was merged but the FreeBSD tests within CheckPlatformTests had to be backed out until dotnet/buildtools is updated.

@ghuntley
Copy link
Member Author

@jasonwilliams200OK there were some discussions last night about System.Diagnostics.Process in gitter which have been formalized into https://github.com/dotnet/corefx/issues/2070

@ghost
Copy link

ghost commented Jun 16, 2015

@ghuntley, thanks. I actually read those messages. System.Diagnostics.Process is a tricky one. AFAIK, io.js team had similar challenges with FreeBSD process management. Mono team has probably nailed it, so lets hope if @akoeplinger and co. could enlighten us on this matter? :)

@josteink
Copy link
Member

System.IO.FileSystem.DriveInfo

As discussed in the gitter, For this one I tried looking into basic usage of getmntinfo:

#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>
#include <stdio.h>

int main() {
  struct statfs *mntbuf;
  int mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);

  for( int i = 0; i < mntsize; i++ ) {
    printf("%s\n", mntbuf[i].f_mntonname);
  }
}

Running that sample yielded this output:

$ ./a.out
/
/dev
/tmp
/usr/home
/usr/ports
/usr/src
/var/crash
/var/log
/var/mail
/var/tmp
/dev/fd
/usr/compat/linux/proc
/proc
$

So it seems it does what we need. The question is, should we do any type of filtering on the results?

Looking at the "intent" of the DriveInfo object, coming from the Windows world of .NET it has often been to enumerate the available locations to store or retrieve files (C:, D:, etc). But when using Unix hierarchical file-systems, returning / would be adequate to cover those needs.

So what should we return? What would be useful? Should even consider it being useful or not?

The Linux-version just dumps everything, except things set to be ignored:

https://github.com/dotnet/corefx/blob/master/src/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Linux.cs#L98-L99

I tried putting in the following filter, but it didn't really change anything in terms of output:

    if ((mntbuf[i].f_flags != MNT_IGNORE)) {
        printf("%s\n", mntbuf[i].f_mntonname);
    }

Any opinions?

@ghost
Copy link

ghost commented Jun 21, 2015

@josteink, great diggings! Based on https://github.com/dotnet/corefx/issues/815#issuecomment-113825960 and https://github.com/dotnet/corefx/issues/1729, I think we should collaborate with @sokket to come up with a solution with works across different Unices.

@arrowd
Copy link
Contributor

arrowd commented Nov 20, 2024

I saw that you made better patch for patch-src_runtime_src_native_libs_System.IO.Compression.Native_CMakeLists.txt - plans to up-stream that or it's already done?

Not at the moment, it'd be great if you do this.

FreeBSD ports currently only contains lang/dotnet which is now net9.

.NET 8 is now in lang/dotnet8 port.

FreeBSD ports does not have a great way of handling side-by-side installations of things in a way that dotNET would like to see them.

We can as well strive for that. I guess, we need to strip lang/dotnet8 so that it installs only some parts of its current pkg-plist?

@Thefrank
Copy link
Contributor

.NET 8 is now in lang/dotnet8 port.

That is great news! I missed that when I glanced over the ports.

We can as well strive for that. I guess, we need to strip lang/dotnet8 so that it installs only some parts of its current pkg-plist?

There are likely only 3 files that will trip up pkg check -s due to them being changed or overwritten:
dotnet the actual binary
LICENSE.txt if it changed between net8 and net9
ThirdPartyNotices.txt ditto and the most likely one to change.

Everything else gets put into versioned sub-directories by default.
I am not sure how this would be handled by ports.
If someone only installs dotnet8 because it is LTS then not having the dotnet binary is an issue. What if someone installs net8 then net9? How would(should?) pkg check handle this? Do people/cron use pkg check anymore?

@arrowd
Copy link
Contributor

arrowd commented Nov 20, 2024

With GHC (a Haskell compiler) I solved it the following way:

  • The latest and greatest port is called lang/ghc and installs both ghc and ghc-X.Y.Z executables.
  • Previous versions are called lang/ghcXY and install only ghc-X.Y.Z executables.
  • This is possible, however, because Haskell tooling knows to search not only for ghc, but also ghc-X.Y.Z.

What we can do for dotnet is:

  • The latest and greatest lang/dotnet installs the dotnet executable.
  • Previous versions do not.
  • If user needs previous .NET, he'd have to install both latest and previous version.

@sec
Copy link
Contributor

sec commented Nov 20, 2024

Don't know if that's possible in ports handling, but I think the best options would be to:

  • have ability to install both dotnet and dotnet8
  • shared files from dotnet should have precedence
  • when dotnet is installed, dotnet8 shared files would be skipped
  • when dotnet8 is installed, installing dotnet would overwrite shared files

We need to have dotnet binary with only dotnet or dotnet9 present in there :)

@jkotas
Copy link
Member

jkotas commented Nov 20, 2024

shared files

https://learn.microsoft.com/en-us/dotnet/core/distribution-packaging#recommended-packages is the recommended dotnet package structure that avoids issues with overwriting shared files. Would it be feasible to follow this package structure on FreeBSD as well?

@arrowd
Copy link
Contributor

arrowd commented Nov 20, 2024

shared files from dotnet should have precedence

No, that's not possible with pkg. If two packages install the same file, they can't be coinstalled.

@greggyb
Copy link

greggyb commented Nov 20, 2024

Edit after the fact:
I didn't read first and basically described a stripped down version of what the packaging link shared above suggests. Just read that.
https://learn.microsoft.com/en-us/dotnet/core/distribution-packaging#recommended-packages
---end edit---

I am not certain on the stuff below so please fact-check me.

Microsoft publishes both a "Dotnet SDK" and a "Dotnet Runtime" (technically multiple). In their topology, the SDK includes the runtimes.

The dotnet binary is the interface to the SDK CLI.

Would it be possible to distribute a set of packages:
- Dotnet SDK: dotnet binary (built AOT compiled for FreeBSD?); always the current release of the latest version
- Dotnet Runtime Full: *Runtime6, *Runtime8, *Runtime9 (all supported versions: 3 years for LTS and 18 months for standard releases); default to include all runtimes under DotnetRuntimeX, optional to install separate runtimes:
- .NET Runtime (6, 8, 9)
- ASP.NET Runtime (6, 8, 9)
- .NET Desktop Runtime (6, 8, 9)

Basically, instead of following Microsoft and including everything when the SDK is installed, include no runtimes in the SDK package.

This would allow for installation as follows:

# pkg install dotnet-sdk # not very useful yet
# pkg install dotnet-runtime8 # now can develop and run targeting dotnet8, incl ASP.NET and Desktop runtimes
# pkg install dotnet-core-runtime9 # now can additionally develop and run console apps targeting dotnet9, but not ASP.NET or Desktop

This would prevent a scenario where the package "dotnet" is upgraded from 8->9 and causes applications built for 8 to no longer run (the situation @rwv37 was in upthread). Instead, installing "dotnet-runtime8" would ensure that the required runtime files for dotnet8-targeted applications are always present until the operator manually runs pkg remove dotnet-runtime8. When a new version of the runtime is released, then an operator can opt into the new runtime.

I am assuming, here, that the dotnet SDK CLI can be built without a dependency on a system-provided dotnet runtime.
If that is not the case, then I think the approach below could work:

  • Package "dotnet" includes no version number; includes SDK and all runtimes.
  • Packages "dotnetX" include the version number, and include everything but the files which would be conflicting (the latest, currently dotnet9 would have full overlap (less conflicting files) with the unversioned "dotnet" package)
  • dotnet-runtime... as described in the prior scheme.

This would still provide the guarantee that if someone explicitly installs dotnetX (or runtimes), that they would never lose that in the course of a pkg upgrade.

@jkotas
Copy link
Member

jkotas commented Nov 20, 2024

The dotnet binary is the interface to the SDK CLI.

dotnet binary is the interface to both the runtime and SDK. dotnet binary, runtime, ASP.NET, no SDK is very typical deployment configuration for .NET cloud apps.

@greggyb
Copy link

greggyb commented Nov 20, 2024

Thank you for the clarification there. Given that, it seems my first suggestion is no good, but I think the second path I laid out still makes sense in terms of packaging within the constraints of FreeBSD's pkg infrastructure described upthread.

Thoughts?

@jkotas
Copy link
Member

jkotas commented Nov 20, 2024

Thoughts?

It looks like a subset of the scheme described at https://learn.microsoft.com/en-us/dotnet/core/distribution-packaging#recommended-packages (with different names). Is there a good reason for inventing your own scheme for FreeBSD instead of just using the same scheme as Linux?

@nkosi23
Copy link

nkosi23 commented Nov 20, 2024

@jkotas my understanding is that the scheme you link to is actually being used by the FreeBSD port, the only problem is with the dotnet binary file, since all versions of .net install it to the same path while it is not possible to install 2 FreeBSD packages that would try to install a file to the same path.

Thus the solution proposed by @arrowd which looks like a simple and elegant way to address the issue.

Alternatively, we could also have dotnetX and dotnetX-lib ports where the lib ports do not have the executable.

@jkotas
Copy link
Member

jkotas commented Nov 20, 2024

my understanding is that the scheme you link to is actually being used by the FreeBSD port,

The Linux scheme addresses the problem with shared file by dotnet-host package that has no version number and that is always built from the latest .NET version available. How is dotnet-host package built in the FreeBSD port?

@nkosi23
Copy link

nkosi23 commented Nov 20, 2024

@jkotas Oh I didn't realize that there is the disk layout but also a recommended way to structure packages. I only meant that the disk layout is being followed by the port. However in terms of packaging, everything is included in a single package for time being from what I can see.

As for why, I have to let others answer, but I guess it's just a matter of the initial effort was focused on getting a basic port ready which was already a challenging task in itself. And if it wasn't for the issue with the dotnet exec, it wasn't necessarily clear that breaking down the port into multiple packages would bring something to the table.

I am not sure how difficult it would be to break the port into multiple packages. Maybe the port system has a feature to facilitate creating multiple packages from the same build. Otherwise the task could be time consuming.

@greggyb
Copy link

greggyb commented Nov 20, 2024

Is there a good reason for inventing your own scheme for FreeBSD instead of just using the same scheme as Linux?

Probably not. To speak only for myself and no one else, I was responding from ignorance without researching enough (or reading the link you had shared before I posted). I saw the issue described upthread about a bump to the single dotnet package for FreeBSD breaking deployed applications and the constraint about packages with conflicting files. I then went straight to brainstorming (again without referencing your link), not really thinking about the fact that this is probably solved by several Linux distributions already.

It's heartening to me, though, that I came up with an outline that matches that current best practice, at least in the broad strokes (:

@sec
Copy link
Contributor

sec commented Nov 21, 2024

So to make this simply visible, idea is to have:
dotnet-host port that will build and install dotnet, LICENSE.txt and ThirdPartyNotices.txt from dotnet9 output
dotnet8 - this will be as is, just won't include those 3 files
dotnet9 - same as 8, without those 3 files
dotnet will just point to dotnet9

pkg install dotnet8 will install dotnet-host + dotnet8
pkg install dotnet9 will install dotnet-host + dotnet9

installing only dotnet-host doesn't make sense alone, right?

@arrowd that should be doable using ports, right?

@nkosi23
Copy link

nkosi23 commented Nov 21, 2024

@sec shouldn't dotnet be a metapackage installing both the latest and greatest version (here dotnet9) and dotnet-host ? otherwise dotnet-host never actually gets installed, when running either dotnet or dotnetX

@sec
Copy link
Contributor

sec commented Nov 21, 2024

@sec shouldn't dotnet be a metapackage installing both the latest and greatest version (here dotnet9) and dotnet-host ? otherwise dotnet-host never actually gets installed, when running either dotnet or dotnetX

True, that's why I wrote pkg install dotnet9 will install dotnet-host + 9 and dotnet (port) will just point to dotnet9 - I had in mind what you asked :)

@arrowd
Copy link
Contributor

arrowd commented Nov 21, 2024

Right now each port's build produces a single package. This means that if we are to have dotnet and dotnet-host, we'd need to build the whole thing twice.

The ability to produce multiple packages from a single build is provided by a feature called subpackages, which is currently only partially implemented. I'd wait for a full subpackages support in Ports first, before implementing the decomposition you're proposing.

For now I think we should just make dotnet8 and dotnet coinstallable by removing conflicting files.

@sec
Copy link
Contributor

sec commented Nov 21, 2024

Fair, so how would you see having those 3 files coinstallable? We can't remove them from dotnet8 port and install only with dotnet9, as not having dotnet binary will make it useless.

@greggyb
Copy link

greggyb commented Nov 21, 2024

In an attempt to summarize and provide some decision-points:

It seems like we agree in this thread that there is a correct long-term solution, summarized in @sec's #14537 (comment)

With today's pkg infrastructure, this is achievable by building the latest release (currently dotnet9) twice: once to provide the dotnet executable in package dotnet-host and once to provide all the rest (runtime, etc...) in dotnet9 package. Older versions, e.g. dotnet8 would be built once and not include the dotnet executable. This is undesirable due to building dotnet9 twice.

There is a future feature in pkg, subpackages, that should support the decomposition into versioned dotnetXs and an unversioned dotnet-host. It may be valid to defer dotnet-host as a package until subpackages are available.

Thus we are left with a decision between several candidates for a sub-optimal short-term approaches:

A. Adopt the long-term package topology today at extra cost: Build dotnet9 twice: extra cost for build time and burden on package build infra.
B. Adopt a short-term package topology that does not include dotnet-host, but does support multiple different versions of dotnetX installed alongside one another.
C. Adopt a short-term package topology that does not include dotnet-host and does not support multiple parallel installations of dotnetX, i.e., dotnet8 and dotnet9 are mutually exclusive of one another; each provides dotnet and other conflicting files.

I think this covers the short-term approaches discussed, modulo some naming conventions.

Some important questions that arise here:

  1. Just how bad is option (A) above?
    If it's not that much of a burden, I'd argue that it is best to implement the long-term topology today so we don't have a breaking change in the future.
  2. How close are subpackages?
  3. Can we confirm that subpackages do, in fact, enable the topology described above as the long-term solution?
  4. If (B), how to implement that?
    I'd propose that we build the latest to include the dotnet executable and other conflicting files; then older versions have a dependency on the newer one. I am sure that there are other reasonable implementations, though.
  5. Is C acceptable?
    For me, personally, yes, and jails can probably cover any use cases I'd have for both.

@Thefrank
Copy link
Contributor

I think dotnet-host is just from /src/native/corehost which does not require dotNET to build.

(assuming I am correct) in runtime src/native/corehost/build.sh -ci should be enough and just needs just CMake and Clang/GCC.

@sec
Copy link
Contributor

sec commented Nov 21, 2024

I think dotnet-host is just from /src/native/corehost which does not require dotNET to build.

(assuming I am correct) in runtime src/native/corehost/build.sh -ci should be enough and just needs just CMake and Clang/GCC.

exactly, building just dotnet binary can be done directly from runtime repo and it should be quite fast. Dunno about 2 other txt files, maybe those could be just extracted from somewhere or fetched and included in port. then we`ll just need to exclude those 3 files from both dotnet8 and dotnet(9) and add dep on dotnet-host.

@arrowd
Copy link
Contributor

arrowd commented Nov 21, 2024

We can't remove them from dotnet8 port and install only with dotnet9, as not having dotnet binary will make it useless.

Why useless? dotnet8 would serve as an addon to dotnet that enables version 8 SDK. This is basically the plan B:

B. Adopt a short-term package topology that does not include dotnet-host, but does support multiple different versions of dotnetX installed alongside one another.

I'd go for it as it looks optimal in time/gains terms. However,

building just dotnet binary can be done directly from runtime repo and it should be quite fast.

also sounds good, but does upstream expect it to be built and packaged this way? I know nothing of .NET ecosystem and was thinking that the only supported way to build all this stuff is VMR.

@Thefrank
Copy link
Contributor

Thefrank commented Nov 21, 2024

only supported way to build all this stuff is VMR

VMR is the only way to offline/sourcebuild. This is the only way for ports to build dotNET without a great deal of extra work.

Online builds can be done via each repo and pulled together at the SDK for a binary package. This a good way to get a bootstrap binary if none is available. This still requires some amount of juggling outputs into inputs but at this point is rather painless.

Very few things build without a working dotNET SDK; the host is one of them. Some other items in coreclr are another.

edit: src/native/corehost/build.sh -ci builds in ~1min on a single core on my machine.

@arrowd
Copy link
Contributor

arrowd commented Nov 21, 2024

I think we should stop using this issue as a chat. How about migrating into Matrix or Discord? I can try arranging a room on the FreeBSD Matrix Dev server.

@sec
Copy link
Contributor

sec commented Nov 21, 2024

I think we should stop using this issue as a chat. How about migrating into Matrix or Discord? I can try arranging a room on the FreeBSD Matrix Dev server.

Makes sense :) Fine with Discord or Libera also.

@arrowd
Copy link
Contributor

arrowd commented Nov 21, 2024

Please join https://matrix.to/#/!RzOryqYAIqxaAmbYDE:matrix-dev.freebsd.org?via=matrix-dev.freebsd.org
or by room ID !RzOryqYAIqxaAmbYDE:matrix-dev.freebsd.org

@sec
Copy link
Contributor

sec commented Nov 22, 2024

Does anyone know, if it's possible to include extra nupkg's that get bundled with vmr build under library-packs output directory? Could be nice to include those with SDK itself, so no extra steps would be needed? I know it can be one in 1 line after port builds - just wondering if there's something already done?

@Thefrank
Copy link
Contributor

@sec The VMR should already bundle runtime packs and ILC into the SDK. This leaves just the Crossgen2 NuGet. AFAIK there is no way to bundle it automatically.

@sec
Copy link
Contributor

sec commented Nov 23, 2024

@arrowd @Thefrank I've made dotnet-host port and made changes for 8/9. I've tried install/build with dotnet. dotnet8 running in the background - I assume it will fail to install side-by-side, as there are some more packs in both releases.

I've did quick add, to include all freebsd nupkg into library-packs (even some of those are already in there) - we could handpick Crossgen2 for example, but maybe having them all, won't hurt?

edit: here's the link :P sec/freebsd-ports@785055f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Meta enhancement Product code improvement that does NOT require public API changes/additions needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration os-freebsd FreeBSD OS
Projects
No open projects
Status: Untriaged
Development

Successfully merging a pull request may close this issue.