From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: "guix environment --pure" different to guix-daemon's environment Date: Sat, 31 Mar 2018 00:53:17 +0200 Message-ID: <20180331005317.073c34e4@scratchpost.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/7KRIW1kaH6rpDhs8ugCr4py"; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f22tn-0008SH-NA for guix-devel@gnu.org; Fri, 30 Mar 2018 18:53:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f22tl-0005K8-0j for guix-devel@gnu.org; Fri, 30 Mar 2018 18:53:31 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:48340) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f22tk-0005G8-L3 for guix-devel@gnu.org; Fri, 30 Mar 2018 18:53:28 -0400 Received: from localhost (77.118.172.128.wireless.dyn.drei.com [77.118.172.128]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 5F0BF336046D for ; Sat, 31 Mar 2018 00:53:25 +0200 (CEST) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --Sig_/7KRIW1kaH6rpDhs8ugCr4py Content-Type: multipart/mixed; boundary="MP_/8dDG6y4NVYlI03oWXNEQA85" --MP_/8dDG6y4NVYlI03oWXNEQA85 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, so I'm trying to get mrustc to work (see attachment) but I've hit a snag. When I use "guix build", gcc will eventually fail with SIGABRT. When I then try to reproduce the problem via "guix environment" gcc works j= ust fine (using the failed tempdir and the failed command line). What could be up in this case? Can I get guix-daemon to make gcc dump core on SIGABRT? (setrlimit in a bui= ld phase? :->) --MP_/8dDG6y4NVYlI03oWXNEQA85 Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=wip-mrustc.patch diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 70140579b..ceb3510fc 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -46,6 +46,7 @@ #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module (guix download) + #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module ((guix build utils) #:select (alist-replace)) @@ -148,7 +149,87 @@ in turn be used to build the final Rust.") "rustc-" version "-src.tar.gz")) (sha256 (base32 hash)) (modules '((guix build utils))) - (snippet '(begin (delete-file-recursively "src/llvm") #t)))) + ; FIXME (snippet '(begin (delete-file-recursively "src/llvm") #t)) + )) + +(define-public mrustc + (let ((commit "e49cd3b71a5b5458ecd3f3937c04d1a35871a190") + (revision "0") + (rustc-version "1.19.0")) + (package + (name "mrustc") + (version (git-version "0.0.0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/thepowersgang/mrustc.git") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "02r012cqj0h92rz90n2limbp58102kyak54lgi7a0pnd6pmgygzp"))= )) + (build-system gnu-build-system) + (inputs + `(("llvm" ,llvm-3.9.1))) + (native-inputs + `(("bison" ,bison) + ("flex" ,flex) + ;; Required for the libstd sources. + ("rustc" + ,(rust-source "1.19.0" "0l8c14qsf42rmkqy92ahij4vf356dbyspxcips1a= swpvad81y8qm")))) + (arguments + `(#:tests? #f + #:make-flags (list (string-append "LLVM_CONFIG=3D" + (assoc-ref %build-inputs "llvm") + "/bin/llvm-config")) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'unpack-target + (lambda* (#:key inputs outputs #:allow-other-keys) + (substitute* "minicargo.mk" ; source + (("^[$][(]LLVM_CONFIG[)]:") "xxx:")) + (invoke "tar" "xf" (assoc-ref inputs "rustc")) + (chdir "rustc-1.19.0-src") + (delete-file-recursively "src/llvm") + (setenv "LLVM_LINK_SHARED" "1") ; FIXME move? + (invoke "patch" "-p0" "../rust_src.patch") + (chdir "..") + #t)) + (delete 'configure) + (add-after 'build 'build-minicargo + (lambda _ + (for-each (lambda (target) + (invoke "make" "-f" "minicargo.mk" target)) + '("output/libstd.hir" "output/libpanic_unwind.hir" + "output/libproc_macro.hir")) + ;; Technically the above already does it - but we want to b= e clear. + (invoke "make" "-C" "tools/minicargo"))) + (replace 'install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (string-append (assoc-ref outputs "out"))) + (bin (string-append out "/bin")) + (tools-bin (string-append out "/tools/bin")) + (lib (string-append out "/lib")) + (lib/rust (string-append lib "/mrust")) + (gcc (assoc-ref inputs "gcc"))) + ;; These files are not reproducible. + (for-each delete-file (find-files "output" "\\.txt$")) + (mkdir-p lib) + (copy-recursively "output" lib/rust) + (mkdir-p bin) + (mkdir-p tools-bin) + (install-file "tools/bin/minicargo" tools-bin) + (install-file "bin/mrustc" bin) + ;; Rust requires a C toolchain for linking, as "cc". + (symlink (string-append gcc "/bin/gcc") + (string-append out "/bin/cc")) + #t)))))) + (synopsis "Compiler for the Rust progamming language") + (description "Rust is a systems programming language that provides m= emory +safety and thread safety guarantees.") + (home-page "https://github.com/thepowersgang/mrustc") +;;; TODO: Add env vars: CFG_COMPILER_HOST_TRIPLE=3Dx86_64-unknown-linux-gn= u LLVM_CONFIG CFG_RELEASE=3D CFG_RELEASE_CHANNEL=3Dstable CFG_VERSION=3D$(R= USTC_VERSION=3D1.19.0)-$(RUSTC_CHANNEL)-mrustc CFG_PREFIX=3Dmrustc CFG_LIBD= IR_RELATIVE=3Dlib + (license license:expat)))) =20 (define-public rust-1.23 (package @@ -199,7 +280,9 @@ in turn be used to build the final Rust.") "#[ignore]\nfn connect_timeout_unroutable")) ;; (substitute* "src/libstd/sys/unix/process/process_common.rs" - (("fn test_process_mask") "#[ignore]\nfn test_process_mas= k")) + (("#\\[cfg_attr\\(target_arch =3D \"arm\", ignore\\)\\] + fn test_process_mask") "#[ignore] + fn test_process_mask")) ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_= PATH. ;; (delete-file-recursively "src/test/run-make/linker-output-n= on-utf8") @@ -318,6 +401,57 @@ safety and thread safety guarantees.") ;; Dual licensed. (license (list license:asl2.0 license:expat)))) =20 +(define-public rust-1.19.0 + (package (inherit rust-1.23) + (name "rust") + (version "1.19.0") + (source (rust-source version "0l8c14qsf42rmkqy92ahij4vf356dbysp= xcips1aswpvad81y8qm")) + (arguments + (substitute-keyword-arguments + (package-arguments rust-1.23) + ((#:phases phases) + `(modify-phases ,phases + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (substitute* "src/librustc_errors/Cargo.toml" + (("[[]dependencies[]]") " +[dependencies] +term =3D \"0.4.4\" +")) + (substitute* "src/librustc/Cargo.toml" + (("[[]dependencies[]]") " +[dependencies] +getopts =3D { path =3D \"../libgetopts\" } +")) + + (setenv "CFG_COMPILER_HOST_TRIPLE" "x86_64-unknown-l= inux-gnu") + ;(setenv "LLVM_CONFIG") + (setenv "CFG_RELEASE" "") + (setenv "CFG_RELEASE_CHANNEL" "stable") + (setenv "CFG_VERSION" "1.19.0-stable-mrustc") + (setenv "CFG_PREFIX" "mrustc") + (setenv "CFG_LIBDIR_RELATIVE" "lib") + ;; Make Rust find "gcc". + ;(setenv "PATH" (string-append (as= soc-ref inputs "gcc") "/bin:" (getenv "PATH"))) + (invoke (string-append (assoc-ref inputs "rustc-boot= strap") "/tools/bin/minicargo") + "src/rustc" "--vendor-dir" "src/vendor" ;"-j= " "3" + "-L" (string-append (assoc-ref inputs "rustc= -bootstrap") "/lib/mrust")) + ; "--output-dir" "b/build" -L "b" + (setenv "CFG_COMPILER_HOST_TRIPLE" #f) + ;(setenv "LLVM_CONFIG") + (setenv "CFG_RELEASE" #f) + (setenv "CFG_RELEASE_CHANNEL" #f) + (setenv "CFG_VERSION" #f) + (setenv "CFG_PREFIX" #f) + (setenv "CFG_LIBDIR_RELATIVE" #f) + (invoke (string-append (assoc-ref inputs "rustc-boot= strap") "/tools/bin/minicargo") + "src/tools/cargo" "--vendor-dir" "src/vendor" + "-L" (string-append (assoc-ref inputs "rustc= -bootstrap") "/lib/mrust")) + #t)))))) + (native-inputs + (alist-replace "rustc-bootstrap" (list mrustc) + (package-native-inputs rust-1.23))))) + (define-public rust (let ((base-rust rust-1.23)) (package --MP_/8dDG6y4NVYlI03oWXNEQA85-- --Sig_/7KRIW1kaH6rpDhs8ugCr4py Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlq+v94ACgkQ5xo1VCww uqU8bQf/cw4oeHg1A29AJatj+CfiBG2j4xw8AYzeMdULGCIfC0nM31uD90vsanQd yNbUGsU3bb+2vZTmGwVXhLGeYZZSUl7PJLUJTIFQSQxHYHFZXN4klfU3qH18r2eV Ka6aoEjosuDn0ZdyAc583q2LxXcz7/KNSu9M1yQV28yO3RrJEaZnHMU2+Thj3HqR HaElNxImoWIexO4NXzbl3v+HNoQyV50opNsMwu6Ep0JmS7tmXbO1ByCjCWQfw0oZ LvfvAEkd7+7U1ToY/yGkEshWU5giRjfawkGuo+KYWhbmk9ilyKaAGnS2dL8Jsaep cZuVrw3l5s9wIvyb/Ozo9Lp5/F8z4w== =f6jd -----END PGP SIGNATURE----- --Sig_/7KRIW1kaH6rpDhs8ugCr4py--