PRQL / prqlc-r

R Bindings for the prqlc
https://prql.github.io/prqlc-r/
Other
53 stars 2 forks source link

prqlr fails to compile on Linux arm64 #88

Closed andresrcs closed 1 year ago

andresrcs commented 1 year ago

prqlr complains about the Rust version that comes from the OS repositories on Debian-based distros (tried with Ubuntu 22.04 LTS and RPi OS) but even after installing the latest Rust version with rustup (which solves the problem for Linux amd64) compilation still fails on arm64 with this error message.

 --- stderr
  thread 'main' panicked at 'Cannot find libR-sys bindings file for R 4.2.2false on linux in bindings. Consider compiling with --features use-bindgen.', /tmp/RtmpjWO0lb/R.INSTALL463401756134e/prqlr/src/.cargo/registry/src/github.com-1ecc6299db9ec823/libR-sys-0.3.0/build.rs:448:13
eitsupi commented 1 year ago

Thank your for letting me know about that!

I believe this is actually an extendr issue, since this package does not use libR-sys directly. What happens if you install another package that uses extendr, like https://github.com/extendr/helloextendr? (sorry, I can't try this right now)

andresrcs commented 1 year ago

What happens if you install another package that uses extendr, like https://github.com/extendr/helloextendr? (sorry, I can't try this right now)

Sadly, I get the same error message. My hope was that compilation options for cargo were set by you and you could simply add --features use-bindgen to the Makevars file.

eitsupi commented 1 year ago

Those files come from rextendr. Could you please create an issue on rextendr or libR-sys?

andresrcs commented 1 year ago

The problem is both rextender and libR-sys (even with --features use-bindgen) compile just fine on arm64 so I don't know on what basis I can open an issue there since I'm not familiar with the Rust language.

eitsupi commented 1 year ago

I created a PR to add libR-sys bindings for linux/arm64 (extendr/libR-sys#133)

andresrcs commented 1 year ago

The new libR-sys 0.4.0 release, which includes the aarch64 bindings, is available now but when installing prqlr it keeps downloading version 0.3.0. I guess this comes from rextendr?

eitsupi commented 1 year ago

The version of extendr is fixed here. This needs to be updated.

https://github.com/eitsupi/prqlr/blob/0d315ec23e5545e8989532c598c02110e1451a57/src/rust/Cargo.toml#L13

eitsupi commented 1 year ago

It appears that extendr 0.4.0 has not yet been released to crates.io. https://crates.io/crates/extendr-api

eitsupi commented 1 year ago

90 should allow installation on arm64 Linux.

andresrcs commented 1 year ago

I tested it on RPi OS, and it is working great! Do you have an estimate for a CRAN release? I would like to have this added to the R4Pi project to have a binary for RPi OS

eitsupi commented 1 year ago

Do you have an estimate for a CRAN release? I would like to have this added to the R4Pi project to have a binary for RPi OS

Wow, that's fantastic! This is a serious bug fix and I will try to submit it to CRAN in the next few days.

eitsupi commented 1 year ago

prqlr 0.2.1 is now on CRAN.

andresrcs commented 1 year ago

Now compilation fails on RPi OS because of the cargo version

cargo build --lib --release --manifest-path=./rust/Cargo.toml --target-dir ./rust/target error: failed to parse manifest at `/tmp/RtmpO4x1Jc/R.INSTALL1806e2c2bf6d7/prqlr/src/rust/Cargo.toml` Caused by: failed to parse the `edition` key Caused by: this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions. make: *** [Makevars:16: rust/target/release/libprqlr.a] Error 101 ERROR: compilation failed for package ‘prqlr’

It would be possible for you to lower the version requirement?

eitsupi commented 1 year ago

Now compilation fails on RPi OS because of the cargo version

cargo build --lib --release --manifest-path=./rust/Cargo.toml --target-dir ./rust/target error: failed to parse manifest at `/tmp/RtmpO4x1Jc/R.INSTALL1806e2c2bf6d7/prqlr/src/rust/Cargo.toml` Caused by: failed to parse the `edition` key Caused by: this version of Cargo is older than the `2021` edition, and only supports `2015` and `2018` editions. make: *** [Makevars:16: rust/target/release/libprqlr.a] Error 101 ERROR: compilation failed for package ‘prqlr’

It would be possible for you to lower the version requirement?

The version of Rust is too old (older than 1.56 !?). It is not possible to support that version because many dependent packages do not support it.

The Rust version of Debian stable is too old, so if you install it with apt, you will need to install from testing at least.

andresrcs commented 1 year ago

I see, I'll try to convince Mark (from R4Pi) to install Rust with rustup.

rustup installs per user and when I used prqlr on RStudio with my personal user rather than Pi, it worked normally. As far as I can tell, once the package is installed an up to date Rust version is no longer required right?

eitsupi commented 1 year ago

I see, I'll try to convince Mark (from R4Pi) to install Rust with rustup.

Thank you for doing this. The Rust version of Debian stable is really too old... (See #49) Ubuntu is currently 1.61, which is much newer than Debian stable, but still quite old and prql-compiler cannot be installed.

I am currently continuing to patch prql-compiler with every release of prqlr to make it buildable on older Rust versions.......

rustup installs per user and when I used prqlr on RStudio with my personal user rather than Pi, it worked normally. As far as I can tell, once the package is installed an up to date Rust version is no longer required right?

Yes, it is required at source code build time.

andresrcs commented 1 year ago

FYI, a binary for aarch64 is available now in the R4Pi package repository.

It took a little while because we had to figure out some infrastructure management issues to make sure Rust can be installed consistently in the builder server without manual intervention.

eitsupi commented 1 year ago

@andresrcs Awesome! Thank you for working on that!

eitsupi commented 11 months ago

@andresrcs FYI, prqlr can be source install without Rust now. If you don't mind using pre-built binaries, you should be able to get a fast install on the Raspberry Pi by trying something like the following, as described in the README.

Sys.setenv(NOT_CRAN = "true")
install.packages("prqlr")
andresrcs commented 11 months ago

Thanks for the heads up. I do not compile prqlr on the Pi any more since I use the R4Pi project for binaries but I'll let them know Rust is no longer mandatory for the building tool chain