install.package("ggiraph") 时出错:"no matching function for call to ‘regex_replace" / AWS 云上的 RStudio Linux
Error when install.package("ggiraph"): "no matching function for call to ‘regex_replace" / RStudio on AWS-Cloud Linux
尝试在 R 中安装 ggiraph 时出现此错误(RStudio 服务器在基于 linux 的 AWS 实例上,新的 RStudio 和 R 版本)。
在任何地方都找不到有关 linux 系统的任何建议(仅适用于 OS X)。
有没有人遇到同样的问题,你是怎么解决的?
谢谢!
错误信息:
dsvg.cpp: In function ‘std::string compile_css(const string&, const char*, const string&, const char*, const char*, const char*)’:
dsvg.cpp:725:46: error: no matching function for call to ‘regex_replace(const char*&, std::regex&, std::string&)’
return std::regex_replace(css, pattern, cls);
^
dsvg.cpp:725:46: note: candidates are:
In file included from /usr/include/c++/4.8.2/regex:62:0,
from dsvg.cpp:16:
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
^
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template argument deduction/substitution failed:
dsvg.cpp:725:46: note: deduced conflicting types for parameter ‘_Bi_iter’ (‘std::basic_regex<char>’ and ‘std::basic_string<char>’)
return std::regex_replace(css, pattern, cls);
^
In file included from /usr/include/c++/4.8.2/regex:62:0,
from dsvg.cpp:16:
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template<class _Rx_traits, class _Ch_type> std::basic_string<_Ch_type> std::regex_replace(const std::basic_string<_Ch_type>&, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
regex_replace(const basic_string<_Ch_type>& __s,
^
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template argument deduction/substitution failed:
dsvg.cpp:725:46: note: mismatched types ‘const std::basic_string<_Ch_type>’ and ‘const char*’
return std::regex_replace(css, pattern, cls);
^
dsvg.cpp:726:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
...
^
make: *** [dsvg.o] Error 1
ERROR: compilation failed for package ‘ggiraph’
removing ‘/home/sandbox/R/x86_64-redhat-linux-gnu-library/3.6/ggiraph’
restoring previous ‘/home/sandbox/R/x86_64-redhat-linux-gnu-library/3.6/ggiraph’
Error: Failed to install 'ggiraph' from GitHub:
(converted from warning) installation of package ‘/tmp/RtmpU8zekV/file485f57d349a8/ggiraph_0.7.9.tar.gz’ had non-zero exit status
对于这个问题,我的解决方案是更新 linux GCC 版本。
在您的终端上键入脚本以更新 GCC。
gcc -v ## to check your gcc version(original centos 7 seems 2.5.4)
并参考本文更新开发者工具8 https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/
在 CentOS 上,安装 CentOS 存储库中可用的软件包 centos-release-scl:
sudo yum install centos-release-scl
在 RHEL 上,为您的系统启用 RHSCL 存储库:
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
安装集合:
sudo yum install devtoolset-8
开始使用软件合集:
scl enable devtoolset-8 bash
检查您的 GCC 版本是最新的:
gcc -v #### Now GCC version should be 8.3.1 20190311
进入 R 以在终端上安装 ggiraph:
sudo R
安装 ggiraph 包:
install.packages('ggiraph', repos='http://cran.us.r-project.org')
退出终端R
q() # type "n" to not save workspace image
并切换到 rstudio 控制台,库 ggiraph 包
library(ggiraph)
ggiraph的所有功能现在都可以使用了! :D
尝试在 R 中安装 ggiraph 时出现此错误(RStudio 服务器在基于 linux 的 AWS 实例上,新的 RStudio 和 R 版本)。
在任何地方都找不到有关 linux 系统的任何建议(仅适用于 OS X)。
有没有人遇到同样的问题,你是怎么解决的?
谢谢!
错误信息:
dsvg.cpp: In function ‘std::string compile_css(const string&, const char*, const string&, const char*, const char*, const char*)’:
dsvg.cpp:725:46: error: no matching function for call to ‘regex_replace(const char*&, std::regex&, std::string&)’
return std::regex_replace(css, pattern, cls);
^
dsvg.cpp:725:46: note: candidates are:
In file included from /usr/include/c++/4.8.2/regex:62:0,
from dsvg.cpp:16:
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
^
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template argument deduction/substitution failed:
dsvg.cpp:725:46: note: deduced conflicting types for parameter ‘_Bi_iter’ (‘std::basic_regex<char>’ and ‘std::basic_string<char>’)
return std::regex_replace(css, pattern, cls);
^
In file included from /usr/include/c++/4.8.2/regex:62:0,
from dsvg.cpp:16:
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template<class _Rx_traits, class _Ch_type> std::basic_string<_Ch_type> std::regex_replace(const std::basic_string<_Ch_type>&, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
regex_replace(const basic_string<_Ch_type>& __s,
^
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template argument deduction/substitution failed:
dsvg.cpp:725:46: note: mismatched types ‘const std::basic_string<_Ch_type>’ and ‘const char*’
return std::regex_replace(css, pattern, cls);
^
dsvg.cpp:726:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
...
^
make: *** [dsvg.o] Error 1
ERROR: compilation failed for package ‘ggiraph’
removing ‘/home/sandbox/R/x86_64-redhat-linux-gnu-library/3.6/ggiraph’
restoring previous ‘/home/sandbox/R/x86_64-redhat-linux-gnu-library/3.6/ggiraph’
Error: Failed to install 'ggiraph' from GitHub:
(converted from warning) installation of package ‘/tmp/RtmpU8zekV/file485f57d349a8/ggiraph_0.7.9.tar.gz’ had non-zero exit status
对于这个问题,我的解决方案是更新 linux GCC 版本。 在您的终端上键入脚本以更新 GCC。
gcc -v ## to check your gcc version(original centos 7 seems 2.5.4)
并参考本文更新开发者工具8 https://www.softwarecollections.org/en/scls/rhscl/devtoolset-8/
在 CentOS 上,安装 CentOS 存储库中可用的软件包 centos-release-scl:
sudo yum install centos-release-scl
在 RHEL 上,为您的系统启用 RHSCL 存储库:
sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
安装集合:
sudo yum install devtoolset-8
开始使用软件合集:
scl enable devtoolset-8 bash
检查您的 GCC 版本是最新的:
gcc -v #### Now GCC version should be 8.3.1 20190311
进入 R 以在终端上安装 ggiraph:
sudo R
安装 ggiraph 包:
install.packages('ggiraph', repos='http://cran.us.r-project.org')
退出终端R
q() # type "n" to not save workspace image
并切换到 rstudio 控制台,库 ggiraph 包
library(ggiraph)
ggiraph的所有功能现在都可以使用了! :D