-
Notifications
You must be signed in to change notification settings - Fork 13.3k
testing cg_gcc
is difficult
#124172
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
Comments
Hopefully this is just tweaking a build flag? |
It supports other architectures, but we decided to only enable x86-64 because GCC requires to build a toolchain per target, so this is going to take some CI resources to build them. Can you describe your use case a bit more? |
cg_gcc
not supporting aarch64 is blocking contributorscg_gcc
not being built for aarch64 is blocking contributors
There might be a bug to fix for aarch64 in cg_gcc, though. |
@antoyo The Rust Foundation provides both aarch64 and x86_64 virtual desktops for the purpose of working on the compiler. So if someone starts work on a contribution using an aarch64 desktop, finds out they need to modify cg_gcc, they have to either
It's just these little tripping hazards which cause unnecessary stumbles for contributors. They are technically possible to overcome but it can be annoying af, yanno? I think it makes sense to support both architectures since we do have both x86_64-unknown-linux-gnu and aarch64-unknown-linux-gnu at tier 1, and building gcc is relatively easy on those platforms, and it is much easier to e.g. emulate Linux than it is to emulate another architecture. And by "emulate" that probably more specifically means "run the kernel inside a hypervisor", realistically, but that version is still comparatively seamless. |
Someone primarily using an aarch64-apple-darwin machine to contribute (and we do have a few of those) and doesn't currently have access to the virtual desktops would be stuck with Rosetta2 JITting the entire compiler, probably? And then libgccjit generates x86-64 code to compile test binaries? Which then Rosetta2 JITs? And that can be fast but... that's a bit of a lot that "ability to directly use native binaries, even if using a foreign object encoding" bypasses (e.g. they could also have Asahi or Parallels on the machine). Any recommendations for unblocking people running into this issue should probably be PRed to the dev guide! As should... probably... more general build/test/etc. instructions for both codegen backends? |
One important thing to note is that currently the GCC backend is broken in the compiler (something about statics). I'm currently (although slowly) looking into it. There are multiple issues we need to fix to make it easier for everyone to contribute on GCC backend:
|
Oof! That sounds "exciting".
Ah, something like We'd probably want to allow setting something like
Ah, having build instructions there would be great! Or even a pointer to build instructions from the guide into a README in the repo somewhere, if they're still likely to be updated often in tandem with |
It is. 😉
Exactly. It's in my todo list once the GCC backend is fixed (no use to add a new build system feature if it cannot be tested nor used haha).
There are already in the |
Would pre-built libgccjit be helpful? |
I think pre-built libgccjit would be good, but I also think sufficient build/cross-build tools/instructions available that it's easy enough to build libgccjit on one's own should be fine? It seems reasonable to expect compiler contributors to put up with inconveniences occasionally, but a lot of the sorts of persons who will be contributing to the compiler are the sort of person who will want to do something "properly" so it won't actually occur to them to simply give up and switch to x86-64, they'll look at how to get |
cg_gcc
not being built for aarch64 is blocking contributorscg_gcc
on aarch64-linux is difficult
As mentionned by @GuillaumeGomez, the repo contains the build instructions. |
So I checked the
...hm. what are the instructions for building it? when I looked for them, I couldn't find them in the README of the I skimmed and found
So the rest of that, after cloning, went like $ pwd
/home/jubilee/rust/gcc
$ cd INSTALL
$ ls
README
$ cat README
This directory has been obsoleted for GCC snapshots and SVN access.
For releases the installation documentation is generated from
gcc/doc/install.texi and copied into this directory.
To read this documentation, please point your HTML browser to "index.html".
The latest version is always available at http://gcc.gnu.org/install/ .
$ ls ./index.html
ls: cannot access './index.html': No such file or directory
$ ls ../index.html
ls: cannot access '../index.html': No such file or directory
$ ls ../gcc/index.html
ls: cannot access '../gcc/index.html': No such file or directory
$ ls ../gcc/doc/index.html
ls: cannot access '../gcc/doc/index.html': No such file or directory
$ huh?
bash: huh?: command not found
$ cat README | grep index.html
To read this documentation, please point your HTML browser to "index.html".
$ cat ../gcc/doc/install.texi ...as for the output of that last one, uh, I probably should have used I have built gcc before, but it was several years ago, and I distinctly remember thrashing quite a bit until a friend told me what the magic words were. |
And yet CI currently passes. So what's going on here? Should we have an emergency patch to disable the GCC backend until the whole situation in this issue is resolved? |
And yes, coming back to the README and reviewing it more closely, I see it does describe how to build things under "Building with your own GCC version" but I did not want to do that, you see, I wanted to use your forked version instead? I assumed I could ignore this entire section because this
I don't want to patch GCC, and I don't know what "without this backend" even means, honestly? It is somewhat surprising to read instructions written for programming where conditionals that are logically false describe the code I actually want to have run? It doesn't seem that odd to want to simply build the code from source but at the same commit? |
It's not enabled anywhere and very few tests of the GCC backend are actually run in rustc's CI. It's mostly to ensure that it still builds for now. |
For reference, jubilee is talking about this. The section could get an improvement in its description since it's "our" gcc (already patched and everything) that we use everywhere. Also, I don't know what "without this backend" means either in this context. 😅
It's exactly what it's describing how to do: building gcc version with our patches so you can then test with the gcc backend. |
ah, I see! it seems the information is there but probably needs reframing so that it is no longer easy to interpret the condition as not being true? |
@GuillaumeGomez while using an $ ./x.py test rustc_codegen_gcc
Building bootstrap
Finished `dev` profile [unoptimized] target(s) in 0.02s
Building stage0 library artifacts (x86_64-unknown-linux-gnu)
Finished `release` profile [optimized] target(s) in 0.07s
Building compiler artifacts (stage0 -> stage1, x86_64-unknown-linux-gnu)
Finished `release` profile [optimized] target(s) in 0.12s
Building stage0 codegen backend gcc (x86_64-unknown-linux-gnu)
Finished `release` profile [optimized] target(s) in 0.01s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Finished `release` profile [optimized] target(s) in 0.07s
Building stage1 library artifacts (x86_64-unknown-linux-gnu)
error: process didn't exit successfully: `/home/jubilee/rust/rustc/build/bootstrap/debug/rustc -vV` (exit status: 1)
--- stdout
rustc 1.79.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.79.0-dev
--- stderr
error: couldn't load codegen backend /home/jubilee/rust/rustc/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_gcc-1.79.0-dev.so: libgccjit.so.0: cannot open shared object file: No such file or directory
Build completed unsuccessfully in 0:00:01
$ ls -lh | grep libgccjit
lrwxrwxrwx 1 jubilee jubilee 14 Apr 20 13:50 libgccjit.so -> libgccjit.so.0
lrwxrwxrwx 1 jubilee jubilee 18 Apr 20 13:50 libgccjit.so.0 -> libgccjit.so.0.0.1
-rwxr-xr-x 1 jubilee jubilee 305M Apr 20 13:50 libgccjit.so.0.0.1 Indeed, now that I am trying to load the gcc backend, everything seems to fail in this way. And setting |
I mentioned it above. ^ |
er, wait... didn't you add support to the current build system for it right here? rust/src/bootstrap/src/core/build_steps/test.rs Lines 3407 to 3531 in fb89862
and then PR the dev guide with the following command? LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12/ ./x.py test compiler/rustc_codegen_gcc/ leading me to input this, based on that, with a path to a freshly-built libgccjit: $ cat config.toml
# Includes one of the default files in src/bootstrap/defaults
profile = "compiler"
change-id = 123711
[rust]
codegen-backends = ["llvm", "gcc"]
$ ls -lh "$(pwd)/../gcc-build/gcc" | grep "gccjit"
lrwxrwxrwx 1 jubilee jubilee 14 Apr 21 17:17 libgccjit.so -> libgccjit.so.0
lrwxrwxrwx 1 jubilee jubilee 18 Apr 21 17:17 libgccjit.so.0 -> libgccjit.so.0.0.1
-rwxr-xr-x 1 jubilee jubilee 305M Apr 21 17:17 libgccjit.so.0.0.1
$ LIBRARY_PATH="$(pwd)/../gcc-build/gcc" ./x.py test compiler/rustc_codegen_gcc yet things don't work with my libgccjit built from the gcc fork on an x86-64 machine with afaik no custom nothing at this point? I'm... confused at my ability to break this, at this point. I am halfway to believing I have an ancient curse, a mutant electromagnetic field, or uncontrolled psionic abilities, because it seems like I have broken the "golden path" now. |
It needs to have the libgccjit.so in your system library folder for now as far as I know. It's literally only used in the rustc's CI. |
Would setting both |
I did try that, @bjorn3, and it seems it does not. :/ |
cg_gcc
on aarch64-linux is difficultcg_gcc
is difficult
If this backend is holding up development, in large part because developing on it appears to be impossible, why are we not discussing removing it until it becomes usable? |
Is it really holding up development? We never force people to implement the stuff for the GCC codegen: if they don't want to, they can just put Please explain how this is holding up development. |
Ah! So the correct response in #124003 is indeed to just comment out or stub out failing tests. I probably just got confused because we seem to have very different standards for rustc_codegen_cranelift. |
The current standing is different for both, cg_cranelift is much more advanced than cg_gcc. It's important for us to have it run as part of rustc's CI to greatly reduce the maintenance cost on our side. |
I'm a little late, but since antoyo invited me, here are my few cents. From my perspective, as someone who touches the This should make it much easier to do changes to |
I was planning to make |
I opened #124353. It should fix most issues. For now it only supports linux @workingjubilee: Your problem was that we did not set the |
[bootstrap] Add gcc to dist generation As `@eholk` summarized below: > From my understanding, this change would add libgccjit as an optional component to the Rust distribution. This library is licensed under GPLv2 and currently we do not have any other components under that license so it would be a new license, and one that is generally more restrictive than the other licenses we use. It'll greatly improve the experience for anyone wanting to work on the GCC backend from the compiler. Should help with rust-lang#124172. Will unblock rust-lang#124353. r? `@Kobzol`
[bootstrap] Add gcc to dist generation As `@eholk` summarized below: > From my understanding, this change would add libgccjit as an optional component to the Rust distribution. This library is licensed under GPLv2 and currently we do not have any other components under that license so it would be a new license, and one that is generally more restrictive than the other licenses we use. It'll greatly improve the experience for anyone wanting to work on the GCC backend from the compiler. Should help with rust-lang#124172. Will unblock rust-lang#124353. r? `@Kobzol`
[bootstrap] Add gcc to dist generation As `@eholk` summarized below: > From my understanding, this change would add libgccjit as an optional component to the Rust distribution. This library is licensed under GPLv2 and currently we do not have any other components under that license so it would be a new license, and one that is generally more restrictive than the other licenses we use. It'll greatly improve the experience for anyone wanting to work on the GCC backend from the compiler. Should help with rust-lang#124172. Will unblock rust-lang#124353. r? `@Kobzol`
…bzol [bootstrap] Add support for building gcc and libgccjit As `@eholk` summarized below: > From my understanding, this change would add libgccjit as an optional component to the Rust distribution. This library is licensed under GPLv2 and currently we do not have any other components under that license so it would be a new license, and one that is generally more restrictive than the other licenses we use. It'll greatly improve the experience for anyone wanting to work on the GCC backend from the compiler. Should help with rust-lang#124172. Will unblock rust-lang#124353. r? `@Kobzol`
…bzol [bootstrap] Add support for building gcc and libgccjit As `@eholk` summarized below: > From my understanding, this change would add libgccjit as an optional component to the Rust distribution. This library is licensed under GPLv2 and currently we do not have any other components under that license so it would be a new license, and one that is generally more restrictive than the other licenses we use. It'll greatly improve the experience for anyone wanting to work on the GCC backend from the compiler. Should help with rust-lang#124172. Will unblock rust-lang#124353. r? `@Kobzol`
…bzol [bootstrap] Add support for building gcc and libgccjit As `@eholk` summarized below: > From my understanding, this change would add libgccjit as an optional component to the Rust distribution. This library is licensed under GPLv2 and currently we do not have any other components under that license so it would be a new license, and one that is generally more restrictive than the other licenses we use. It'll greatly improve the experience for anyone wanting to work on the GCC backend from the compiler. Should help with rust-lang#124172. Will unblock rust-lang#124353. r? `@Kobzol`
[bootstrap] Add support for building gcc and libgccjit As `@eholk` summarized below: > From my understanding, this change would add libgccjit as an optional component to the Rust distribution. This library is licensed under GPLv2 and currently we do not have any other components under that license so it would be a new license, and one that is generally more restrictive than the other licenses we use. It'll greatly improve the experience for anyone wanting to work on the GCC backend from the compiler. Should help with rust-lang/rust#124172. Will unblock #124353. r? `@Kobzol`
[bootstrap] Add support for building gcc and libgccjit As `@eholk` summarized below: > From my understanding, this change would add libgccjit as an optional component to the Rust distribution. This library is licensed under GPLv2 and currently we do not have any other components under that license so it would be a new license, and one that is generally more restrictive than the other licenses we use. It'll greatly improve the experience for anyone wanting to work on the GCC backend from the compiler. Should help with rust-lang/rust#124172. Will unblock #124353. r? `@Kobzol`
cc @GuillaumeGomez @antoyo
The backend currently only supports x86-64, but some contributors primarily use aarch64 machines, but have cause to work on the codegen backends. They instead have to force cg_gcc's code through emulators, which is often an inadequate solution. It would be better if it simply supported all of our tier 1 architectures.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: