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

.NET Source-build instructions #2602

Closed
lbussell opened this issue Nov 3, 2021 · 25 comments · Fixed by #2919
Closed

.NET Source-build instructions #2602

lbussell opened this issue Nov 3, 2021 · 25 comments · Fixed by #2919
Assignees
Labels
area-doc Documentation improvements
Milestone

Comments

@lbussell
Copy link
Contributor

lbussell commented Nov 3, 2021

There should be easily accessible instructions for building .NET 6.0 from source in the dotnet/installer readme.

The instructions should address everything you need to build .NET from source, including dependencies. Ideally, this would be something we can point Linux distros and package maintainers to for instructions on how to build .NET for their distro.

@lbussell lbussell added this to the 6.0 milestone Nov 3, 2021
@lbussell lbussell self-assigned this Nov 3, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added area-product-experience Improvements in the end-user's product experience untriaged labels Nov 3, 2021
@lbussell lbussell added area-doc Documentation improvements and removed area-product-experience Improvements in the end-user's product experience labels Nov 3, 2021
@omajid
Copy link
Member

omajid commented Nov 3, 2021

Hey, @alucryd @loqs @cerebrate @directhex , what documentation would you find helpful?

From my point of view, as a maintain for .NET in Fedora, a doc that covers the following would be useful to have:

  • Where can I find the latest releases?
  • Where can I find the source code for latest releases?
  • How do I build those releases? What dependencies are required?
  • Can I bootstrap .NET (so it doesn't download anything at build time but only uses things I have already on disk)? If so, how?
  • What architectures can I build .NET on? How do I do that for anything non-x64?
  • What are the suggested packages names and their contents? What should the dependencies between packages look like? (Distros are free to deviate, but source-build can make suggestions).

@alucryd
Copy link

alucryd commented Nov 5, 2021

@omajid That's pretty much what I would ask for, thanks for making this list. Speaking from past experience, compatibility with nspawn and capability needs (if any) would be nice to have as well, this was troublesome in the 2.x era. And the dependency version information as well, minimum and/or maximum version, like how the current dotnet releases don't work with lttng-ust >= 2.13.0.

@sec
Copy link

sec commented Nov 5, 2021

Also what about OS'es that are not supported atm? Like for example, FreeBSD, we're able to crosscompile working SDK, then native build SDK using that as bootstrap - would it be possible to use the same path using source-build? I've tried that, but at some stage it was missing runtime's nupkg specific for FreeBSD - any info how to also include those into tarball for offline build would be nice for ex. :)

@alucryd
Copy link

alucryd commented Nov 12, 2021

FYI, I tried building 6.0 using the instructions on the installer repository, and it fails during the runtime compilation, the errors seem to stem from error MSB4018: System.MissingMethodException: Method not found: 'Int32 Microsoft.CodeAnalysis.ISymbol.get_MetadataToken()'.

@omajid I see you ran into this before, I'll try disabling package validation like you did.

@alucryd
Copy link

alucryd commented Nov 12, 2021

Disabling package validation allowed it to progress further, but it still crashed after an hour and a half of compilation... Segfault while building aspnetcore. @omajid can you get past aspnetcore on fedora?

@omajid
Copy link
Member

omajid commented Nov 12, 2021

On Fedora 34, the build works end to end. On 35, my builds are hanging (not crashing, just hanging) while trying to build aspnetcore. The actual hang appears to be in the crossgen process.

@alucryd
Copy link

alucryd commented Nov 12, 2021

Got it. What versions of lttng-ust do you have on 34 vs 35? Wondering if that's the culprit, I'll try to create a lttng-ust2.12 compat package here.

Edit: Nevermind, looked it up on repology. Looks like even using 2.12.2 might not cut it, I'll start with 2.12.0.

@omajid
Copy link
Member

omajid commented Nov 12, 2021

Fedora 34 is lttng-ust-2.12.0-4.fc34.x86_64. Fedora 35 is lttng-ust-2.12.2-5.fc35.x86_64.

If it's really lttng, perhaps a export COMPlus_LTTng=0 will workaround the issue? It disables loading lttng at runtime.

@alucryd
Copy link

alucryd commented Nov 12, 2021

Ah that could be a solution indeed, I'll give it a try later. For now I built 2.12.0 and the dotnet build is almost 2 hours in, way past aspnetcore so fingers crossed.

Hopefully COMPlus_LTTng does allow it to build with/against regular lttng-ust here, and when bootstrapping 6.0 with our own dotnet is a thing, I'll be able to get rid of the compat lttng-ust.

@asbjornu
Copy link
Member

I was expecting to find a 6.0.0 tag in this repository which the Homebrew dotnet formula could be updated to point to. But the 6.0.0 tag is nowhere to be found, so now I'm wondering what's required to build .NET 6 on macOS and Linux so the Homebrew formula can be upgraded?

@omajid

This comment has been minimized.

@MichaelSimons
Copy link
Member

asbjornu - Starting in 6.0, source-build is going to be produced from dotnet/installer. You can use the 6.0.101 tag to build .NET 6 from. You can refer to the building instructions.

