unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Help exposing RLS output for rust.
@ 2020-10-13 19:00 Noah Evans
  0 siblings, 0 replies; only message in thread
From: Noah Evans @ 2020-10-13 19:00 UTC (permalink / raw)
  To: help-guix@gnu.org

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!

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-13 19:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 19:00 Help exposing RLS output for rust Noah Evans

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).