Skip to content
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

Cannot Install without Rust Toolchain #14

Open
jaredlander opened this issue Aug 8, 2024 · 6 comments
Open

Cannot Install without Rust Toolchain #14

jaredlander opened this issue Aug 8, 2024 · 6 comments

Comments

@jaredlander
Copy link

The instructions at https://valve.josiahparry.com/ make it seem like the R package can be installed without the Rust toolchain. It fact, it says that the binaries exist for Linux.

It is available as a binary for Windows, Linux, and MacOSX thanks to R-universe.

But when you install the package without having the Tust toolchain

install.packages("valve", repos = c("https://josiahparry.r-universe.dev", "https://cloud.r-project.org"))

you get this error

trying URL 'https://josiahparry.r-universe.dev/src/contrib/valve_0.1.3.tar.gz'
Content type 'application/x-gzip' length 300036 bytes (293 KB)
==================================================
downloaded 293 KB

* installing *source* packagevalve...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0rm -Rf valve.so ./rust/target/release/libvalve.a entrypoint.o
/usr/bin/gcc -I"/opt/R/4.4.0/lib/R/include" -DNDEBUG   -I/usr/local/include    -fpic  -g -O2  -c entrypoint.c -o entrypoint.o
# In some environments, ~/.cargo/bin might not be included in PATH, so we need
# to set it here to ensure cargo can be invoked. It is appended to PATH and
# therefore is only used if cargo is absent from the user's PATH.
if [ "" != "true" ]; then \
	export CARGO_HOME=/tmp/RtmpFH3uJ7/R.INSTALL2214c4bc818f5/valve/src/.cargo; \
fi && \
	export PATH="/home/jared/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/bin:/opt/quarto/bin:/usr/lib/rstudio-server/bin/postback:/home/jared/.cargo/bin" && \
	cargo build --lib --bin valve --release --manifest-path=./rust/Cargo.toml \
		--target-dir ./rust/target && \
		cp ./rust/target/release/valve ../inst;
/bin/bash: line 5: cargo: command not found
make: *** [Makevars:16: rust/target/release/libvalve.a] Error 127
ERROR: compilation failed for packagevalve* removing/home/jared/projects/fakeapi/renv/library/linux-ubuntu-jammy/R-4.4/x86_64-pc-linux-gnu/valveThe downloaded source packages are in/tmp/Rtmpm4Owqx/downloaded_packagesWarning message:
In utils::install.packages("valve", repos = c("https://josiahparry.r-universe.dev",  :
  installation of packagevalvehad non-zero exit status

This makes it look like it is compiling. And I can confirm that after installing rustup that the package compiles, installs, can be loaded and has the valve executable.

So it seems like the binaries are not being served by R-Universe.

@JosiahParry
Copy link
Owner

Thanks, Jared! May I ask what version of R you're using? From what I can see r-universe has binaries for 4.3, 4.4, and 4.5

@jaredlander
Copy link
Author

Tried on both 4.4.0 and 4.4.1.

@jaredlander
Copy link
Author

4.4.0 was on R installed directly on my Ubuntu 22 machine and 4.4.1 was inside the rstudio/plumber:v1.2.0 image which is Ubuntu 22.04.4.

@JosiahParry
Copy link
Owner

Sorry for the delay in getting back to you. I was busy moving cross country!

I can reproduce this. You can install the binary directly with:

FROM rstudio/plumber:v1.2.0
ENTRYPOINT ["R"]

Build it with

docker build -t test . && docker run -it test

Install binary directly

install.packages("https://josiahparry.r-universe.dev/bin/linux/noble/4.4/src/contrib/valve_0.1.3.tar.gz")

@JosiahParry
Copy link
Owner

Coming back to this a bit more. The case of r-universe not providing useful binaries is unfortunate and means that r-universe doesn't address the gap that i thought it did.

In the case of valve would precompiled binaries for the cli tool be useful? The R package is a bit tougher to do, though. I'll think that through.

@jaredlander
Copy link
Author

I think my workaround was to do something with the CLI, so that's not the end of the world, for my use case at least.

For the R binaries, could you use a matrix in GitHub actions to build binaries for a bunch of different OSes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants