Zeckmathederg / glfs

Gaming Linux From Scratch is a book that covers how to install packages like Steam and Wine after the Linux From Scratch book.
26 stars 4 forks source link

Bootstrap mingw instead of using a binary #9

Closed rahulc07 closed 1 week ago

rahulc07 commented 3 months ago

This is more of a discussion than an issue,

Currently GLFS is using a binary version of mingw to bootstrap the rest of the toolchain,

Issues/Concerns with Binary Blobs, especially for things as essential as a compiler, have been brought up throughout opensource after the whole XZ incident,

Examples: XZ - The original issue referring to the blobs seems to have been removed? https://github.com/spack/spack/issues/44270 https://github.com/ventoy/Ventoy/issues/2795

For packages like GNAT, it is virtually impossible to not use a binary to bootstrap,

But for mingw you don't have to use a binary, I can make a pull request where mingw is bootstrapped from source alone but keep in mind that the one downside to this is that gcc will have to be built 2 (once a static build with make all-gcc and the next time with all of the componenets) maybe even 3 times, binutils should be built 2 times but you can get away with 1 if you are just building wine, as wine doesn't need the gold linker or heavy LTO to be performant.

Let me know if this is something that would be beneficial for GLFS

Zeckmathederg commented 3 months ago

It takes work to maintain my own binaries and ensuring that they do in fact work, but another thing is how big/long do we want the Wine chapter to be? Currently with MinGW-w64-GCC as it had to be built with 1 make job due to a race condition involving Ada, it alone takes about 1 to 2 hours to build both x86_64 and i686.

Aside from time being required more of the user rather than the maintainer of the binaries, I do think it's a net positive for GLFS and myself.

You can start work with making a PR and will suggest changes if necessary.

xry111 commented 3 months ago

binutils should be built 2 times but you can get away with 1 if you are just building wine, as wine doesn't need the gold linker or heavy LTO to be performant.

I'm even considering to remove gold from LFS. It seems another deathware. If we want a fast linker we can use mold (unfortunately it needs cmake so it won't be a candidate of a LFS package in a foreseeable future).

And AFAIK we shouldn't need to build binutils twice for LTO.

BTW it'd be better to report newly found GCC issues to https://gcc.gnu.org/bugzilla (if you are sure it's a GCC issue instead of GCC exploits a downstream issue, and it's not a dup). Feel free to add my @gcc.gnu.org address into Cc but frankly I know only a little about MinGW.

Zeckmathederg commented 3 months ago

I haven't reported anything yet as issues revolving around the MinGW-w64-GCC comp could have a few reasons as to why and most of the possible ones land on me as it could be an issue with the current instructions or could be an issue with the binaries I maintain - perhaps both.

Also Rahul, I'm unsure if Wine requires Ada support in MinGW-w64-GCC as WineHQ just says it needs the MinGW-w64 cross compiler. I can take a look at Wine's PE DLL code to see if any of it is written in Ada or just C and/or C++. I'm unsure if a binary would be necessary for Ada support in MinGW-w64-GCC but GLFS includes the support.

Zeckmathederg commented 3 months ago

Looks like only C support is technically required by Wine for MinGW-w64-GCC so we are good on that front. No cxx, cc, cpp, or adb files in the dlls/ directory.

rahulc07 commented 3 months ago

I've never built it with mingw ada, I have had a race condition that forced j1 but that was only when building the mingw libc

Zeckmathederg commented 3 months ago

Have you started work on a PR yet? If not then I can remove the MinGW-w64 Ada requirement, or just wait for the PR to come around, if you still wanna make one.

rahulc07 commented 3 months ago

I'm working on it but I dont have an ETA as to when that will be finished, probably just remove ada now

Zeckmathederg commented 2 months ago

Okay, sounds good. Thanks!

Zeckmathederg commented 2 months ago

Hey Rahul, how is progress on the PR? Do you have an ETA yet or is it still unknown? No rush either, just want to know how things are looking at the current moment.

rahulc07 commented 2 months ago

Hey Zeckma, I've been hit with a lot of deadlines as of late, expect that PR sometime this week, it's nearly done I just have to add the last mingw gcc build section.

Zeckmathederg commented 2 months ago

No problem, I understand. That'd be a nice window and would work out nicely. Thanks for working on it.

Zeckmathederg commented 1 month ago

I start my new job around the 7th of September from what it looks like. Until then, I have a lot of time on my hands. It would be nice to receive this PR before then, although it's fine if you can't do that.