@asbjornu
Copy link
Member

Does this mean I have to repeat the multi-week effort that went into Homebrew/homebrew-core#60929? What are the big differences between building the source-build and installer repositories?

@crummel
Copy link
Contributor

crummel commented Nov 12, 2021

The major difference is that the two-stage build is no longer required. Instead of build-source-tarball.sh in source-build doing a complete build and then generating the tarball to do the real build from, you can do ./build.sh /p:ArcadeBuildTarball=true from installer to do a short build that produces the buildable tarball. From there the process works the same way. Moving into installer also helps us get updates as the same time as the Microsoft builds do, so we can turn those around faster as well.

@omajid
Copy link
Member

omajid commented Nov 12, 2021

@asbjornu

What are the big differences between building the source-build and installer repositories?

For .NET Core 3.1 and .NET 5, you need to use the appropriate branch of the source-build repo to build .NET from source. For .NET 6, you need to use installer repo to build from source.

Perhaps it helps if you just treat it as if the build system moved from source-build to installer for .NET 6.0?

@crummel 's reply goes into detail on why we made the changes and what the details of the change are, but if you are looking to consume .NET 6, the short version is that you need to use the installer repo; the source-build repo simply doesn't build .NET anymore.

@omajid
Copy link
Member

omajid commented Nov 12, 2021

@alucryd export COMPlus_LTTng=0 did not fix my issues :(

@alucryd
Copy link

alucryd commented Nov 12, 2021

@alucryd export COMPlus_LTTng=0 did not fix my issues :(

Meh, that's too bad. Do you have a way to force lttng-ust to 2.12.0 on 35?

The build succeeded with 2.12.0 here, I'll give 2.12.2 a try later then so we can confirm whether it's the culprit.

@alucryd
Copy link

alucryd commented Nov 14, 2021

@omajid Oh well, our clang was updated to 13 yesterday, which caused a lot of build errors in the runtime. Unlike what the readme seems to indicate, EXTRA_CFLAGS are not respected at all and I had to patch quite a few CMake files to add the various -Wno- flags.
Now I'm faced with the same error as you, it hangs on aspnetcore, and I'm pretty sure the only difference compared to the day before yesterday is the clang update. I see you have a clang12 package in fedora 35, did you try building with that one?

Edit: Going back to clang 12 gets past the aspnetcore hang indeed.

@omajid
Copy link
Member

omajid commented Nov 15, 2021

Thanks for the pointers, @alucryd !

dotnet/runtime#61442 should fix the -Werror issues. It was a release oversight, I think.

Thanks for the tip on clang 12 vs 13. Looking at Fedora 35, we have a compatiblity package for clang 12 - there are libraries, but not the actual compiler itself. I am going to build llvm/clang 12 from source and see if that works.

@DmitryJustDmitry
Copy link

asbjornu - Starting in 6.0, source-build is going to be produced from dotnet/installer. You can use the 6.0.101 tag to build .NET 6 from. You can refer to the building instructions.

Excuse me, looks like a typo - the link is to the tag/v6.0.100, but the text is 6.0.101. 101 is inaccessible without credentials:

Username for 'https://dev.azure.com':
Password for 'https://dev.azure.com':

@asbjornu
Copy link
Member

asbjornu commented Jan 12, 2022

@DmitryJustDmitry, thanks for providing that essential piece of information! With version 6.0.101 I got stuck on the missing credentials as described in #2719 (comment), but with version 6.0.100 everything builds successfully and I've managed to submit Homebrew/homebrew-core#92991 to Homebrew.

@omajid
Copy link
Member

omajid commented Jan 12, 2022

AFAIK, the 6.0.101 release accidentally included some non-public URLs (it wasn't really accidental, it was just a bit-by-bit copy of how the internal builds are done, I think). It might be worth trying to apply dotnet/installer#12852 on the local checkout of 6.0.101 to see if that fixes it.

@asbjornu
Copy link
Member

@omajid, thanks, but if 6.0.100 passes, I think we'll just await a new public release that works without any patches applied.

@asbjornu
Copy link
Member

asbjornu commented Jan 13, 2022

Alas, 6.0.100 does not work either. As I write in #2719 (comment), the nuget-client step fails. 😕

@MichaelSimons MichaelSimons moved this to 6.0 BackLog in .NET Source Build Feb 1, 2022
@MichaelSimons MichaelSimons moved this from 6.0 BackLog to 7.0 Backlog in .NET Source Build Apr 28, 2022
@lbussell lbussell changed the title .NET 6.0 Source-build instructions .NET Source-build instructions Jun 21, 2022
@lbussell
Copy link
Contributor Author

Coming back to this, I think we should update dotnet/installer's readme to point to the dotnet/source-build readme for instructions on how to build source build. The installer readme's instructions aren't the most up-to-date. Either that or we should move all the instructions to installer and point to them from source-build. The current set of instructions we have are different between the repos. This goes for main and supported release/6.0.xxx branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-doc Documentation improvements
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

9 participants