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

David Norris d@v|d @end|ng |rom prec|@|onmethod@@guru
Wed Apr 7 11:39:53 CEST 2021


My DESCRIPTION has the same “SystemRequirements: …” line as salso—from which I probably copied it.

I had briefly reached out to ‘cargo’ author (who is also ‘salso’ author), who indicated I might need to supply binaries.
Indeed, on closer look, salso appears to include the binaries, rather than asking CRAN to do the build:
https://www.r-project.org/nosvn/R.check/r-devel-windows-x86_64-gcc10-UCRT/salso-00check.html

Thus, it seems ‘precautionary’ presents an opportunity to get Rust compilation working on Win-builder.
Rust is such a fine language that it would be a shame not to smooth this out for the community.

OTOH, crucial calculations in ‘precautionary’ parallelize so nicely with mclapply() that it would not be inappropriate to bypass (forkless) Win by setting OS_type to unix.

From: Kevin Ushey <kevinushey using gmail.com>
Date: Tuesday, April 6, 2021 at 6:41 PM
To: David Norris <david using precisionmethods.guru>
Cc: "r-package-devel using r-project.org" <r-package-devel using r-project.org>
Subject: Re: [R-pkg-devel] Win-builder not finding binaries provided by LinkingTo: cargo?

I think this is the pertinent error:

make: cargo: Command not found

That is, make is assuming that the cargo utility is installed and
available on the PATH, but that doesn't appear to be true on the CRAN
winbuilder machine.

The salso package (https://cran.r-project.org/package=salso)
explicitly requires cargo to be already available, per
SystemRequirements:

SystemRequirements: Cargo (>= 1.42.0) for installation from sources:
see file INSTALL

so you probably need to do something similar. I'd also recommend
downloading the 'salso' package to see how they resolve this, or
contacting the 'salso' maintainer to see what steps they took to
ensure their package could build on CRAN.

Best,
Kevin

On Tue, Apr 6, 2021 at 12:10 PM David Norris
<david using precisionmethods.guru<mailto:david using precisionmethods.guru>> wrote:

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:
https://win-builder.r-project.org/incoming_pretest/precautionary_0.2-2_20210406_142130/Windows/00install.out

* 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



$(SHLIB): $(STATLIB)



$(STATLIB):

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



C_clean:

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



clean:

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


         [[alternative HTML version deleted]]

______________________________________________
R-package-devel using r-project.org<mailto:R-package-devel using r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list