簡體   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