Closed
Description
I have cloned the helloextendr repo and run rextendr::document()
on a Windows 11 computer. This fails with
collect2.exe: error: ld returned 1 exit status
. Apparently, the linker could not find a reference to 'BCryptGenRandom'.
Maybe this issue is related to #19.
Here's the full protocol. My environment is shown below.
> rextendr::document()
i Generating extendr wrapper functions for package: helloextendr.
! No library found at src/helloextendr.dll, recompilation is required.
Re-compiling helloextendr
- installing *source* package 'helloextendr' ...
** using staged installation
** libs
rm -Rf helloextendr.dll ./rust/target/x86_64-pc-windows-gnu/release/libhelloextendr.a entrypoint.o
"C:/lib/R/Rtools40v2/mingw64/bin/"gcc -I"c:/PROGRA~1/R/R-41~1.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -UNDEBUG -Wall -pedantic -g -O0 -c entrypoint.c -o entrypoint.o
cargo build --target=x86_64-pc-windows-gnu --lib --release --manifest-path=./rust/Cargo.toml
Compiling winapi v0.3.9
Compiling proc-macro2 v1.0.35
Compiling unicode-xid v0.2.2
Compiling syn v1.0.84
Compiling extendr-engine v0.2.0
Compiling lazy_static v1.4.0
Compiling quote v1.0.10
Compiling libR-sys v0.2.2
Compiling extendr-macros v0.2.0
Compiling extendr-api v0.2.0
Compiling helloextendr v0.1.0 (C:\Users\Markus\Local-Docs\src\R\helloextendr\src\rust)
Finished release [optimized] target(s) in 18.18s
C:/lib/R/Rtools40v2/mingw64/bin/gcc -shared -s -static-libgcc -o helloextendr.dll tmp.def entrypoint.o -L./rust/target/x86_64-pc-windows-gnu/release -lhelloextendr -lws2_32 -ladvapi32 -luserenv -Lc:/PROGRA~1/R/R-41~1.2/bin/x64 -lR
C:/lib/R/Rtools40v2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ./rust/target/x86_64-pc-windows-gnu/release/libhelloextendr.a(std-57e8ea4e1cfb36e3.std.0253c85e-cgu.0.rcgu.o): in function `std::sys::windows::rand::hashmap_random_keys':
/rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\sys\windows/rand.rs:10: undefined reference to `BCryptGenRandom'
C:/lib/R/Rtools40v2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c\/library\std\src\sys\windows/rand.rs:10: undefined reference to `BCryptGenRandom'
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'helloextendr'
- removing 'C:/Users/Markus/AppData/Local/Temp/RtmpC6Z6MD/devtools_install_77644144103c/helloextendr'
Fehler in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command 'Rcmd.exe' failed, exit status: 1, stdout & stderr were printed
Type .Last.error.trace to see where the error occurred
rextendr
was freshly installed from github.
R version:
version.string R version 4.1.2 (2021-11-01)
R Tools:
The latest version (4.0v2) found on https://cran.r-project.org/bin/windows/Rtools/rtools40.html .
Rust:
>rustc -V
rustc 1.57.0 (f1edd0429 2021-11-29)
Prepared according to https://cran.r-project.org/bin/windows/Rtools/rtools40.html .
>rustup show
Default host: x86_64-pc-windows-gnu
rustup home: C:\Users\Markus\.rustup
installed targets for active toolchain
--------------------------------------
i686-pc-windows-gnu
i686-pc-windows-msvc
x86_64-pc-windows-gnu
x86_64-pc-windows-msvc
active toolchain
----------------
stable-x86_64-pc-windows-msvc (default)
rustc 1.57.0 (f1edd0429 2021-11-29)
Metadata
Metadata
Assignees
Labels
No labels