-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Bootstrap config: libgccjit libs dir #149354
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
base: main
Are you sure you want to change the base?
Bootstrap config: libgccjit libs dir #149354
Conversation
|
This PR changes how GCC is built. Consider updating src/bootstrap/download-ci-gcc-stamp. This PR modifies If appropriate, please update |
|
|
|
@Kobzol: I'm sending this PR to gather some feedback from you or others. How can I add tests for this new bootstrap config? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #149348) made this pull request unmergeable. Please resolve the merge conflicts. |
1bf3007 to
2125647
Compare
|
I will focus on #149426 first, as I think that we should first deal with the compiler/cg_gcc side of things, before we go modify bootstrap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense, although the implementation needs some changes. I'd be happy to play with this if you don't want to deal with doing these bootstrap changes.
|
☔ The latest upstream changes (presumably #149426) made this pull request unmergeable. Please resolve the merge conflicts. |
…rustlib directory
This will allow users to provide pre-built cross-compiled dylibs, while still downloading common (e.g. x64) dylibs from the CI.
|
I refactored the code a bit to more explicitly model that we have multiple target libgccjit dylibs per host, and also to enable both downloading from CI and using prebuilt libgccjit.so files (so that people don't also have to build their x64 libgccjit.so from scratch). Please let me know if it makes sense to you. |
This comment has been minimized.
This comment has been minimized.
This commit makes sense to me. |
If you already have it prepared, yeah, you could try it. Although CI failed, so maybe there's something else wrong. |
Good. I try that right away. |
The command finished running and the issue with the m68k |
|
I suspect I know where is the issue. bootstrap hacks around this for LLVM, but I don't like how it is done (I want to refactor how LLVM is handled in bootstrap, as it's super messy right now, but it's very hard). In that case, I would actually suggest to sidestep this issue entirely and use a different directory structure: This will run into an issue with Rustup later, but we would have the exact same issue even with the current layout, so it doesn't really matter. What do you think? |
This comment has been minimized.
This comment has been minimized.
I'm OK with this directory structure. |
|
I certainly hope not 😆 Bootstrap should only be deleting |
Ok. I'll try this new directory structure locally to see if that works. If so, I'll push it here. |
This comment has been minimized.
This comment has been minimized.
| return; | ||
| } | ||
|
|
||
| // <rustc>/lib/<host-target>/codegen-backends |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
There seems to be one issue: the native m68k @Kobzol: Any idea what could be wrong here? Edit: Could it be the step "Uplifting library (stage1:x86_64-unknown-linux-gnu -> stage2:m68k-unknown-linux-gnu)" that does that? |
|
My investigation leads me to believe that we don't fill properly My understanding is that for a specific stage, we need:
But that code seems to consider the host target (the one used to build the rustc) instead. |
|
It fascinates me how complicated is the handling of target pairs. We can be really thankful to LLVM for being able to cross-compile to multiple targets, otherwise bootstrap would have to handle yet another configuration axis 😆 This is kinda insane. I pushed a change that should build libgccjit for more targets. But it's quite difficult to debug without having access to a repro. If you could send me the whole libgcc-libs-dir prepared for the m68k cross-compilation, that would be useful. |
Indeed.
Thanks. In the mean time, I believe you could try using |
|
I believe this now copies the correct file, so we're getting there! One thing I noticed that can be confusing is that if the file for m68k is not found, it will try to build GCC, which will likely fail. For instance: I believe it would be better to abort with an error in this case. What are your thoughts on this? |
|
I think that it might be useful to have the ability to provide some prebuilt GCCs, but also to build the ones that you don't have prebuilt. That being said, bootstrap can't currently build GCC (T1, T2) where T1 != T2, and likely also where T1 != host. So in these cases we should indeed error out. For the case where T1 != T2, but T1 = host, is there some flag we could use to build libgccjit for (T1, T2)? That's not strictly cross-compiling, so if it's easy to do, we could support it in bootstrap. |
|
I finished my testing and everything seems to work 🥳 .
Do you mean creating a cross-compiling libgccjit? For instance, from x86-64 to m68k? |
|
When we try to resolve libgccjit for a target pair (T1, T2), three situations can happen:
We can already do 1. I assume that 3. is out of scope, and we should eagerly error out in that case (unless it's easy to cross-compile GCC, which I assume isn't the case). I was wondering whether we can support 2. For example, if there is some flag for GCC that tells it to build itself so that it can compile code for T2 (something like |
|
Doing number 2 is also not trivial. Currently, I have this repo where I create such cross-compilers in the CI. This uses a tool called But if using an external tool is not an option, this is going to be very hard. Look at this article which explains how to build a GCC cross-compiler if you want to have an idea. |
r? @Kobzol