繁体   English   中英

编译错误Rcpp

[英]Trouble Compiling Rcpp

我在CentOS 6.5机器上安装Rcpp for R 3.2.2时遇到一些麻烦。 我在StackOverflow和其他论坛上发现的解决方案都没有太大帮助,但这些解决方案并没有真正帮助到这里。 如果我尝试从R或从命令行使用R CMD INSTALL ,则会遇到类似的错误,最终最终导致无法安装Rcpp并出现最终错误make: *** [Date.o] Error 1和该行在/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/exception:35: error: expected declaration before end of line之前的/ error /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/exception:35: error: expected declaration before end of line

下面是我从https://cran.rstudio.com/src/contrib/抓取到压缩包后通过R CMD INSTALL Rcpp_0.12.1.tar.gz进行安装的尝试。

$ sudo R CMD INSTALL Rcpp_0.12.1.tar.gz
* installing to library ‘/usr/lib64/R/library’
* installing *source* package ‘Rcpp’ ...
** package ‘Rcpp’ successfully unpacked and MD5 sums checked
** libs
g++ -m64 -I/usr/include/R -DNDEBUG -I../inst/include/ -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c Date.cpp -o Date.o
In file included from ../inst/include/Rcpp/platform/compiler.h:100,
                 from ../inst/include/Rcpp/r/headers.h:48,
                 from ../inst/include/RcppCommon.h:29,
                 from ../inst/include/Rcpp.h:27,
                 from Date.cpp:31:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/cmath:43:28: error: bits/c++config.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_tree.h:63,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/map:60,
                 from ../inst/include/Rcpp/platform/compiler.h:176,
                 from ../inst/include/Rcpp/r/headers.h:48,
                 from ../inst/include/RcppCommon.h:29,
                 from ../inst/include/Rcpp.h:27,
                 from Date.cpp:31:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/allocator.h:48:31: error: bits/c++allocator.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ios:42,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ostream:40,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/iterator:65,
                 from ../inst/include/RcppCommon.h:49,
                 from ../inst/include/Rcpp.h:27,
                 from Date.cpp:31:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/localefwd.h:42:76: error: bits/c++locale.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/ios_base.h:41,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ios:43,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ostream:40,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/iterator:65,
                 from ../inst/include/RcppCommon.h:49,
                 from ../inst/include/Rcpp.h:27,
                 from Date.cpp:31:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/atomicity.h:34:23: error: bits/gthr.h: No such file or directory
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/atomicity.h:35:30: error: bits/atomic_word.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_ios.h:39,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ios:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ostream:40,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/iterator:65,
                 from ../inst/include/RcppCommon.h:49,
                 from ../inst/include/Rcpp.h:27,
                 from Date.cpp:31:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/locale_facets.h:43:30: error: bits/ctype_base.h: No such file or directory
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/locale_facets.h:1510:31: error: bits/ctype_inline.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/cmath:44,
                 from ../inst/include/Rcpp/platform/compiler.h:100,
                 from ../inst/include/Rcpp/r/headers.h:48,
                 from ../inst/include/RcppCommon.h:29,
                 from ../inst/include/Rcpp.h:27,
                 from Date.cpp:31:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:69: error: expected constructor, destructor, or type conversion before ‘(’ token
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:74: error: ‘_GLIBCXX_END_NAMESPACE’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:87: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:110: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:125: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:145: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:152: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:159: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:166: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:198: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:205: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:212: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:219: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:226: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:233: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:240: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:247: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:265: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:272: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:279: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:296: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:310: error: ‘__gnu_cxx’ was not declared in this scope
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:311: error: template argument 1 is invalid
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:355: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:378: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:385: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:392: error: ‘__true_type’ does not name a type
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/cpp_type_traits.h:417: error: ‘_GLIBCXX_END_NAMESPACE’ does not name a type
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/cmath:45,
                 from ../inst/include/Rcpp/platform/compiler.h:100,
                 from ../inst/include/Rcpp/r/headers.h:48,
                 from ../inst/include/RcppCommon.h:29,
                 from ../inst/include/Rcpp.h:27,
                 from Date.cpp:31:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:45: error: ‘__enable_if’ is not a template
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:64: error: ‘__is_integer’ is not a member of ‘std’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:64: error: ‘__is_integer’ is not a member of ‘std’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:64: error: template argument 1 is invalid
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:64: error: typedef name may not be a nested-name-specifier
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:64: error: expected ‘;’ before ‘>’ token
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:67: error: ‘__if_type’ has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:107: error: ‘__is_integer’ is not a member of ‘std’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:107: error: ‘__is_integer’ is not a member of ‘std’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:107: error: template argument 1 is invalid
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:107: error: typedef name may not be a nested-name-specifier
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:107: error: expected ‘;’ before ‘>’ token
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:110: error: ‘__if_type’ has not been declared
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:158: error: ‘__is_integer’ is not a member of ‘std’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:158: error: expected primary-expression before ‘>’ token
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:158: error: expected constructor, destructor, or type conversion before ‘>’ token
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ext/type_traits.h:163: error: ‘__promote’ is not a template
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/cmath:46,
                 from ../inst/include/Rcpp/platform/compiler.h:100,
                 from ../inst/include/Rcpp/r/headers.h:48,
                 from ../inst/include/RcppCommon.h:29,
                 from ../inst/include/Rcpp.h:27,
                 from Date.cpp:31:
/usr/include/math.h:30: error: expected constructor, destructor, or type conversion before ‘extern’
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ios:40,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/ostream:40,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/iterator:65,
                 from ../inst/include/RcppCommon.h:49,
                 from ../inst/include/Rcpp.h:27,
                 from Date.cpp:31:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/exception:35: error: expected declaration before end of line
make: *** [Date.o] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/usr/lib64/R/library/Rcpp’

我尝试过的其他事情

  • 验证是否已安装gcc.x86_64gcc-c++.x86_64gcc-gfortran.x86_64
  • 确认已安装makeautomake

正如上面评论中指出的那样,技巧是通过SCL使用新版本的编译器。

以下步骤是从Ask Axmodulo上的此页面改编而成的。

$ sudo wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -P /etc/yum.repos.d
$ sudo sh -c 'echo "enabled=1" >> /etc/yum.repos.d/devtools-1.1.repo'

在RHEL6上,您可能需要更新已安装的.repo文件,以将baseurl手动设置为http://people.centos.org/tru/devtools-1.1/6/$basearch/RPMS 从那里:

$ sudo yum install devtoolset-1.1

要安装系统范围的R库,您需要以root用户身份运行它,因此先执行scl enable devtoolset-1.1 bash ,然后运行sudo R将运行该应用程序,但未启用SCL。 所以与其:

$ sudo scl enable devtoolset-1.1 bash

这将以启用SCL的root身份启动bash shell。 最后,您可以使用以下命令安装该库:

# R CMD INSTALL Rcpp_0.12.1.tar.gz

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM