diff mbox series

[bug#38110,core-updates,v3] gnu: rust: Bootstrap rust@1.29.0 by mrustc@0.9.

Message ID 877dzf9fas.fsf@devup.no
State Accepted
Headers show
Series [bug#38110,core-updates,v3] gnu: rust: Bootstrap rust@1.29.0 by mrustc@0.9. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job

Commit Message

Marius Bakke March 20, 2020, 4:11 p.m. UTC
Danny Milosavljevic <dannym@scratchpost.org> writes:

> * gnu/packages/patches/rustc-1.29.0-src.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/rust.scm (rust-1.19): Delete variable.
> (rust-1.20): Delete variable.
> (rust-1.21): Delete variable.
> (rust-1.22): Delete variable.
> (rust-1.23): Delete variable.
> (rust-1.24): Delete variable.
> (rust-1.25): Delete variable.
> (rust-1.26): Delete variable.
> (rust-1.27): Delete variable.
> (rust-1.28): Delete variable.
> (rust-1.29): Bootstrap from mrustc.
> [source]: Add patch.
> (rust-1.30)[inputs]: Remove llvm 3.  Add llvm 6.
> (mrustc): Update rustc-version to 1.29.0.

Thanks a lot for this work Danny!

I was able to get one step further by hacking the mrustc compiler to
force "group linking" with --start-group and --end-group, based on a
suggestion in #mrustc.  It makes the compiler about 10x slower, but
I suppose that's okay for a one-time job.

Now the build fails when trying to use the built rustc binary, and I'm
struggling to figure out how to proceed.  I think we are pretty close!

I've attached my changes as a diff here.  Some of the changes are purely
cosmetic, feel free to pick-and-choose what you want/need.

Without further ado...

Comments

Danny Milosavljevic March 23, 2020, 9:24 p.m. UTC | #1
Hi Marius,

it's good to hear that we have some further progress.

I've tried it myself but I can't build it on my laptop with 8 GiB of RAM, not
even after adding 4 GiB of swap (on an SSD... urgh).

So if the "group linking" caused this massive increase of memory consumption,
that's probably not good.

Isn't it enough to automatically prepend "-lgit2" when "-lssh2" appears
or something?

See https://github.com/thepowersgang/mrustc/issues/140

I have an account on bayfront and it doesn't work there either (copied the
entire working directory over from my laptop):

Building rust, I get a texinfo build failure:
[...]
+ exec ./ginfo --init-file ./t/Infokey-config -f file-menu
info: "./t/Infokey-config", line 2: unknown action `xxx-not-recognized'
info: "./t/Infokey-config", line 3: cannot bind key sequence to menu-digit
+ kill -s WINCH 16225
[...]
+ rm -f t/resize-in-completions.sh.out
+ rm -f t/resize-in-completions.sh.pipein t/resize-in-completions.sh.pipeout
+ exit 1
FAIL t/resize-in-completions.sh (exit status: 1)
command "make" "check" "-j" "6" failed with status 2

(it does the same even after guix gc, so it's reproducible)
Marius Bakke March 23, 2020, 10:16 p.m. UTC | #2
Danny Milosavljevic <dannym@scratchpost.org> writes:

> Hi Marius,
>
> it's good to hear that we have some further progress.
>
> I've tried it myself but I can't build it on my laptop with 8 GiB of RAM, not
> even after adding 4 GiB of swap (on an SSD... urgh).
>
> So if the "group linking" caused this massive increase of memory consumption,
> that's probably not good.
>
> Isn't it enough to automatically prepend "-lgit2" when "-lssh2" appears
> or something?

That would be a much better hack yes.  :-)

> See https://github.com/thepowersgang/mrustc/issues/140
>
> I have an account on bayfront and it doesn't work there either (copied the
> entire working directory over from my laptop):
>
> Building rust, I get a texinfo build failure:
> [...]
> + exec ./ginfo --init-file ./t/Infokey-config -f file-menu
> info: "./t/Infokey-config", line 2: unknown action `xxx-not-recognized'
> info: "./t/Infokey-config", line 3: cannot bind key sequence to menu-digit
> + kill -s WINCH 16225
> [...]
> + rm -f t/resize-in-completions.sh.out
> + rm -f t/resize-in-completions.sh.pipein t/resize-in-completions.sh.pipeout
> + exit 1
> FAIL t/resize-in-completions.sh (exit status: 1)
> command "make" "check" "-j" "6" failed with status 2
>
> (it does the same even after guix gc, so it's reproducible)

How are you building Rust?  I've only used the Guix package definition
and did not get as far as actually running the test suite.  Do you have
an updated build script?
Danny Milosavljevic March 24, 2020, 11:57 a.m. UTC | #3
Hi Marius,

On Mon, 23 Mar 2020 23:16:07 +0100
Marius Bakke <mbakke@fastmail.com> wrote:

> > Building rust, I get a texinfo build failure:

> How are you building Rust?  I've only used the Guix package definition
> and did not get as far as actually running the test suite.  Do you have
> an updated build script?

It's failing in texinfo, not in rust.

Also, on my laptop, it's not failing in texinfo.  So I guess it has
something to do with bayfront or the machines it offloads to.

Attached gnu/packages/rust.scm , but it's the same we already have.
What I mean is that I cannot see any way for me to test it myself right now.

What error message do you get when trying to use the rust compiler?
Marius Bakke March 24, 2020, 2:45 p.m. UTC | #4
Danny Milosavljevic <dannym@scratchpost.org> writes:

> Hi Marius,
>
> On Mon, 23 Mar 2020 23:16:07 +0100
> Marius Bakke <mbakke@fastmail.com> wrote:
>
>> > Building rust, I get a texinfo build failure:
>
>> How are you building Rust?  I've only used the Guix package definition
>> and did not get as far as actually running the test suite.  Do you have
>> an updated build script?
>
> It's failing in texinfo, not in rust.

Oh right, sorry for the confusion.

> Also, on my laptop, it's not failing in texinfo.  So I guess it has
> something to do with bayfront or the machines it offloads to.

I haven't seen this in the countless times I've built core-updates over
the last few months, nor on Berlin.  I suspect it has to do with
parallelism; can you see if #:parallel-tests? #f makes a difference?

You should be able to grab a Texinfo substitute from ci.guix.gnu.org
though.
diff mbox series

Patch

2 files changed, 26 insertions(+), 5 deletions(-)
gnu/packages/patches/mrustc-group-link.patch | 22 ++++++++++++++++++++++
gnu/packages/rust.scm                        |  9 ++++-----

new file   gnu/packages/patches/mrustc-group-link.patch
@@ -0,0 +1,22 @@ 
+Surround the libraries with --start-group and --end-group to work
+around <https://github.com/thepowersgang/mrustc/issues/138>.
+
+diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp
+--- a/src/trans/codegen_c.cpp
++++ b/src/trans/codegen_c.cpp
+@@ -960,6 +960,7 @@ namespace {
+                     {
+                         args.push_back("-L"); args.push_back(path);
+                     }
++                    args.push_back("-Wl,--start-group");
+                     for(const auto& lib : m_crate.m_ext_libs) {
+                         ASSERT_BUG(Span(), lib.name != "", "");
+                         args.push_back("-l"); args.push_back(lib.name.c_str());
+@@ -975,6 +976,7 @@ namespace {
+                     {
+                         args.push_back("-l"); args.push_back(path.c_str());
+                     }
++                    args.push_back("-Wl,--end-group");
+                     for( const auto& a : Target_GetCurSpec().m_backend_c.m_linker_opts )
+                     {
+                         args.push_back( a.c_str() );
modified   gnu/packages/rust.scm
@@ -98,6 +98,7 @@ 
                       (url "https://github.com/thepowersgang/mrustc.git")
                       (commit (string-append "v" version))))
                 (file-name (git-file-name name version))
+                (patches (search-patches "mrustc-group-link.patch"))
                 (sha256
                  (base32
                   "194ny7vsks5ygiw7d8yxjmp1qwigd71ilchis6xjl6bb2sj97rd2"))))
@@ -128,10 +129,8 @@ 
            (add-after 'patch-date 'unpack-target-compiler
              (lambda* (#:key inputs outputs #:allow-other-keys)
                (invoke "tar" "xf" (assoc-ref inputs "rustc"))
-               (chdir ,(string-append "rustc-" rustc-version "-src"))
-               (invoke "patch" "-p0" ,(string-append "../rustc-" rustc-version
+               (invoke "patch" "-p1" ,(string-append "rustc-" rustc-version
                                                      "-src.patch"))
-               (chdir "..")
                (setenv "RUSTC_VERSION" ,rustc-version)
                (setenv "MRUSTC_TARGET_VER"
                 ,(version-major+minor rustc-version))
@@ -274,7 +273,7 @@  safety and thread safety guarantees.")
              #t))
          ;; This phase is overridden by newer versions.
          (replace 'configure
-           (lambda* (#:key inputs outputs #:allow-other-keys)
+           (lambda _
              (setenv "CXX" "g++")
              (setenv "HOST_CXX" "g++")
              #t))
@@ -326,7 +325,7 @@  safety and thread safety guarantees.")
                             (write name)
                             (newline)
                             (apply invoke
-                                   "output/rustc-build/rustc"
+                                   "output/rustc-build/rustc_binary"
                                    "-C" (string-append "linker="
                                                        (getenv "CC"))
                                    ;; Required for libterm.

[back]