ggiraph icon indicating copy to clipboard operation
ggiraph copied to clipboard

Unable to install 0.8.2 on Mac

Open sgaj opened this issue 3 years ago • 1 comments

When trying to install ggiraph v0.8.2 on my Mac I run into a similar issue as reported in https://github.com/davidgohel/ggiraph/issues/178

OS Version: Mac OS Big Sur 11.6.5 R version: 4.0.2

Tried everything that was recommended in that ticket (see below), but to no avail. Does anyone have any other suggestions on how to resolve this?

//edit The referred ticket is not 100% similar, as it is clearly seems to be a compiler issue. In this issue the installer generates an error due to a missing file:

raster.cpp:7:10: fatal error: 'png.h' file not found
#include <png.h>
         ^~~~~~~

(full log below)

Attempted solutions

Tried installing through RStudio package manager

Selected MacOS and installed package using source link provided by PM:

> install.packages("ggiraph", repos = "https://packagemanager.rstudio.com/cran/latest/")
Installing package into ‘/Users/xxx/Library/R/4.0/library’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘ggiraph’
Do you want to attempt to install these from sources? (Yes/no/cancel) 

--> Package needs compilation --> runs into same error.

Update gcc to latest version

brewer install gcc

This installed GCC v11.3.0

Logs

Console log

> install.packages("ggiraph", repos = "https://packagemanager.rstudio.com/cran/latest/")
Installing package into ‘/Users/xxx/Library/R/4.0/library’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘ggiraph’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package ‘ggiraph’

trying URL 'https://packagemanager.rstudio.com/cran/latest/src/contrib/ggiraph_0.8.2.tar.gz'
Content type 'binary/octet-stream' length 358396 bytes (349 KB)
==================================================
downloaded 349 KB

