-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
rustc: build with system llvm and jemalloc #49557
Conversation
@@ -29,7 +29,7 @@ in rec { | |||
./patches/disable-test-inherit-env.patch | |||
]; | |||
|
|||
forceBundledLLVM = true; | |||
withBundledLLVM = false; |
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 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.
It broke the tests back then 7bd191d
It could be still ok though:
- Archlinux does this as well: https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/rust
- Ubuntu uses the bundled one: https://git.launchpad.net/ubuntu/+source/rustc/tree/debian/control?h=ubuntu/cosmic
- Opensuse uses the system one: https://build.opensuse.org/package/view_file/devel:languages:rust/rust/rust.spec?expand=1
Since you deal with rust backports sometimes for firefox what would you prefer @andir ?
I guess in the worst case it should be still possible to just re-enable the bundled version in backported version.
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.
I really have no strong opinion here. I would certainly like to avoid a situation where we have to port LLVM whenever we have to back port rustc for Thunderbird/Firefox.
How much is the speedup of compilation time? If it is significant I could see this being a good thing in general.
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.
Compiling rustc with the bundled llvm takes about 1h05 for llvm and 55 min for rustc. So this halves compilation time.
Note that fedora disables codegen tests when using the bundled llvm.
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.
At the moment we do not run tests anyway.
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.
Is everything from their llvm fork upstream now? That was the main reason for this IIRC.
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.
They only seem to merge pull requests from changes that have been before in llvm.
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.
Great, I tried to split this out into 2 separate derivations at some point but not rebuilding llvm is even better.
No clue offhand, does `git blame` (or similar) give any explanation?
…On Wed, 31 Oct 2018 18:04:32 -0700, Jörg Thalheim ***@***.***> wrote:
Mic92 commented on this pull request.
> @@ -29,7 +29,7 @@ in rec {
./patches/disable-test-inherit-env.patch
];
- forceBundledLLVM = true;
+ withBundledLLVM = false;
@LnL7 @dtzWill anyone who does remember why we switched away from this option? I thing this option was true at some point.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#49557 (review) part: text/html
|
I will test the aarch64 build. I also would like to see macOS tested. |
@Mic92 I started a build on my darwin builder. I will report the results when done |
@danieldk maybe you can also have look at this w.r.t. to macOS. |
I'll give it a shot, my MacBook is chugging on the build now. |
Does not get very far on Darwin (Mojave, latest Xcode): |
Can you try to remove the |
I have added
Since the C++ standard library is libc++ on Darwin and the |
Yes |
Does the removed comment about jemalloc prefixes from postPatch still apply?
|
Ah maybe, I removed it because it was not needed on linux. |
That was indeed it, it finished the stage0 compiler, will keep you posted. |
Here is the modified diff that compiles on Darwin: https://gist.github.com/danieldk/127bf63c7ebcff0d7b0e9c21d482dd04 Changes:
Tested:
This seems to solve the failing doctest problem. |
The segmentation fault happens in
Full stack trace: https://gist.github.com/danieldk/5ee20615aa7ad61cba2a460ea5d08ac7 |
So it crashes in jemalloc for some reason. What I am surprised about is that I do not see any jemalloc dependencies in the homebrew build: https://github.com/Homebrew/homebrew-core/blob/76dbba870f4e74d76392d992d96bd044daf435a9/Formula/rust.rb Their jemalloc also comes without a prefix: https://github.com/Homebrew/homebrew-core/blob/master/Formula/jemalloc.rb#L26 Do they use the system allocator on macos? I don't see any vendoring done by rust regarding jemalloc. @alyssais do you know if they install a jemalloc by default in homebrew? |
There is a bundled jemalloc, which I remove to reduce compilation time. This was commented out before the PR. So maybe we should stick to the bundled jemalloc on darwin for the two or so upcoming rustc versions. |
@Mic92 I think Rust imports jemalloc itself through jemalloc_sys. I am now rebuilding jemalloc and rustc with the |
The
From the jemalloc documentation:
|
Just like fedora does: https://src.fedoraproject.org/rpms/rust/blob/master/f/rust.spec Also some cleanup of tests which were removed but no longer exist.
jemalloc with stripped prefix would cause segfaults in free: NixOS#49557 (comment) Thanks to @danieldk for darwin testing/debugging.
306b86b
to
973eca7
Compare
Thanks @danieldk !
This new commit does not change hashes on linux. |
Thanks! I'll do another test run. |
Everything I tested before works well 👍 . |
I am running a rebuild of this on x86_64-linux. It sounds really promising! :) |
aarch64 build is scheduled. |
aarch64 build has been rescheduled (the community builder was rebooted) |
aarch64 successfully builded |
@Mic92 can we enable tests for nix-index, alacritty and bat again? |
ic bat is enabled in #50236 |
Only in staging, presumably. |
jemalloc with stripped prefix would cause segfaults in free: NixOS#49557 (comment) This commit has been adjusted from the one on master to only carry the relevant changes (the new optional `stripPrefix`) flag while still keeping the other flags that were removed on master since they are no loner supported by the version used there. (cherry picked from commit 973eca7)
Motivation for this change
We can use our llvm instead of the bundled one, just like fedora does: https://src.fedoraproject.org/rpms/rust/blob/master/f/rust.spec
The closure size goes down a little: 780MB -> 740MB, but now part of this closure is llvm and can be shared. This also benefits compilation time.
The commit also includes some cleanup of tests which no longer exist and don't need to be removed.
I tested compilation of alacritty, firefox, thunderbird and ripgrep on x86_64-linux. (on top of master, 9f88282)
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)