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

package ldc for aarch64 (and more) #34752

Closed
2 of 3 tasks
Marie-Joseph opened this issue Dec 29, 2021 · 10 comments
Closed
2 of 3 tasks

package ldc for aarch64 (and more) #34752

Marie-Joseph opened this issue Dec 29, 2021 · 10 comments
Labels

Comments

@Marie-Joseph
Copy link
Contributor

Marie-Joseph commented Dec 29, 2021

Updated Goals

After bootstrapping LDC locally, I'll host a version for cross-compiling it. The below steps are still requisite for (my) local LDC compilation.

Steps

  • package GDC

Necessary for my local bootstrap.

Necessary for my local bootstrap.

  • update LDC to cross-compile

This should be as simple as adding the LDMD front-end to the LDC package and using it to compile itself.

Notes

Since I need this, I'm going to work on it and will update this issue as I progress. If more capable hands want to take over, feel absolutely free. It'll likely take me several days to a couple weeks to do this (especially since my build machine for testing is a Raspberry Pi 4) and I'm sure others with more experience would be able to do it faster.

@sug0
Copy link
Contributor

sug0 commented Dec 30, 2021

Hi. I'm in no capability to help with this, but I'll just leave a suggestion.

especially since my build machine for testing is a Raspberry Pi 4

Can you not cross-compile from a more powerful x86_64 machine? This would surely speed things up. I think the void infra cross-compiles all aarch64 packages.

@ericonr
Copy link
Member

ericonr commented Dec 30, 2021

About GDC: #12700 (comment)

Gdc is available in gcc sources, and versions <=11.2 use a C++ frontend (no D compiler needed).

What does this mean? Does more recent GCC require a D compiler to build gdc? That would make this proposal a no go because it would make bootstrap way more complicated.

@q66
Copy link
Contributor

q66 commented Dec 30, 2021

if gdc from 11.x is self-hosting and cannot build without another D compiler, i'm absolutely opposed to enabling it

(also, even in the version in 10.x, it does not support all targets void has)

@Marie-Joseph
Copy link
Contributor Author

Marie-Joseph commented Dec 31, 2021

Can you not cross-compile from a more powerful x86_64 machine?

Yes, but only on a laptop that I have to beg and plead to charge. So some days I can, some days I can't. I'll make a follow-up comment with insights I've gained since today is one day I could. Spoiler alert: many things are broken with cross-compilation.

Does more recent GCC require a D compiler to build gdc? That would make this proposal a no go because it would make bootstrap way more complicated.

Yes, as of (2021-12-29) HEAD it will require a D compiler. If by bootstrap you mean the (build) system bootstrap, I'd like to have a way to only build GDC when doing so explicitly. I'll look into that once I can compile it at all. Although Ada is built by default with the gcc package, and it requires an extant compiler. Assuming a glibc host, we could similarly download one like the gnat switch allows for Ada. If you mean bootstrapping GDC itself, both other D compilers require a D compiler, which is the source of this being such an issue to begin with. DMD only supports x86_64 and i686; LDC currently builds with DMD, therefore LDC can only be built for x86_64. More commentary on this in my next comment.

if gdc from 11.x is self-hosting and cannot build without another D compiler, i'm absolutely opposed to enabling it
(also, even in the version in 10.x, it does not support all targets void has)

Both of these points apply to both in-tree D compilers. Adding GDC will actually make D in general available on more platforms.

@Marie-Joseph
Copy link
Contributor Author

So I've managed to try some cross-compilation today, both of LDC and GDC.

For GDC compilation, I added a D build option. I had some trouble getting libisl downloaded. It seems the link in the current template stopped working sometime in the last couple days. I managed to find a different one that still works at https://libisl.sourceforge.io though. However, for some reason g++ gets passed the flag "-march=armv8-a" at some point, which is not a valid value for that flag. From what I can tell, that flag is only valid for x86* builds since valid options all seem to be code names or descriptors of various x86* architectures. Without digging into makefiles I don't think I can resolve that, so I moved on to trying to compile LDC with LDC.

The first problem with compiling LDC with LDC is that it requires the ldmd front-end. Void doesn't package the ldmd front-end. So I decided to try natively compiling it to get build artifacts to figure out how to package the ldmd front-end so I can do that and install it to use it to cross-build LDC with LDC. But unfortunately, it can't find a bunch of LLVM headers. Maybe because I'm using musl? In any case, resolving that particular issue seems even more time-consuming than getting GDC to compile.

So I'm going to take a break (I've been at this for the plurality of my waking hours since opening this issue) and when I come back I guess I'll be digging into makefiles.

@q66
Copy link
Contributor

q66 commented Dec 31, 2021

I am opposed to requiring a D compiler to bootstrap a system, and since gcc will now require a D compiler to enable gdc, there is no way you can get around that (you either need an existing D compiler, or download some kind of binary snapshot during the build, and both options are bad for bootstrapping a Void system)

The situation is already bad with Ada, and I don't want to add more of the same to it, except worse because unlike Ada, GDC does not cover all targets we cover

D is not an important enough language to warrant the extra burden, barely anything uses it, and you will be imposing this on the toolchain maintainers in the distro

If you want GDC, build it separately as its own template, use binary snapshots to bootstrap, but don't have it affect the system compiler

you can use the same strategy for bootstrapping ldc; cross-compile snapshot builds of ldc, make tarballs of them, upload them somewhere, then use them to bootstrap ldc (same thing is done for e.g. rust, go, ...)

@Marie-Joseph
Copy link
Contributor Author

Fair enough. If no one wants it, I won't force it.

I'll focus on LDC, then.

@Marie-Joseph
Copy link
Contributor Author

@q66 :

you can use the same strategy for bootstrapping ldc; cross-compile snapshot builds of ldc, make tarballs of them, upload them somewhere, then use them to bootstrap ldc (same thing is done for e.g. rust, go, ...)

Would I need to package it for musl or glibc or both? I'm assuming it needs to be x86_64 either way.

@q66
Copy link
Contributor

q66 commented Dec 31, 2021

there needs to be a tarball for every host you want to build the compiler on; do you need any for x86_64? I thought that already bootstrapped fine with dmd, and the whole point of this was to bootstrap on aarch64 and the likes

@github-actions
Copy link

Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants