From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:42426) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFKGf-0001Ds-4c for guix-patches@gnu.org; Fri, 20 Mar 2020 12:13:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jFKGc-0004sq-Ac for guix-patches@gnu.org; Fri, 20 Mar 2020 12:13:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jFKGc-0004sS-1O for guix-patches@gnu.org; Fri, 20 Mar 2020 12:13:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jFKGb-0006GC-RU for guix-patches@gnu.org; Fri, 20 Mar 2020 12:13:01 -0400 Subject: [bug#38110] [PATCH core-updates v3] gnu: rust: Bootstrap rust@1.29.0 by mrustc@0.9. Resent-Message-ID: From: Marius Bakke In-Reply-To: <20200315192311.6505-1-dannym@scratchpost.org> References: <20191107222756.20064-1-dannym@scratchpost.org> <20200315192311.6505-1-dannym@scratchpost.org> Date: Fri, 20 Mar 2020 17:11:55 +0100 Message-ID: <877dzf9fas.fsf@devup.no> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Danny Milosavljevic , 38110@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Danny Milosavljevic 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... --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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 . + +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] --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl5060sACgkQoqBt8qM6 VPoKSgf/cr9A0OUZowldxQYe1x8ZtadA5iQ50s2ziR3KFQ9u+mAEQTj/YuwDZoX5 NA5Qz/jX+pTj9aNppt63Xx7jA2fGWS8pWAcRISnPcnayIxvv/Txu9TKccim98RB/ HB90XnUZPOoF2dPXpCgMgc+BW+UZIHMTVvFHt/pYlztaJ4jWci2HEymGxlYXTAnk U2DKzieulevLtG7R9JIfrSNyuB5Q/SPHSksfhJesGuNXMZ1KvIeU4Mb9O3MuD2T4 ONt+alvwqXPewrzItt5sFFJuY91em3LSdA7//MDze61MWDAuAvltNuhZ8IvO3jBm /iPCuShWTRdInkuArseQzeVoatMNJw== =TM9d -----END PGP SIGNATURE----- --==-=-=--