Dear all, I am currently in the process of releasing this github package on CRAN:
https://github.com/lbusett/MODIStsp , but I am encountering some issues which I hope someone can help me overcome. Sorry for the long message, but the problem is difficult to explain briefly. Also, since this is my first CRAN release attempt, please excuse me if I'm asking something obvious. The problem I'm having derives from the fact that I'm using package `gWidgetsRGtk2` to create a GUI. However, `gWidgetsRGtk2` depends on package `RGtk2`, which itself requires some external libraries to work. This leads to the following problems: On Windows If I keep `gWidgetsRGtk2` in the dependency list of my package, checking it in RStudio goes well. I get no NOTES nor WARNINGS (provided I have all dependencies installed). > R CMD check results 0 errors | 0 warnings | 0 notes R CMD check > succeeded Also `build_win` passes with no problems However, if I then try to install the package from github, and even if `gWidgetsRGtk2` is already installed in my library, installation fails. For example: devtools::install_github("lbusett/MODIStsp", ref = 'feature/cran_rel_candidate') gives me the following error: > Warning: Failed to load RGtk2 dynamic library, attempting to install > it. Please install GTK+ from > http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip > If the package still does not load, please ensure that GTK+ is > installed and that it is on your PATH environment variable IN ANY > CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN Error in > inDL(x, as.logical(local), as.logical(now), ...) : unable to load > shared object > 'C:/Users/lb/Documents/R/win-library/3.3/RGtk2/libs/x64/RGtk2.dll': > LoadLibrary failure: Impossible to find..... , and I get an information window telling me that "libaptk-1.0-0.dll" is missing. Pressing "ok" on the message sends me in an infinite loop of attempted installations of `RGTk2` and I have to force-close RStudio. The only way I managed to install the package correctly from github is by: 1) Removing the `gWidgetsRGtk2` dependency from my package, and 2) Asking users to install `gWidgetsRGtk2` beforehand and load it at least once. At first loading of that package, after the "libaptk-1.0-0.dll is missing" message, this info panel opens, allowing me to install GTK+ libraries. After installing, continuing my pakages' installation goes well So, for example, this: install.packages("gWidgetsRGtk2") library("gWidgetsRGtk2") # wait for install of GTK+ install_github("lbusett/MODIStsp", ref = 'devel') # (In devel, 'gWidgetsRGtk2'is not a dependency) works with no issues. Asking the user to install the ""offending package beforehand is no big deal, but I don't know if that is admissible for a CRAN package, also because checking the package after removing the dependency gives me the following warning: > checking dependencies in R code ... WARNING 'loadNamespace' or > 'requireNamespace' call not declared from: ‘gWidgetsRGtk2’ R CMD check > results 0 errors | 1 warning | 0 notes > > R CMD check succeeded So, in the end my question is: Do you know if there is a way to solve this problem, or how should I deal with it in the process of making a CRAN release ? On Linux On Linux builds, the problem is related but a bit different. 1. First of all, package "RGTk2" requires some external libraries to be installed beforehand (Cairo >= 1.0.0, ATK >= 1.10.0, Pango >= 1.10.0, GTK+ >= 2.8.0, GLib >= 2.8.0). Also, for my package to work I need to have "gdal" installed on the target PC with hdf4 support. Setting the following YAML file allows me to pass the checks on TRAVIS-CI (https://travis-ci.org/lbusett/MODIStsp/builds/168603035): > language: r > cache: packages > warnings_are_errors: false > matrix: > include: > - os: linux > dist: trusty > sudo: required > env: > global: > - R_BUILD_ARGS=" " > - R_CHECK_ARGS="--no-build-vignettes --no-manual --timings" > - R_CHECK_TIMINGS_="0" > - BOOTSTRAP_LATEX="1" > addons: > apt: > packages: > - libgdal-dev > - libproj-dev > - libcurl4-openssl-dev > - libgtk-3-dev > r_binary_packages: > - cairoDevice > - RGtk2 however, what I don't know is if/how/where I should specify these kind of dependencies for CRAN submission . Can anyone explain this to me, or point me to some reference ? 2. The second problem is again related to `gWidgetsRGtk2` dependency. If I keep the dependency in, the build fails with this message (https://travis-ci.org/lbusett/MODIStsp/builds/168600394): > installing *source* package ‘gWidgetsRGtk2’ ... package > ‘gWidgetsRGtk2’ successfully unpacked and MD5 sums checked R inst > tests preparing package for lazy loading R session is headless; GTK+ > not initialized. (R:15669): Gtk-WARNING **: gtk_disable_setlocale() > must be called before gtk_init() Error : .onLoad failed in > loadNamespace() for 'cairoDevice', details: > > call: fun(libname, pkgname) error: GDK display not found - please > make sure X11 is running Error : package ‘cairoDevice’ could not be > loaded ERROR: lazy loading failed for package ‘gWidgetsRGtk2’ > > removing ‘/home/travis/R/Library/gWidgetsRGtk2’ > > Error: Command failed (1) > > Execution halted > > The command "Rscript -e 'deps <- > devtools::dev_package_deps(dependencies = > NA);devtools::install_deps(dependencies = TRUE);if (!all(deps$package > %in% installed.packages())) { message("missing: ", > paste(setdiff(deps$package, installed.packages()), collapse=", ")); > q(status = 1, save = "no")}'" failed and exited with 1 during . As in the Windows case, the problem disappears if I remove the `gWidgetsRGtk2` dependency, ....but then I get the WARNING in build/installation. I don't hink however that it's the same problem: here it seems that the fail depends on the fact that x11 is not running on the "TRAVIS" machine (sorry if I don't make sense here, but I am quite a TRAVIS/Linux newby..) So, in the end, also in this case: Can anyone suggest a way to solve this before I start the submission process ? Thanks in advance for any help ! (And thanks for bearing with me up to the end of this novel.... ) ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel