help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help exposing RLS output for rust.


From: Noah Evans
Subject: Help exposing RLS output for rust.
Date: Tue, 13 Oct 2020 19:00:53 +0000

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 via email to

[Prev in Thread] Current Thread [Next in Thread]