* installing *source* package ‘ggiraph’ ...
** package ‘ggiraph’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/sgaj/Library/R/4.0/library/Rcpp/include' -I'/Users/sgaj/Library/R/4.0/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/sgaj/Library/R/4.0/library/Rcpp/include' -I'/Users/sgaj/Library/R/4.0/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c a_color.cpp -o a_color.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/sgaj/Library/R/4.0/library/Rcpp/include' -I'/Users/sgaj/Library/R/4.0/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c clip.cpp -o clip.o
In file included from clip.cpp:4:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:7:
./interactive.h:23:9: warning: 'InteractiveElements::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: different number of parameters (2 vs 1)
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
In file included from clip.cpp:4:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:8:
./clip.h:27:9: warning: 'Clips::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el, const char* key = NULL);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: type mismatch at 2nd parameter ('const bool &' vs 'const char *')
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
2 warnings generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/sgaj/Library/R/4.0/library/Rcpp/include' -I'/Users/sgaj/Library/R/4.0/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c dsvg.cpp -o dsvg.o
In file included from dsvg.cpp:9:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:7:
./interactive.h:23:9: warning: 'InteractiveElements::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: different number of parameters (2 vs 1)
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
In file included from dsvg.cpp:9:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:8:
./clip.h:27:9: warning: 'Clips::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el, const char* key = NULL);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: type mismatch at 2nd parameter ('const bool &' vs 'const char *')
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
2 warnings generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/sgaj/Library/R/4.0/library/Rcpp/include' -I'/Users/sgaj/Library/R/4.0/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c dsvg_dev.cpp -o dsvg_dev.o
In file included from dsvg_dev.cpp:1:
In file included from ./dsvg_dev.h:7:
./interactive.h:23:9: warning: 'InteractiveElements::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: different number of parameters (2 vs 1)
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
In file included from dsvg_dev.cpp:1:
In file included from ./dsvg_dev.h:8:
./clip.h:27:9: warning: 'Clips::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el, const char* key = NULL);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: type mismatch at 2nd parameter ('const bool &' vs 'const char *')
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
2 warnings generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/sgaj/Library/R/4.0/library/Rcpp/include' -I'/Users/sgaj/Library/R/4.0/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c geom.cpp -o geom.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/sgaj/Library/R/4.0/library/Rcpp/include' -I'/Users/sgaj/Library/R/4.0/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c indexed.cpp -o indexed.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/sgaj/Library/R/4.0/library/Rcpp/include' -I'/Users/sgaj/Library/R/4.0/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c interactive.cpp -o interactive.o
In file included from interactive.cpp:4:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:7:
./interactive.h:23:9: warning: 'InteractiveElements::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: different number of parameters (2 vs 1)
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
In file included from interactive.cpp:4:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:8:
./clip.h:27:9: warning: 'Clips::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el, const char* key = NULL);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: type mismatch at 2nd parameter ('const bool &' vs 'const char *')
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
2 warnings generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/sgaj/Library/R/4.0/library/Rcpp/include' -I'/Users/sgaj/Library/R/4.0/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c mask.cpp -o mask.o
In file included from mask.cpp:4:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:7:
./interactive.h:23:9: warning: 'InteractiveElements::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: different number of parameters (2 vs 1)
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
In file included from mask.cpp:4:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:8:
./clip.h:27:9: warning: 'Clips::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el, const char* key = NULL);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: type mismatch at 2nd parameter ('const bool &' vs 'const char *')
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
2 warnings generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/sgaj/Library/R/4.0/library/Rcpp/include' -I'/Users/sgaj/Library/R/4.0/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c pattern.cpp -o pattern.o
In file included from pattern.cpp:4:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:7:
./interactive.h:23:9: warning: 'InteractiveElements::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: different number of parameters (2 vs 1)
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
In file included from pattern.cpp:4:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:8:
./clip.h:27:9: warning: 'Clips::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el, const char* key = NULL);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: type mismatch at 2nd parameter ('const bool &' vs 'const char *')
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
2 warnings generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/sgaj/Library/R/4.0/library/Rcpp/include' -I'/Users/sgaj/Library/R/4.0/library/systemfonts/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c raster.cpp -o raster.o
In file included from raster.cpp:4:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:7:
./interactive.h:23:9: warning: 'InteractiveElements::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: different number of parameters (2 vs 1)
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
In file included from raster.cpp:4:
In file included from ./dsvg.h:7:
In file included from ./dsvg_dev.h:8:
./clip.h:27:9: warning: 'Clips::push' hides overloaded virtual function [-Woverloaded-virtual]
  INDEX push(SVGElement* el, const char* key = NULL);
        ^
./indexed.h:29:17: note: hidden overloaded virtual function 'IndexedElements::push' declared here: type mismatch at 2nd parameter ('const bool &' vs 'const char *')
  virtual INDEX push(SVGElement* el, const bool& add_id = true);
                ^
raster.cpp:7:10: fatal error: 'png.h' file not found
#include <png.h>
         ^~~~~~~
2 warnings and 1 error generated.
make: *** [raster.o] Error 1
ERROR: compilation failed for package ‘ggiraph’
* removing ‘/Users/xxx/Library/R/4.0/library/ggiraph’
* restoring previous ‘/Users/xxx/Library/R/4.0/library/ggiraph’
Warning in install.packages :
  installation of package ‘ggiraph’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/sy/c_4d3lqx5sd4y8_c_f4cq8b40000gp/T/RtmpZuXKZ5/downloaded_packages’

SessionInfo

R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS  10.16

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2   

sgaj avatar May 03 '22 09:05 sgaj

The missing png.h file indicated that the libpng system library may not have been available. After installing this library (through brewer), I was able to install the package.

Still, the warning messages remain and I am uncertain if these can be safely ignored. So I'm leaving it up to the developers to decide if this ticket can be closed or if they want to address the warning messages!

sgaj avatar May 03 '22 20:05 sgaj

We can ignore the warnings.

About libpng, it is a mandatory library when using R for mac...

For those who don't want to spend time on compilation, use https://davidgohel.r-universe.dev/ui#package:ggiraph

davidgohel avatar Nov 16 '22 08:11 davidgohel