all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Fries <fries1234@protonmail.com>
To: help-guix@gnu.org
Subject: help with runpaths for outputs
Date: Mon, 17 Jul 2023 01:06:25 +0000	[thread overview]
Message-ID: <12289394.O9o76ZdvQC@pc> (raw)

[-- Attachment #1: Type: text/plain, Size: 1823 bytes --]

so, i'm trying to upgrade the rust package to 1.71.0. i've gotten quite far 
and i have one little thing stopping me. rustfmt.

rustfmt seems to require the libstd and librustc shared library files, which 
rustc links to, but rustfmt's output doesn't include those shared library 
folders inside the rustfmt output. i want to know if i can depend on an output 
to get library files.

check the attachment for the patch file for rust 1.71. i plan on contributing 
this once this issue is fixed.

the error runs at the validate-runpath phase and this is the text of the 
error.

starting phase `validate-runpath'
validating RUNPATH of 0 binaries in "/gnu/store/
7rhn5g4m1bqps7n7av3z3fnix08iq85m-rust-1.71.0-rustfmt/lib"...
validating RUNPATH of 2 binaries in "/gnu/store/
7rhn5g4m1bqps7n7av3z3fnix08iq85m-rust-1.71.0-rustfmt/bin"...
/gnu/store/7rhn5g4m1bqps7n7av3z3fnix08iq85m-rust-1.71.0-rustfmt/bin/rustfmt: 
error: depends on 'librustc_driver-9ffe7c4ee4559b56.so', which cannot be found 
in RUNPATH ("/gnu/store/7rhn5g4m1bqps7n7av3z3fnix08iq85m-rust-1.71.0-rustfmt/
bin/../lib" "/gnu/store/9lc5nl027q8q9gd34bk85hqsxx554fan-llvm-15.0.7/lib" "/
gnu/store/930nwsiysdvy2x5zv1sf6v7ym75z8ayk-gcc-11.3.0-lib/lib/gcc/x86_64-
unknown-linux-gnu/11.3.0/../../.." "/gnu/store/
gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib")
/gnu/store/7rhn5g4m1bqps7n7av3z3fnix08iq85m-rust-1.71.0-rustfmt/bin/rustfmt: 
error: depends on 'libstd-f3697f373a6dea5e.so', which cannot be found in 
RUNPATH ("/gnu/store/7rhn5g4m1bqps7n7av3z3fnix08iq85m-rust-1.71.0-rustfmt/
bin/../lib" "/gnu/store/9lc5nl027q8q9gd34bk85hqsxx554fan-llvm-15.0.7/lib" "/
gnu/store/930nwsiysdvy2x5zv1sf6v7ym75z8ayk-gcc-11.3.0-lib/lib/gcc/x86_64-
unknown-linux-gnu/11.3.0/../../.." "/gnu/store/
gsjczqir1wbz8p770zndrpw4rnppmxi3-glibc-2.35/lib")

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rust-1.71-guix.patch --]
[-- Type: text/x-patch; name=rust-1.71-guix.patch, Size: 9798 bytes --]

diff --git a/gnu/packages/patches/rust-1.70-fix-rustix-build.patch b/gnu/packages/patches/rust-1.70-fix-rustix-build.patch
new file mode 100644
index 0000000..a7e2003
--- /dev/null
+++ b/gnu/packages/patches/rust-1.70-fix-rustix-build.patch
@@ -0,0 +1,20 @@
+--- a/vendor/fd-lock/Cargo.toml	2023-05-31 14:44:48.000000000 -0700
++++ b/vendor/fd-lock/Cargo.toml	2023-07-14 21:19:34.637702319 -0700
+@@ -45,7 +45,7 @@
+ 
+ [target."cfg(unix)".dependencies.rustix]
+ version = "0.37.0"
+-features = ["fs"]
++features = ["fs", "cc"]
+ 
+ [target."cfg(windows)".dependencies.windows-sys]
+ version = "0.45.0"
+--- a/src/bootstrap/Cargo.lock	2023-07-11 20:32:40.000000000 -0700
++++ b/src/bootstrap/Cargo.lock	2023-07-14 22:41:53.269284713 -0700
+@@ -618,6 +618,7 @@
+ dependencies = [
+  "bitflags",
++ "cc",
+  "errno",
+  "io-lifetimes",
+  "libc",
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 8e106a9..01ee400 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -122,6 +122,9 @@ (define* (rust-bootstrapped-package base-rust version checksum)
                     (alist-replace "rustc-bootstrap" (list base-rust)
                                    (package-native-inputs base-rust))))))
 
+
+
+
 ;;; Note: mrustc's only purpose is to be able to bootstap Rust; it's designed
 ;;; to be used in source form.
 (define %mrustc-commit "597593aba86fa2edbea80c6e09f0b1b2a480722d")
@@ -705,6 +708,81 @@ (define rust-1.68
   (rust-bootstrapped-package
    rust-1.67 "1.68.2" "15ifyd5jj8rd979dkakp887hgmhndr68pqaqvd2hqkfdywirqcwk"))
 
+(define rust-1.69
+  (let ((base-rust
+          (rust-bootstrapped-package
+           rust-1.68 "1.69.0" "03zn7kx5bi5mdfsqfccj4h8gd6abm7spj0kjsfxwlv5dcwc9f1gv")))
+    (package
+      (inherit base-rust)
+      (source
+        (origin
+          (inherit (package-source base-rust))
+          (snippet
+           '(begin
+              (for-each delete-file-recursively
+                        '("src/llvm-project"
+                          "vendor/tikv-jemalloc-sys/jemalloc"))
+              ;; Also remove the bundled (mostly Windows) libraries.
+              (for-each delete-file
+                        (find-files "vendor" ".*\\.(a|dll|exe|lib)$")))))))))
+
+(define rust-1.70
+ (let ((base-rust
+         (rust-bootstrapped-package
+          rust-1.69 "1.70.0" "0z6j7d0ni0rmfznv0w3mrf882m11kyh51g2bxkj40l3s1c0axgxj")))
+   (package
+     (inherit base-rust)
+     (source
+      (origin
+        (inherit (package-source base-rust))
+        ;; Rust 1.70 uses the rustix library which on Linux, it defaults to
+        ;; using outline ASM which without the cc cargo feature enabled, it
+        ;; will expect a precompiled binary library. This patch will enable the cargo
+        ;; cc feature flag inside the fd-lock vendored Cargo.toml file, which is the
+        ;; crate that uses rustix.
+        (patches (search-patches "rust-1.70-fix-rustix-build.patch"))
+        (patch-flags '("-p1"))))
+     (arguments
+       (substitute-keyword-arguments (package-arguments base-rust)
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (replace 'build
+            (lambda* (#:key parallel-build? #:allow-other-keys)
+              (let ((job-spec (string-append
+                               "-j" (if parallel-build?
+                                        (number->string (parallel-job-count))
+                                        "1"))))
+                (invoke "./x.py" job-spec "build" "--stage=1"
+                        "library/std"
+                        "src/tools/cargo")))))))))))
+
+(define rust-1.71
+ (let ((base-rust
+         (rust-bootstrapped-package
+          rust-1.70 "1.71.0" "15jc0d13cmrh2xvpkyyvsbwgn3w4klqiwf2wlgzfp22mvjmy8rx6")))
+   (package
+     (inherit base-rust)
+     (arguments
+       (substitute-keyword-arguments (package-arguments base-rust)
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (replace 'patch-cargo-checksums
+               (lambda _
+                 (substitute* '("Cargo.lock"
+                                "src/bootstrap/Cargo.lock"
+                                "src/tools/rust-analyzer/Cargo.lock"
+                                "src/tools/cargo/Cargo.lock")
+                   (("(checksum = )\".*\"" all name)
+                    (string-append name "\"" ,%cargo-reference-hash "\"")))
+                 (generate-all-checksums "vendor"))))))))))
+
+;;; Function to make creating a list to ignore tests a bit easier.
+(define (make-ignore-test-list strs)
+  (map (lambda (str)
+    (let ((ignore-string (format #f "#[ignore]\n~a" str)))
+      `((,str) ,ignore-string)))
+    strs))
+
 ;;; Note: Only the latest versions of Rust are supported and tested.  The
 ;;; intermediate rusts are built for bootstrapping purposes and should not
 ;;; be relied upon.  This is to ease maintenance and reduce the time
@@ -713,7 +791,7 @@ (define rust-1.68
 ;;; Here we take the latest included Rust, make it public, and re-enable tests
 ;;; and extra components such as rustfmt.
 (define-public rust
-  (let ((base-rust rust-1.67))
+  (let ((base-rust rust-1.71))
     (package
       (inherit base-rust)
       (outputs (cons "rustfmt" (package-outputs base-rust)))
@@ -748,23 +826,42 @@ (define-public rust
                     (which "env")))))
              (add-after 'unpack 'disable-tests-requiring-git
                (lambda _
-                 (substitute* "src/tools/cargo/tests/testsuite/new.rs"
-                   (("fn author_prefers_cargo")
-                    "#[ignore]\nfn author_prefers_cargo")
-                   (("fn finds_author_git")
-                    "#[ignore]\nfn finds_author_git")
-                   (("fn finds_local_author_git")
-                    "#[ignore]\nfn finds_local_author_git"))))
+                 (substitute* "src/tools/cargo/tests/testsuite/git.rs"
+                    ,@(make-ignore-test-list '("fn fetch_downloads_with_git2_first_then_with_gitoxide_and_vice_versa"
+                                             "fn git_fetch_cli_env_clean"
+                                             "fn git_with_cli_force"
+                                             "fn use_the_cli")))
+                  ;; Gitoxide tests seem to require the internet to run
+                  ;; and Guix build containers don't have the internet.
+                  (substitute* "src/tools/cargo/tests/testsuite/git_shallow.rs"
+                    ,@(make-ignore-test-list
+                      '("fn gitoxide_clones_git_dependency_with_shallow_protocol_and_git2_is_used_for_followup_fetches"
+                        "fn gitoxide_clones_registry_with_shallow_protocol_and_aborts_and_updates_again"
+                        "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_fetch_maintains_shallowness"
+                        "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_with_git2_fetch"
+                        "fn gitoxide_clones_registry_without_shallow_protocol_and_follow_up_fetch_uses_shallowness"
+                        "fn gitoxide_clones_shallow_two_revs_same_deps"
+                        "fn gitoxide_git_dependencies_switch_from_branch_to_rev"
+                        "fn gitoxide_shallow_clone_followed_by_non_shallow_update"
+                        "fn shallow_deps_work_with_revisions_and_branches_mixed_on_same_dependency")))
+                  (substitute* "src/tools/cargo/tests/testsuite/offline.rs"
+                    ,@(make-ignore-test-list '("fn gitoxide_cargo_compile_offline_with_cached_git_dep_shallow_dep")))
+                  (substitute* "src/tools/cargo/tests/testsuite/patch.rs"
+                    ,@(make-ignore-test-list '("fn gitoxide_clones_shallow_old_git_patch")))))
              (add-after 'unpack 'disable-tests-requiring-mercurial
                (lambda _
-                 (substitute*
-                   "src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs"
-                   (("fn simple_hg_ignore_exists")
-                    "#[ignore]\nfn simple_hg_ignore_exists"))
                  (substitute*
                    "src/tools/cargo/tests/testsuite/init/mercurial_autodetect/mod.rs"
-                   (("fn mercurial_autodetect")
-                    "#[ignore]\nfn mercurial_autodetect"))))
+                   ,@(make-ignore-test-list '("fn case")))
+                 (substitute*
+                  "src/tools/cargo/tests/testsuite/init/simple_hg/mod.rs"
+                  ,@(make-ignore-test-list '("fn case")))
+                 (substitute*
+                  "src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs"
+                  ,@(make-ignore-test-list '("fn case")))
+                 (substitute*
+                  "src/tools/cargo/tests/testsuite/new.rs"
+                  ,@(make-ignore-test-list '("fn simple_hg")))))
              (add-after 'unpack 'disable-tests-broken-on-aarch64
                (lambda _
                  (with-directory-excursion "src/tools/cargo/tests/testsuite/"
@@ -807,7 +904,7 @@ (define-public rust
                ;; We skip the test since it's drastically unlikely Guix's
                ;; packaging will introduce a bug here.
                (lambda _
-                 (delete-file "src/test/ui/parser/shebang/sneaky-attrib.rs")))
+                 (delete-file "tests/ui/parser/shebang/sneaky-attrib.rs")))
              (add-after 'unpack 'patch-process-tests
                (lambda* (#:key inputs #:allow-other-keys)
                  (let ((bash (assoc-ref inputs "bash")))

                 reply	other threads:[~2023-07-17  9:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12289394.O9o76ZdvQC@pc \
    --to=fries1234@protonmail.com \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.