[R-pkg-devel] Win-builder not finding binaries provided by LinkingTo: cargo?

David Norris d@v|d @end|ng |rom prec|@|onmethod@@guru
Tue Apr 6 21:09:02 CEST 2021

For version 0.2-2 of my ‘precautionary’ package, I have added fast numerical routines implemented in Rust.
In my DESCRIPTION file, I am “LinkingTo: cargo (>= 0.1.28)”, but fail incoming check on Win-builder as follows:

* installing *source* package 'precautionary' ...
** using staged installation
** libs

*** arch - i386
rm -Rf precautionary.dll ./rust/target/i686-pc-windows-gnu/release/libprecautionary.a entrypoint.o
d:/Compiler/rtools40/mingw32/bin/gcc  -I"D:/RCompile/recent/R/include" -DNDEBUG  -I'd:/RCompile/CRANpkg/lib/4.1/cargo/include'   -I"d:/Compiler/gcc-4.9.3/local330/include"     -pedantic -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c entrypoint.c -o entrypoint.o
cargo build --target=i686-pc-windows-gnu --lib --release --manifest-path=./rust/Cargo.toml
make: cargo: Command not found
make: *** [Makevars.win:11: rust/target/-pc-windows-gnu/release/libprecautionary.a] Error 127
ERROR: compilation failed for package 'precautionary'
* removing 'd:/RCompile/CRANincoming/R-devel/lib/precautionary'

As I understand the intention of package cargo https://CRAN.R-project.org/package=cargo, it aims to solve precisely this problem.
Other platforms check my package just fine.
Is the solution to be found in configuration of Win-builder, in my Makevars.win, or elsewhere?
I have taken my Makevars.win straight from https://github.com/extendr/helloextendr/blob/main/src/Makevars.win as follows:

TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu

LIBDIR = ./rust/target/$(TARGET)/release

STATLIB = $(LIBDIR)/libprecautionary.a

PKG_LIBS = -L$(LIBDIR) -lprecautionary -lws2_32 -ladvapi32 -luserenv

all: C_clean



        cargo build --target=$(TARGET) --lib --release --manifest-path=./rust/Cargo.toml


        rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS)


        rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) rust/target

	[[alternative HTML version deleted]]

More information about the R-package-devel mailing list