Open yanyu2015 opened 6 months ago
Strange that rust_sitrep()
does not report that you are missing a target. It should look something like this
What is the version of {rextendr}
that you use?
After I removed the required target (to get the screenshot above), I got like a million compilation errors in your example, which is expected. To solve this, run
rustup target add x86_64-pc-windows-gnu
rextendr::rust_sitrep()
#> Rust infrastructure sitrep:
#> ✔ "rustup": 1.26.0 (5af9b9484 2023-04-05)
#> ✔ "cargo": 1.72.1 (103a7ff2e 2023-08-15)
#> ℹ host: x86_64-pc-windows-msvc
#> ℹ toolchains: stable-i686-pc-windows-gnu, stable-x86_64-pc-windows-msvc
#> (default), nightly-x86_64-pc-windows-gnu, nightly-x86_64-pc-windows-msvc,
#> 1.60.0-x86_64-pc-windows-msvc, 1.64.0-x86_64-pc-windows-gnu,
#> 1.64.0-x86_64-pc-windows-msvc, and 1.71.1-x86_64-pc-windows-msvc
#> ℹ targets: x86_64-pc-windows-gnu and x86_64-pc-windows-msvc
rextendr::rust_function("fn add(a:f64, b:f64) -> f64 { a + b }")
#> ℹ build directory: 'C:/Users/.../AppData/Local/Temp/RtmpqiLYgf/file6dc45f862d81'
#> ✔ Writing 'C:/Users/.../AppData/Local/Temp/RtmpqiLYgf/file6dc45f862d81/target/extendr_wrappers.R'
add(42, 100500)
#> [1] 100542
It also could be because you do not have a default toolchain set through rustup
? You can try then first with
rustup default stable-msvc
followed by R
rextendr::rust_sitrep()
Now it can work properly. (After completing the above configuration, it may need to wait a moment before running rust_sitrep() to avoid potential issues of not finding rustup. Thank you.
I hope this helped. To {rextendr}
people -- I will keep this issue open & assigned to me because I want to investigate why there was no 'error' message when the default toolchain was not selected. We should be able to detect this and inform the user.
system:win11 R version:4.3.2
When I use the code in the example, I encounter the following error
It should be noted that rust is installed in the path D:\ds\Rusts\o\, and I have also configured the
path
.