Cannot install ggpattern and its dependencies on R Studio Server Pro

I am trying to use a non-CRAN package called {ggpattern} with an R Shiny app that will be published from R Studio Server Pro but I cannot install the dependencies of {ggpattern} on R Studio Server Pro. I can install, load and use {ggpattern} and all its dependencies just fine on my local machine.

{ggpattern} depends on {gridpattern} (also a non-CRAN package) which in turn depends on a packages {wk}, {sf}, {s2}, {units}. These last four packages are on CRAN.

When installing {wk} the following error occurs (short version):

error: ‘for’ loop initial declarations are only allowed in C99 mode

{sf} and {s2} depend on {wk} so those installs also fail.

When installing {units} the following error occurs (short version):

configure: error: in `/tmp/RtmpMGHZFy/R.INSTALL1ab231ae011a5/units':
configure: error: 
--------------------------------------------------------------------------------
  Configuration failed because libudunits2.so was not found. Try installing:
    * deb: libudunits2-dev (Debian, Ubuntu, ...)
    * rpm: udunits2-devel (Fedora, EPEL, ...)
    * brew: udunits (OSX)
  If udunits2 is already installed in a non-standard location, use:
    --configure-args='--with-udunits2-lib=/usr/local/lib'
  if the library was not found, and/or:
    --configure-args='--with-udunits2-include=/usr/include/udunits2'
  if the header was not found, replacing paths with appropriate values.
  You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually.

At the bottom of this post I have the full console output at my attempt to install {gridpattern}.

Note that {gridpattern} needs to be installed before {ggpattern} otherwise {ggpattern} will try to also install {magik} which creates another dependency issue. I don't need {magik} for what I need to do in the end, so I'm not concerned with it.

I have consulted my organization's R Studio Pro administrator and I was advised just not to use non-CRAN packages.

I have tried to extract just the functions and data I need from {ggpattern} and {gridpattern} and put them into a script for the shiny app to use in order to eliminate installing these packages. However when I did this, in the end, I found I still need {sf} installed for that strategy to work.

I have been emailing with the maintainer of {ggpattern} and {gridpattern} but we seem to be at a dead end unless I can figure out how to install at least {sf} or all of these dependencies on R Studio Server Pro.

Here is the full console output when I try to install {gridpattern}:

> remotes::install_github("trevorld/gridpattern")
Downloading GitHub repo trevorld/gridpattern@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

1: All                            
2: CRAN packages only             
3: None                           
4: proxy (0.4-25 -> 0.4-26) [CRAN]
5: rlang (0.4.11 -> 0.4.12) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 1
wk    (NA     -> 0.5.0 ) [CRAN]
proxy (0.4-25 -> 0.4-26) [CRAN]
rlang (0.4.11 -> 0.4.12) [CRAN]
units (NA     -> 0.7-2 ) [CRAN]
s2    (NA     -> 1.0.7 ) [CRAN]
sf    (NA     -> 1.0-3 ) [CRAN]
Installing 6 packages: wk, proxy, rlang, units, s2, sf
Installing packages into ‘/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/wk_0.5.0.tar.gz'
Content type 'application/x-gzip' length 138686 bytes (135 KB)
==================================================
downloaded 135 KB

trying URL 'https://cran.rstudio.com/src/contrib/proxy_0.4-26.tar.gz'
Content type 'application/x-gzip' length 116286 bytes (113 KB)
==================================================
downloaded 113 KB

trying URL 'https://cran.rstudio.com/src/contrib/rlang_0.4.12.tar.gz'
Content type 'application/x-gzip' length 861658 bytes (841 KB)
==================================================
downloaded 841 KB

trying URL 'https://cran.rstudio.com/src/contrib/units_0.7-2.tar.gz'
Content type 'application/x-gzip' length 855840 bytes (835 KB)
==================================================
downloaded 835 KB

trying URL 'https://cran.rstudio.com/src/contrib/s2_1.0.7.tar.gz'
Content type 'application/x-gzip' length 2235408 bytes (2.1 MB)
==================================================
downloaded 2.1 MB

trying URL 'https://cran.rstudio.com/src/contrib/sf_1.0-3.tar.gz'
Content type 'application/x-gzip' length 3524145 bytes (3.4 MB)
==================================================
downloaded 3.4 MB

* installing *source* package ‘wk’ ...
** package ‘wk’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/ds/c7/R/4.04/lib64/R/include" -DNDEBUG -I../inst/include/ -I'/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0/cpp11/include' -I/usr/local/include   -fpic  -g -O2  -c bbox-handler.c -o bbox-handler.o
gcc -I"/ds/c7/R/4.04/lib64/R/include" -DNDEBUG -I../inst/include/ -I'/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0/cpp11/include' -I/usr/local/include   -fpic  -g -O2  -c count-handler.c -o count-handler.o
g++ -std=gnu++11 -I"/ds/c7/R/4.04/lib64/R/include" -DNDEBUG -I../inst/include/ -I'/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0/cpp11/include' -I/usr/local/include   -fpic  -g -O2  -c cpp11.cpp -o cpp11.o
gcc -I"/ds/c7/R/4.04/lib64/R/include" -DNDEBUG -I../inst/include/ -I'/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0/cpp11/include' -I/usr/local/include   -fpic  -g -O2  -c debug-filter.c -o debug-filter.o
debug-filter.c: In function ‘wk_debug_filter_print_indent’:
debug-filter.c:115:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (int i = 0; i < debug_filter->level; i++) {
   ^
debug-filter.c:115:3: note: use option -std=c99 or -std=gnu99 to compile your code
make: *** [debug-filter.o] Error 1
ERROR: compilation failed for package ‘wk’
* removing ‘/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0/wk’
* installing *source* package ‘proxy’ ...
** package ‘proxy’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/ds/c7/R/4.04/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c apply.c -o apply.o
gcc -I"/ds/c7/R/4.04/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c arrayIndex.c -o arrayIndex.o
gcc -I"/ds/c7/R/4.04/lib64/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c distance.c -o distance.o
distance.c: In function ‘R_bjaccard’:
distance.c:393:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (int k = 0; k < LENGTH(r); k++) {
     ^
distance.c:393:5: note: use option -std=c99 or -std=gnu99 to compile your code
make: *** [distance.o] Error 1
ERROR: compilation failed for package ‘proxy’
* removing ‘/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0/proxy’
* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/ds/c7/R/4.04/lib64/R/include" -DNDEBUG -I./lib/  -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2  -c capture.c -o capture.o
gcc -I"/ds/c7/R/4.04/lib64/R/include" -DNDEBUG -I./lib/  -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2  -c export.c -o export.o
In file included from export.c:1:0:
export/exported.c: In function ‘rlang_env_bind_list’:
export/exported.c:93:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (r_ssize i = 0; i < n; ++i) {
   ^
export/exported.c:93:3: note: use option -std=c99 or -std=gnu99 to compile your code
In file included from export.c:1:0:
export/exported.c: In function ‘rlang_is_string’:
export/exported.c:572:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (r_ssize i = 0; i < n; ++i) {
   ^
make: *** [export.o] Error 1
ERROR: compilation failed for package ‘rlang’
* removing ‘/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0/rlang’
* installing *source* package ‘units’ ...
** package ‘units’ successfully unpacked and MD5 sums checked
** using staged installation
configure: units: 0.7-2
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ -std=gnu++11 accepts -g... yes
checking how to run the C++ preprocessor... g++ -std=gnu++11 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... no
checking for error_at_line... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... yes
checking udunits2.h usability... no
checking udunits2.h presence... no
checking for udunits2.h... no
checking udunits2/udunits2.h usability... no
checking udunits2/udunits2.h presence... no
checking for udunits2/udunits2.h... no
checking for ut_read_xml in -ludunits2... no
configure: error: in `/tmp/RtmpMGHZFy/R.INSTALL1ab231ae011a5/units':
configure: error: 
--------------------------------------------------------------------------------
  Configuration failed because libudunits2.so was not found. Try installing:
    * deb: libudunits2-dev (Debian, Ubuntu, ...)
    * rpm: udunits2-devel (Fedora, EPEL, ...)
    * brew: udunits (OSX)
  If udunits2 is already installed in a non-standard location, use:
    --configure-args='--with-udunits2-lib=/usr/local/lib'
  if the library was not found, and/or:
    --configure-args='--with-udunits2-include=/usr/include/udunits2'
  if the header was not found, replacing paths with appropriate values.
  You can alternatively set UDUNITS2_INCLUDE and UDUNITS2_LIBS manually.
--------------------------------------------------------------------------------

See `config.log' for more details
ERROR: configuration failed for package ‘units’
* removing ‘/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0/units’
ERROR: dependency ‘wk’ is not available for package ‘s2’
* removing ‘/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0/s2’
ERROR: dependencies ‘s2’, ‘units’ are not available for package ‘sf’
* removing ‘/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0/sf’

The downloaded source packages are in
     ‘/tmp/RtmpmIXUnU/downloaded_packages’✓  checking for file ‘/tmp/RtmpmIXUnU/remotes18febb5af499/trevorld-gridpattern-87174ca/DESCRIPTION’ (344ms)─  preparing ‘gridpattern’:✓  checking DESCRIPTION meta-information ...
─  checking for LF line-endings in source and make files and shell scripts─  checking for empty or unneeded directories─  building ‘gridpattern_0.3.0-3.tar.gz’
   Warning: invalid uid value replaced by that for user 'nobody'
   
Installing package into ‘/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
ERROR: dependency ‘sf’ is not available for package ‘gridpattern’
* removing ‘/homes1/sknapp/R/x86_64-pc-linux-gnu-library/4.0/gridpattern’
Warning messages:
1: In i.p(...) : installation of package ‘wk’ had non-zero exit status
2: In i.p(...) : installation of package ‘proxy’ had non-zero exit status
3: In i.p(...) : installation of package ‘rlang’ had non-zero exit status
4: In i.p(...) : installation of package ‘units’ had non-zero exit status
5: In i.p(...) : installation of package ‘s2’ had non-zero exit status
6: In i.p(...) : installation of package ‘sf’ had non-zero exit status
7: In i.p(...) :
  installation of package ‘/tmp/RtmpmIXUnU/file18feb41d79d1c/gridpattern_0.3.0-3.tar.gz’ had non-zero exit status

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.