unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Noah Evans <noah@nevans.me>
To: "help-guix@gnu.org" <help-guix@gnu.org>
Subject: Help exposing RLS output for rust.
Date: Tue, 13 Oct 2020 19:00:53 +0000	[thread overview]
Message-ID: <mGDItttjvUkS6o-Km3Tm3C6zD9aHHxrpKzmBF0yCACdJBYR-fFk4kRbWB4H0XajNfpReIFW9gMyiRz_iFTbPtc8Md8S_3j2hoi28wpjTtdE=@nevans.me> (raw)

Hi, I'm trying to expose the RLS as an output of rust. Here's what I have so far:
(outputs `("out" "cargo" "doc" "rls"))
(arguments
(substitute-keyword-arguments (package-arguments base-rust)
((#:phases phases)
`(modify-phases ,phases
(add-after 'patch-tests 'patch-rls-tests
(lambda _
(substitute* "src/tools/rls/tests/client.rs"
(("fn client_dependency_typo_and_fix") "#[ignore]\nfn client_dependency_typo_and_fix"))))
(add-before 'build 'enable-extended
(lambda _
(substitute* "config.toml"
(("[[]install[]]") "extended = true\nconfigure-args = ['--enable-extended']\ntools = ['cargo', 'rls']\n[install]"))))
(add-after 'check 'check-rls
(lambda _
(invoke "./x.py" "test" "src/tools/rls")))
(add-after 'mkdir-prefix-paths 'mkdir-rls-prefix-path
(lambda* (#:key outputs #:allow-other-keys)
(mkdir-p (assoc-ref outputs "rls"))))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(invoke "./x.py" "install")
(substitute* "config.toml"
;; replace prefix to specific output
(("prefix = \"[^\"]*\"")
(string-append "prefix = \"" (assoc-ref outputs "cargo") "\"")))
(invoke "./x.py" "install" "cargo")
(substitute* "config.toml"
;; replace prefix to specific output
(("prefix = \"[^\"]*\"")
(string-append "prefix = \"" (assoc-ref outputs "rls") "\"")))
(invoke "./x.py" "install" "rls")))))))

RLS successfully builds, but then I get this error:
/gnu/store/0pc5460zxsmfh6cdbxy1l0sfnsrm7cci-rust-1.46.0-rls/bin/.rls-real: error: depends on 'librustc_driver-9cf72d79803ac5f1.so', which cannot be found in RUNPATH....
/gnu/store/0pc5460zxsmfh6cdbxy1l0sfnsrm7cci-rust-1.46.0-rls/bin/.rls-real: error: depends on 'libstd-778138f03c18c90e.so', which cannot be found in RUNPATH....

I know this means that it needs the rust/lib folder in it's RUNPATH, because that's where those libraries are. The problem is since RLS and rust (OUT) are both outputs of the same package, I don't really understand how to make RLS see those files. I'd think that rust would need to be an input to RLS, but I don't see how I could do that.

I tried this as a quick hack, but unsurprisingly it didn't work:
(add-after 'wrap-rustc 'wrap-rls
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "rls"))
(rust (assoc-ref outputs "out"))
(ld-wrapper (assoc-ref inputs "ld-wrapper")))
(wrap-program (string-append out "/bin/rls")
`("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
`("LIBRARY_PATH" ":" suffix (,(string-append rust "/lib"))))
#t)))

I'm pretty stumped, I'd appreciate any advice, Thanks!

                 reply	other threads:[~2020-10-13 19:37 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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to='mGDItttjvUkS6o-Km3Tm3C6zD9aHHxrpKzmBF0yCACdJBYR-fFk4kRbWB4H0XajNfpReIFW9gMyiRz_iFTbPtc8Md8S_3j2hoi28wpjTtdE=@nevans.me' \
    --to=noah@nevans.me \
    --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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).