-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search for cargo
in a more robust way
#100
Comments
Thanks for summarizing. I'm not totally against the idea, but I'm wondering if it's really "robust" to use |
Which do you use zsh or bash? You can check the default shell by https://scriptingosx.com/2017/04/about-bash_profile-and-bashrc-on-macos/ As I wrote on extendr/libR-sys#54, rustup modifies
I really don't understand why this happens when |
I note CRAN package cargo which apparently addresses this issue specifically for CRAN in view of its hands-off rule w.r.t. writing to user filesystem. |
@dcnorris Interesting! Looks like this was just released. |
It would be interesting to see what it does... |
Sorry for the lack of follow-up @yutannihilation!
That's a pretty good point, and I'm not sure what I'm suggesting would deal with it or if what has happened to my setup will end up being common. I'll play around a bit and see if that is true for my case.
zsh, but it seems all my profiles are correctly updated by
Very interesting indeed! It seems like it uses an approach like what I am suggesting here to find cargo |
Looking at the source code of that package it seems like a lot of if statements and system calls: https://github.com/cran/cargo/blob/master/R/cargo.R Looking at the source code of the Not sure if that's useful but those are my thoughts on seeing this. I would tend to agree with @yutannihilation that it's better to insist that users have installed |
A barrier (thus far) to getting the next version of precautionary (including now very fast Rust implementations of certain models) onto CRAN has been the CRAN policy that
This policy is violated by writing to Having adapted that script for use in |
I faced the same problem. For reference, gifski avoid this by setting https://github.com/r-rust/gifski/blob/6b86cc6b60abbc2294db821f27cae37413df70c2/src/Makevars#L10 |
Many thanks Hiroaki. In fact, as noted in this r-pkg-devel thread where I tried to spark some community conversation on this topic, I have indeed adoped your approach. |
Oh, glad that you already find the way! Sorry, I think I saw your message on R-pkg-devel mailing list, but I didn't know much at that time. I'm currently struggling to fix CRAN build failures of my package using Rust code, so I hope I can share my experience if I succeeds... |
So, I've got back onto CRAN at last https://CRAN.R-project.org/package=precautionary, but rather dire-sounding warnings have come in almost immediately (emphasis is mine):
Have you had experience with this type of response, Hiroaki? I don't actually see Rust mentioned by name in Writing R Extensions §1.6, but I will certainly look into the GNU extensions issue before reaching out on r-pkg-devel to discuss. |
@dcnorris Are you on the extendr discord channel? There have been a number of conversations around this exact topic recently. |
I'm not (yet); how would I join? |
Try this: https://discord.gg/7hmApuc |
Just a quick note: I've now had this issue on 4 different MacBooks and have never been able to resolve it more than superficially |
Sorry, I forgot to share here. On submitting my package to CRAN, I found this problem exists on CRAN macOS machine. I chose to source But this way might not very handy when you want to run $(STATLIB):
PATH="$(HOME)/.cargo/bin:$(PATH)" cargo build --release --manifest-path=myrustlib/Cargo.toml (https://github.com/r-rust/gifski/blob/6b86cc6b60abbc2294db821f27cae37413df70c2/src/Makevars#L12-L13) So, in short, I think we should add |
It seems we are about to invent something similar to the code that searches for Rtools installation in
|
I think this has adquately been addressed by @yutannihilation in #166 |
In extendr/libR-sys#54, we ended up discussing whether a
find_cargo()
helper might be useful, similar to blogdown'sfind_hugo()
If I understand @yutannihilation's point, it's that Rust, being a whole language, is inherently more complex tooling--including how it was installed--than a single binary like hugo, making this type of solution less obvious for Rust.
My point is that major methods of installation--particularly
rustup
--installcargo
in predictable places, and that it's sensible to check those places ifSys.which("cargo")
doesn't work. For instance, in my case,cargo
is in~/.cargo/bin
, right whererustup
put it.I was hoping to find the deeper problem in the original thread, but it's still not clear to me why my
PATH
in R doesn't have cargo but I do otherwise (e.g in the terminal), given that my installation and workflow is similar to others. I seem not to be alone, though. Notably, #99 lets me use rextendr successfully, but it's not clear to me how robust it is.The text was updated successfully, but these errors were encountered: