Apple M1在从源代码安装时,在R包的预期库中没有png.h
。
我用自制软件安装的
> brew install libpng
其将png.h
安装到,
/opt/homebrew/Cellar/libpng/1.6.39/include/libpng16/png.h
符号链接为,
/opt/homebrew/include/png.h
当我尝试安装软件包时,
install.packages("ggiraph", type = "source")
我得到了错误,
clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/systemfonts/include' -I/opt/R/arm64/include -fPIC -falign-functions=64 -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>
^~~~~~~
1条答案
按热度按时间zwghvu4y1#
如果你是从CRAN二进制文件而不是从源代码安装R,那么你应该使用here托管的二进制文件安装外部库,而不是从Homebrew安装,Homebrew的二进制文件可能与CRAN的不兼容。在你的情况下,我会尝试:
这应该在
/opt/R/arm64
下安装libpng
,其中CRAN将R配置为查找外部库。您可以使用R CMD config
查询默认搜索路径:如果您坚持使用Homebrew安装,则通过设置
PKG_CPPFLAGS
和PKG_LIBS
添加到默认搜索路径: