[PATCH] gnu: rust: update rust to 1.22.1 and cargo to 1.23.0

  • Done
  • quality assurance status badge
Details
4 participants
  • Danny Milosavljevic
  • Jelle Licht
  • ng0
  • Nikolai Merinov
Owner
unassigned
Submitted by
Nikolai Merinov
Severity
normal
N
N
(name . Nikolai Merinov)(address . nikolai.merinov@member.fsf.org)(address . 29555@debbugs.gnu.org)
20171204070212.hhx2med4i7oidquh@abyayala
Attachment: file
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEqIyK3RKYKNfqwC5S4i+bv+40hYgFAlok8vQACgkQ4i+bv+40
hYglLw/9Htb6YR6/660A75QO33bomZXdCF7jIb0I9JuGXl4D+N+xcszTPxTTB0l4
VwcFDOgQz4R0dqBFTC7TVfIA86Sum+PYpvKoy0vjNA+u8V+lcjIu5UlCxQzK+3QV
LWfkpPCqvlnoLDeOzy2KiCh2rErdiP5onp09SsX7djEgqZnAQFAsM0s8PZv9UHqg
7dlJJVlFFRCs/7Irt1dswySr2hvdltgvgrt04HvSZRG5igp5sjHDrPx4usgKZA+g
LGcwxeaih4SI3KDqIPxJNY2Cy4aZwdCN4TMXGlrhhUucQtFGtuIDtnjh7XISheCD
CopSZBYSsLCuRJuBcStylGzTJ465yNmzMIxONYCiOEcEwYx95ynA2VFpQRFnry2T
QRujL9pNJDGadlGHOuMQs4Ub5eved8B4Odw4XPe9u1lbwxubEIASmEqXPgLGPvH1
eiWY1f48jVUOOPl1WZOGAvPJ4DZL9rQ9hcdQOKNotVS3EgRwt0QE0J2Uxq2Vq+Xm
861736irLQ3VbGz8sX3/ZhwN8lYN0y7Wysd/uo6vXtUawfcrxPbV7V65dUhrq/bJ
QBtGTHyO74e2WAt1HtRl9sx0+qf2yPX6kaDGYIR+SB4dzJeoHs/2qwxY4RKFcj0z
eGiNQkRLOlUV3hPd/x21Ol1v/TUY8R00vhDMHHMJlfO/xaNHoBc=
=bO4b
-----END PGP SIGNATURE-----


J
J
Jelle Licht wrote on 4 Dec 2017 15:33
(name . Nikolai Merinov)(address . nikolai.merinov@member.fsf.org)(address . 29555@debbugs.gnu.org)
CAPsKtf+Af4PhX7tzd0uyv9ngMcGysuT7MXALbAh+b-TqB3qEAw@mail.gmail.com
2017-12-03 20:01 GMT+01:00 Nikolai Merinov <nikolai.merinov@member.fsf.org>:

Toggle quote (4 lines)
> Update for a rustc and cargo packages. This update will also fix a
> build.
>
>
I do not have enough know-how to properly review your patch, but at least I
can verify it seems to work.
I was able to build rustc and cargo succesfully with your patches, and was
able to build and run a trivial hello world program written in rust.
When this patch is merged, I think we can also close
will no longer be relevant.
Attachment: file
N
N
Nikolai Merinov wrote on 4 Dec 2017 15:54
(name . Jelle Licht)(address . jlicht@fsfe.org)
558D9F77-E950-4D77-86A3-4B633C0E2009@member.fsf.org
I added "-lstdc++" to rust standard lib to overcome issue. Which solution is better:
1. change link flags for rust standard library, or
2. create rust-specific jemalloc as suggested in #29522?

4 ??????? 2017 ?. 19:33:31 GMT+05:00, Jelle Licht <jlicht@fsfe.org> ?????:
Toggle quote (17 lines)
>2017-12-03 20:01 GMT+01:00 Nikolai Merinov
><nikolai.merinov@member.fsf.org>:
>
>> Update for a rustc and cargo packages. This update will also fix a
>> build.
>>
>>
>I do not have enough know-how to properly review your patch, but at
>least I
>can verify it seems to work.
>I was able to build rustc and cargo succesfully with your patches, and
>was
>able to build and run a trivial hello world program written in rust.
>When this patch is merged, I think we can also close
>http://lists.gnu.org/archive/html/bug-guix/2017-12/msg00006.html, as it
>will no longer be relevant.

--
Nikolai Merinov
Attachment: file
D
D
Danny Milosavljevic wrote on 4 Dec 2017 17:05
(name . Nikolai Merinov)(address . nikolai.merinov@member.fsf.org)
20171204170506.75f2ce36@scratchpost.org
Hi,

On Mon, 04 Dec 2017 19:54:13 +0500
Nikolai Merinov <nikolai.merinov@member.fsf.org> wrote:

Toggle quote (3 lines)
> I added "-lstdc++" to rust standard lib to overcome issue. Which solution is better:
> 1. change link flags for rust standard library, or

Sounds hacky and I'm not sure why it helps or whether it will keep working.

Toggle quote (2 lines)
> 2. create rust-specific jemalloc as suggested in #29522?

I vote for using a rust-specific jemalloc without the C++ parts (named "jemalloc-without-c++" or something, it just has to pass a flag to "configure"). It's smaller, too. Any downsides?
N
N
N
Nikolai Merinov wrote on 10 Dec 2017 00:16
[bug#29555] [PATCHv3] gnu: rust: update rust to 1.22.1 and cargo to 1.23.0
(address . 29555@debbugs.gnu.org)
87bmj7mqz8.fsf_-_@member.fsf.org
Hi,

Please find last update for patch that update rust and cargo in attachements.

Changes from last time:
1. Replaced jemalloc to 4.5.0 release according to
2. Added code that reset timestamps for rust build. When we change files
(through "substitute*" or with any other methods) their mtime changes,
but mtimes influent packages fingerprint and, as result,
"rust.metadata.bin" in "liblibc-<hash>.rlib" become not reproducible.

Currently rustc build is reproducable.

Full list of changes from rustc 1.16:

1. Added GDB as test dependency
2. Added LLVM_LINK_SHARED environment variable to link with shared llvm
libraries (because there is no static libraries in guix llvm-3.9.1
package
3. rustc in 1.22.1 release try to find "ar" binary in same directory as
"gcc", but there is only "gcc-ar" in such place. *NOTE*: In next rust
release function "cc2ar" will be removed from and this "substitute*" will
be replaced with new option in config.toml
4. Ignored new test "connect_timeout_unroutable". This test failed in
container because there is no network.
5. Fixed bug in "up_to_date" function in "src/build_helper/lib.rs". This
fix already merged to rust repo in "master" branch.
6. Allow to fix shebangs in vendored sources. For this purpose was added
"patch-cargo-checksums" task that recreate ".cargo-checksum.json" for
all vendored sources and patch "src/Cargo.lock" to use patched vendored
sources.
7. Configuration performed through "config.toml" file instead of
obsolete "./configre" script.
8. Codegen tests was disabled, because 2 tests codegen/mainsubprogram.rs
and codegen/mainsubprogramstart.rs created for llvm with patch
backported from llvm 4.
9. After all this changes timestamps for sources resetted to achieve
reproducable build.
10. Build, test and installation preformed through new "./x.py" script
instead of obsolet makefiles generated by "./configure".

Full list of changes from cargo 1.17:
1. Tests was enabled!
2. New dependency for tests "git" utility.
3. Rust dependencies was updated from actual cargo's "Cargo.lock" file.
4. Return all "patch-*-shebngs" tasks. Without this patches some of
cargo dependencies fail to compile.
5. Recalculate ".cargo-checksum.json" files for all patched vendored
sources and update "Cargo.lock" to use this patched vendored sources.
6. Patch usage of "/usr/bin/env" in tests.
7. Disable next tests:
* "wasm32_final_outputs" failed to call llvm for
"asmjs-unknown-emscripten" architecture.
* "ctrl_c_kills_everyone" fail in container because of network.
* Added "CFG_DISABLE_CROSS_TESTS" to disable cross-compilation
tests. Not fully understand issue with this tests, but according to
cargo sources "This failure can be safely ignored".
D
D
Danny Milosavljevic wrote on 10 Dec 2017 10:27
(name . Nikolai Merinov)(address . nikolai.merinov@member.fsf.org)
20171210102719.0c6198c2@scratchpost.org
Wow! Nice.

Review below:

+ ;; guix llvm-3.9.1 package install only shared libraries

"installs"

+ (setenv "LLVM_LINK_SHARED" "1")

+ (add-after 'patch-source-shebangs 'patch-cargo-checksums
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "src/Cargo.lock"
+ (("(\"checksum .* = )\".*\"" all name)
+ (string-append name "\"" ,%cargo-reference-hash "\"")))
+ (for-each
+ (lambda (filename)
+ (use-modules (guix build cargo-build-system))
+ (delete-file filename)
+ (let* ((dir (dirname filename)))
+ (display (string-append
+ "patch-cargo-checksums: generate-checksums for "
+ dir "\n"))
+ (generate-checksums dir ,%cargo-reference-project-file)))
+ (find-files "src/vendor" ".cargo-checksum.json"))))

Hmm, should return #t on success.

- (add-after 'install 'wrap-rustc
+ (jemalloc (assoc-ref inputs "jemalloc")))
+ (call-with-output-file "config.toml"
+ (lambda (port)
+ (display (string-append "
+[llvm]
+[build]
+cargo = \"" cargo "/bin/cargo" "\"
+rustc = \"" rustc "/bin/rustc" "\"
+python = \"" python "/bin/python2" "\"
+gdb = \"" gdb "/bin/gdb" "\"
+vendor = true
+submodules = false
+[install]
+prefix = \"" out "\"
+[rust]
+default-linker = \"" gcc "/bin/gcc" "\"
+default-ar = \"" binutils "/bin/ar" "\"
+channel = \"stable\"
+rpath = true
+# There is 2 failed codegen tests:
+# codegen/mainsubprogram.rs and codegen/mainsubprogramstart.rs
+# This tests required patched LLVM
+codegen-tests = false
+[target." %host-type "]
+llvm-config = \"" llvm "/bin/llvm-config" "\"
+cc = \"" gcc "/bin/gcc" "\"
+cxx = \"" gcc "/bin/g++" "\"
+jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
+[dist]
+") port))))))

Should return #t on success.

+ (add-before 'build 'reset-timestamps-after-changes
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (define ref (stat "README.md"))
+ (for-each
+ (lambda (filename)
+ (set-file-time filename ref))
+ (find-files "." #:directories? #t))))

Same

+ (add-after 'patch-generated-file-shebangs 'patch-cargo-checksums
(lambda* (#:key inputs #:allow-other-keys)
- (let* ((gcc (assoc-ref inputs "gcc"))
- (cc (string-append gcc "/bin/gcc")))
- (mkdir ".cargo")
- (call-with-output-file ".cargo/config"
- (lambda (p)
- (format p "
+ (substitute* "Cargo.lock"
+ (("(\"checksum .* = )\".*\"" all name)
+ (string-append name "\"" ,%cargo-reference-hash "\"")))
+ (for-each
+ (lambda (filename)
+ (use-modules (guix build cargo-build-system))
+ (delete-file filename)
+ (let* ((dir (dirname filename)))
+ (display (string-append
+ "patch-cargo-checksums: generate-checksums for "
+ dir "\n"))
+ (generate-checksums dir ,%cargo-reference-project-file)))
+ (find-files "vendor" ".cargo-checksum.json"))))

Same

+ (replace 'configure
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (substitute* "tests/build.rs"
+ (("/usr/bin/env") (which "env"))
+ ;; Guix llvm compiled without asmjs-unknown-emscripten at all
+ (("fn wasm32_final_outputs") "#[ignore]\nfn wasm32_final_outputs"))
+ (substitute* "tests/death.rs"
+ ;; Stuck when built in container
+ (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone"))
+ (mkdir ".cargo")
+ (call-with-output-file ".cargo/config"
+ (lambda (port)
+ (display "
[source.crates-io]
replace-with = 'vendored-sources'
[source.vendored-sources]
directory = 'vendor'
-")))
- (setenv "CMAKE_C_COMPILER" cc)
- (setenv "CC" cc))
- #t))
- (delete 'configure))))
+" port)))
+ ;; Disable test for cross compilation support
+ (setenv "CFG_DISABLE_CROSS_TESTS" "1")
+ (setenv "SHELL" (which "sh"))
+ (setenv "CONFIG_SHELL" (which "sh"))
+ (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc")))))))

Same
N
D
D
Danny Milosavljevic wrote on 11 Dec 2017 00:17
(no subject)
(address . control@debbugs.gnu.org)
20171211001751.00e7e22f@scratchpost.org
close 29555
?
Your comment

This issue is archived.

To comment on this conversation send an email to 29555@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 29555
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch