Hello,
we have written an R package that uses JAGS and requires a JAGS module
that's distributed with the package. We had a lot of problems making
the installation work across platforms and we adapted the way it's done in
'runjags' (it also contains a JAGS module). However, we are having two
problems:
1) the CMD CHECK returns this warning
Check: for GNU extensions in Makefiles, Result: WARNING
Found the following file(s) containing GNU extensions:
src/Makevars
src/Makevars.in
Portable Makefiles do not use GNU extensions such as +=, :=, $(shell),
$(wildcard), ifeq ... endif, .NOTPARALLEL See section 'Writing portable
packages' in the 'Writing R Extensions' manual.
2) the package installation works only from the source. For example,
devtools::install_github() returns an error since .o files are generated
inside of the package folder. A similar problem occurs when generating the
source .tar.gz, however, manually deleting the .o files from it fixes
the problem and it can be used for installing the package.
I wanted to ask how should I proceed. Can I submit the package to cran with
this warning? We verified that the installation from source works on
Windows, macOS, and Linux.
Thank you very much,
Franti?ek Barto?
github link: https://github.com/FBartos/RoBMA
the makevars.win file:
#Set a default value for JAGS_ROOT in case the user hasn't set it, this
location was specified by the CRAN-team (according to runjags, where I
copied this from)
JAGS_ROOT ?= c:/progra~1/JAGS/JAGS-4.3.0
## Use the old ABI to match JAGS 4.x compilation on Windows:
PKG_CXXFLAGS = -D_GLIBCXX_USE_CXX11_ABI=0
PKG_CPPFLAGS=-I"$(JAGS_ROOT)/include"
PKG_LIBS=-L"$(JAGS_ROOT)/${R_ARCH}/bin" -ljags-4 -ljrmath-0
# Actual sources and objects for RoBMA
SOURCES= $(wildcard *.cc) $(wildcard */*.cc)
OBJECTS=$(SOURCES:.cc=.o)
the makevars.in file:
PKG_CPPFLAGS=@JAGS_CFLAGS@
PKG_LIBS=@JAGS_LIBS@ @JAGS_RPATH@
SOURCES= $(wildcard *.cc) $(wildcard */*.cc)
OBJECTS=$(SOURCES:.cc=.o)
[R-pkg-devel] package installation and linking with JAGS
2 messages · Frantisek Bartos, Ivan Krylov
On Wed, 8 Jul 2020 11:06:31 +0200
Frantisek Bartos <f.bartos96 at gmail.com> wrote:
Check: for GNU extensions in Makefiles, Result: WARNING
This warning is easy to deal with:
JAGS_ROOT ?= c:/progra~1/JAGS/JAGS-4.3.0
Use plain "=" macro definitions, since others aren't considered portable enough.
SOURCES= $(wildcard *.cc) $(wildcard */*.cc)
Replace $(wildcard ...) with hard-coded lists of files. See the POSIX standard [*], or, indeed, section 'Writing portable packages' in WRE [**] for a list of Make features considered portable. Alternatively, add "GNU make" to SystemRequirements: in your DESCRIPTION. This will silence the warnings, but require the GNU flavour of Make to install your package.
2) the package installation works only from the source. For example, devtools::install_github() returns an error since .o files are generated inside of the package folder. A similar problem occurs when generating the source .tar.gz, however, manually deleting the .o files from it fixes the problem and it can be used for installing the package.
How do you build the source package before installing it? I tried to git clone your package, then R CMD build . it, and got a perfectly valid RoBMA_0.0.0.9000.tar.gz without any *.o files inside. I *think* that R CMD INSTALL <directory> may be not a good idea, but you can add .*\.o$ to .Rbuildignore to prevent the object files from getting inside your source package this way.
[[alternative HTML version deleted]]
Also, please don't post in HTML.